<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.mulesoft.connectivity</groupId>
    <artifactId>rest-sdk-descriptor-generator</artifactId>
    <version>0.2.0</version>
    <packaging>maven-plugin</packaging>

    <name>REST SDK Descriptor Generator</name>
    <description>A MOJO that creates a REST-SDK descriptor from an API SPEC, adding support for vendor extensions that allow to customize the generated connector.</description>
    <inceptionYear>2023</inceptionYear>
    <organization>
        <name>Mulesoft</name>
        <url>https://www.mulesoft.com/</url>
    </organization>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <slf4j.version>1.7.36</slf4j.version>
        <log4j.version>2.20.0</log4j.version>
        <rest.sdk.version>0.10.0</rest.sdk.version>
        <skipTests>false</skipTests>
        <skipITs>false</skipITs>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.mulesoft.connectivity</groupId>
            <artifactId>rest-sdk-web-api</artifactId>
            <version>${rest.sdk.version}</version>
        </dependency>
        <dependency>
            <groupId>com.mulesoft.connectivity</groupId>
            <artifactId>rest-sdk-connector-descriptor</artifactId>
            <version>${rest.sdk.version}</version>
        </dependency>
        <dependency>
            <groupId>com.mulesoft.connectivity</groupId>
            <artifactId>rest-sdk-connector-model</artifactId>
            <version>${rest.sdk.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>com.vaadin.external.google</groupId>
                    <artifactId>android-json</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.github.amlorg</groupId>
            <artifactId>amf-core_2.12</artifactId>
            <version>5.4.1</version>
        </dependency>
        <dependency>
            <groupId>com.github.amlorg</groupId>
            <artifactId>amf-shapes_2.12</artifactId>
            <version>5.4.1</version>
        </dependency>
        <dependency>
            <groupId>com.github.amlorg</groupId>
            <artifactId>amf-api-contract_2.12</artifactId>
            <version>5.4.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
            <version>3.9.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>3.9.4</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <version>3.9.4</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>${log4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j-impl</artifactId>
            <version>${log4j.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest</artifactId>
            <version>2.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-library</artifactId>
            <version>2.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.yaml</groupId>
            <artifactId>snakeyaml</artifactId>
            <version>2.1</version>
        </dependency>
        <dependency>
            <groupId>org.jetbrains</groupId>
            <artifactId>annotations</artifactId>
            <version>24.0.1</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.mulesoft.connectivity</groupId>
            <artifactId>rest-sdk-mojo</artifactId>
            <version>${rest.sdk.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>3.12.4</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <distributionManagement>
        <repository>
            <id>mule-releases</id>
            <name>Mule Release Repository</name>
            <url>https://repository-master.mulesoft.org/nexus/content/repositories/releases</url>
        </repository>
        <snapshotRepository>
            <id>mule-snapshots</id>
            <name>Mule Snapshot Repository</name>
            <url>https://repository-master.mulesoft.org/nexus/content/repositories/snapshots</url>
            <uniqueVersion>false</uniqueVersion>
        </snapshotRepository>
    </distributionManagement>

    <scm>
        <connection>scm:git:git://github.com:mulesoft/rest-sdk-descriptor-generator.git</connection>
        <developerConnection>scm:git:git@github.com:mulesoft/rest-sdk-descriptor-generator.git</developerConnection>
        <url>https://github.com/mulesoft/rest-sdk-descriptor-generator</url>
    </scm>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <version>3.9.0</version>
                <executions>
                    <execution>
                        <id>default-descriptor</id>
                        <goals>
                            <goal>descriptor</goal>
                        </goals>
                        <phase>process-classes</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.11.0</version>
                <configuration>
                    <compilerArgs>
                        <arg>-parameters</arg>
                    </compilerArgs>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>connector-generation-test</id>
            <activation>
                <property>
                    <name>skipITs</name>
                    <value>false</value>
                </property>
            </activation>

            <properties>
                <maven.invoker.plugin.version>3.5.1</maven.invoker.plugin.version>
                <rest.sdk.mojo.test.cases>${project.basedir}/src/test/resources/com/mulesoft/connectivity/rest/sdk/requirements/mapping/tests</rest.sdk.mojo.test.cases>
                <rest.sdk.mojo.test.output>${project.build.directory}/generated-test-connectors</rest.sdk.mojo.test.output>
            </properties>

            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-invoker-plugin</artifactId>
                        <version>${maven.invoker.plugin.version}</version>
                        <configuration>
                            <goals>
                                <goal>clean</goal>
                                <goal>install</goal>
                            </goals>
                            <properties>
                                <skipTests>${skipTests}</skipTests>
                                <skipITs>${skipITs}</skipITs>
                                <rest.sdk.descriptor.generator.version>${project.version}</rest.sdk.descriptor.generator.version>
                            </properties>
                            <projectsDirectory>${rest.sdk.mojo.test.cases}</projectsDirectory>
                            <cloneProjectsTo>${rest.sdk.mojo.test.output}</cloneProjectsTo>
                            <showErrors>true</showErrors>
                            <streamLogsOnFailures>true</streamLogsOnFailures>
                            <streamLogs>true</streamLogs>
                        </configuration>
                        <executions>
                            <execution>
                                <id>integration-test</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>integration-test</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
