<?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>connectivity-mule-adapter</artifactId>
        <version>1.1.0-SNAPSHOT</version>
    </parent>

    <artifactId>report-aggregate</artifactId>
    <packaging>pom</packaging>

    <profiles>
        <profile>
            <id>toolingTestsEnabled</id>
            <dependencies>
                <dependency>
                    <groupId>com.mulesoft.connectivity</groupId>
                    <artifactId>connectivity-mule-pulse-test-connector</artifactId>
                    <version>${project.version}</version>
                </dependency>
                <dependency>
                    <groupId>com.mulesoft.connectivity</groupId>
                    <artifactId>connectivity-mule-tooling-tests</artifactId>
                    <version>${project.version}</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>
    </profiles>

    <!-- The dependencies are used to configure the aggregate report:
         - Test scope means "don't track this code but use the jacoco.exec file".
         - Compiled scope means "track this code AND use the jacoco.exec file".

         For more details see:
         - https://www.jacoco.org/jacoco/trunk/doc/report-aggregate-mojo.html
         - https://github.com/jacoco/jacoco/tree/master/jacoco-maven-plugin.test/it/it-report-aggregate -->
    <dependencies>
        <!-- Our main java code: We want both to track its coverage and to use the coverage collected on its tests -->
        <dependency>
            <groupId>com.mulesoft.connectivity</groupId>
            <artifactId>connectivity-mule-extension</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.mulesoft.connectivity</groupId>
            <artifactId>connectivity-mule-persistence</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-module-extensions-ic-support</artifactId>
            <version>${project.version}</version>
        </dependency>
        <!-- Our tooling and DataWeave code: For now lets to the same as with the main code -->
        <dependency>
            <groupId>com.mulesoft.connectivity</groupId>
            <artifactId>connectivity-mule-maven-plugin</artifactId>
            <version>${project.version}</version>
        </dependency>

        <!-- Our testing library: We want to collect coverage information for these classes. -->
        <dependency>
            <groupId>com.mulesoft.connectivity</groupId>
            <artifactId>connectivity-test-commons</artifactId>
            <version>${project.version}</version>
        </dependency>
        <!-- Our test modules: We don't care about coverage information of the code. We want to use the coverage collected for other modules. -->
        <dependency>
            <groupId>com.mulesoft.connectivity</groupId>
            <artifactId>connectivity-mule-functional-tests</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>${jacoco.maven.plugin.version}</version>
            <scope>runtime</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>report-aggregate</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>report-aggregate</goal>
                        </goals>
                        <configuration>
                            <formats>
                                <format>XML</format>
                            </formats>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
