<?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>
    <parent>
        <groupId>com.mulesoft.connectivity</groupId>
        <artifactId>reference-connector-parent</artifactId>
        <version>1.5.0-502.develop</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>reference-connector-flow-connector-model</artifactId>
    <packaging>dw-library</packaging>

    <properties>
        <pathToTop>../..</pathToTop>
        <oldVersion>1.1.0</oldVersion>
        <hamcrest.version>3.0</hamcrest.version>
        <junit.jupiter.version>5.13.4</junit.jupiter.version>
        <revapi.version>0.15.1</revapi.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.mulesoft.connectivity</groupId>
            <artifactId>connectivity-flow-language</artifactId>
            <classifier>dw-library</classifier>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>com.mulesoft.connectivity</groupId>
            <artifactId>connectivity-flow-extension</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>com.mulesoft.connectivity</groupId>
            <artifactId>reference-connector-connectivity-model</artifactId>
            <version>${project.version}</version>
            <classifier>dw-library</classifier>
        </dependency>

        <dependency>
            <groupId>com.mulesoft.connectivity</groupId>
            <artifactId>connectivity-content-document-service</artifactId>
            <version>${project.version}</version>
            <classifier>dw-library</classifier>
        </dependency>

        <dependency>
            <groupId>com.mulesoft.connectivity</groupId>
            <artifactId>connectivity-flow-language</artifactId>
            <version>${project.version}</version>
            <classifier>dw-library</classifier>
        </dependency>

        <dependency>
            <groupId>org.mule.weave</groupId>
            <artifactId>core</artifactId>
            <version>${data.weave.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mule.weave</groupId>
            <artifactId>parser</artifactId>
            <version>${data.weave.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mule.weave</groupId>
            <artifactId>runtime</artifactId>
            <version>${data.weave.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mule.weave</groupId>
            <artifactId>core-modules</artifactId>
            <version>${data.weave.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mule.weave</groupId>
            <artifactId>data-weave-testing-framework</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mule.weave</groupId>
            <artifactId>http-netty-module</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mule.weave</groupId>
            <artifactId>java-module</artifactId>
        </dependency>

        <!-- Required to resolve dw::javaplain native module used by Content Document Service -->
        <dependency>
            <groupId>org.mule.weave</groupId>
            <artifactId>java-plain-module</artifactId>
            <version>${data.weave.version}</version>
        </dependency>

        <!--Test dependencies -->
        <dependency>
            <groupId>com.mulesoft.connectivity</groupId>
            <artifactId>connectivity-content-document-service-impl</artifactId>
            <version>${project.version}</version>
            <classifier>dw-library</classifier>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.mulesoft.connectivity</groupId>
            <artifactId>connectivity-model-api</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${junit.jupiter.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit.jupiter.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-core</artifactId>
            <version>${hamcrest.version}</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>com.mulesoft.connectivity</groupId>
                <artifactId>connectivity-flow-maven-plugin</artifactId>
                <version>${project.version}</version>
                <configuration>
                    <dwRef>com::mulesoft::connectivity::reference::connector::Connector::connector</dwRef>
                    <releaseStatus>GA</releaseStatus>
                </configuration>
                <executions>
                    <execution>
                        <id>build-static-metadata</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>validateConnectorModel</goal>
                            <goal>createFlowStaticMetaData</goal>
                        </goals>
                    </execution>
                </executions>

                <dependencies>
                    <dependency>
                        <groupId>com.mulesoft.connectivity</groupId>
                        <artifactId>connectivity-flow-tooling-support</artifactId>
                        <version>${project.version}</version>
                    </dependency>
                     <!-- Ensure plugin classloader can resolve dw::javaplain native module -->
                    <dependency>
                        <groupId>org.mule.weave</groupId>
                        <artifactId>java-plain-module</artifactId>
                        <version>${data.weave.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-prod-resources</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <overwrite>true</overwrite>
                            <outputDirectory>${project.build.outputDirectory}/com/mulesoft/connectivity/reference/connector</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/dw/com/mulesoft/connectivity/reference/connector</directory>
                                    <include>**/Connector.dwl</include>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>


            <plugin>
                <groupId>org.revapi</groupId>
                <artifactId>revapi-maven-plugin</artifactId>
                <version>${revapi.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>com.mulesoft.connectivity</groupId>
                        <artifactId>connectivity-flow-revapi</artifactId>
                        <version>${project.version}</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <oldArtifacts>
                        <oldArtifact>${project.groupId}:reference-connector-connectivity-model:jar:dw-library:${oldVersion}</oldArtifact>
                        <oldArtifact>${project.groupId}:${project.artifactId}:jar:dw-library:${oldVersion}</oldArtifact>
                    </oldArtifacts>
                    <newArtifacts>
                        <newArtifact>${project.groupId}:reference-connector-connectivity-model:jar:dw-library:${project.version}</newArtifact>
                        <newArtifact>${project.groupId}:${project.artifactId}:jar:dw-library:${project.version}</newArtifact>
                    </newArtifacts>
                    <failOnUnresolvedArtifacts>true</failOnUnresolvedArtifacts>
                    <checkDependencies>false</checkDependencies>
                    <resolveTransitiveProvidedDependencies>false</resolveTransitiveProvidedDependencies>
                    <failOnMissingConfigurationFiles>false</failOnMissingConfigurationFiles>
                    <analysisConfiguration>
                        <flow-connector-analyzer>
                            <connectorName>RefConnector</connectorName>
                        </flow-connector-analyzer>
                        <revapi.differences id="intentional-api-changes">
                            <ignore>true</ignore>
                        </revapi.differences>
                        <revapi.versions>
                            <enabled>true</enabled>
                            <semantic0>false</semantic0>
                            <versionIncreaseAllows>
                                <major>
                                    <severity>BREAKING</severity>
                                </major>
                                <minor>
                                    <severity>NON_BREAKING</severity>
                                </minor>
                                <patch>
                                    <severity>EQUIVALENT</severity>
                                </patch>
                            </versionIncreaseAllows>
                        </revapi.versions>
                    </analysisConfiguration>
                    <analysisConfigurationFiles>
                        <configurationFile>
                            <path>${basedir}/api-changes.json</path>
                            <roots>
                                <root>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}</root>
                            </roots>
                        </configurationFile>
                    </analysisConfigurationFiles>
                </configuration>
<!--                <executions>-->
<!--                    <execution>-->
<!--                        <id>api-check</id>-->
<!--                        <goals>-->
<!--                            <goal>check</goal>-->
<!--                        </goals>-->
<!--                    </execution>-->
<!--                </executions>-->
            </plugin>
        </plugins>
    </build>
</project>
