<?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">
    <parent>
        <groupId>com.mulesoft.munit</groupId>
        <artifactId>munit-maven-tools</artifactId>
<!--        WARNING!! if you change this version you should change constant MUNIT_VERSION in ExtensionTestMojo too-->
        <version>3.5.0</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>munit-extensions-maven-plugin</artifactId>
    <version>1.6.0</version>
    <packaging>maven-plugin</packaging>

    <name>MUnit :: Extensions Maven Plugin</name>

    <properties>
        <licensePath>LICENSE_HEADER.txt</licensePath>
        <formatterConfigPath>formatter.xml</formatterConfigPath>
        <spotbugsExcludePath>findbugs-exclude.xml</spotbugsExcludePath>

        <coverageLineLimit>0.57</coverageLineLimit>
        <coverageBranchLimit>0.80</coverageBranchLimit>

        <mule.api.persistence.version>1.8.0-rc3</mule.api.persistence.version>
        <mule.api.version>1.8.0-rc3</mule.api.version>
        <!-- this version of jar handling is needed for keeping java 8/11 compatibility -->
        <mule.jar.handling.utils.version>4.8.0-rc3</mule.jar.handling.utils.version>

        <jacoco.maven.plugin.version>0.8.10</jacoco.maven.plugin.version>
        <jacoco.report.location>${session.executionRootDirectory}/target/site/jacoco-aggregate/jacoco.xml</jacoco.report.location>
        <skipTests>false</skipTests>
        <skipJaCoCoCoverage>${skipTests}</skipJaCoCoCoverage>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.maven.plugin.version}</version>
                <executions>
                    <execution>
                        <id>prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/site/jacoco-aggregate</outputDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>check</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <dataFile>${project.build.directory}/site/jacoco-aggregate/jacoco.exec</dataFile>
                            <rules>
                                <rule>
                                    <element>BUNDLE</element>
                                    <limits>
                                        <limit>
                                            <counter>LINE</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>${coverageLineLimit}</minimum>
                                        </limit>
                                        <limit>
                                            <counter>BRANCH</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>${coverageBranchLimit}</minimum>
                                        </limit>
                                    </limits>
                                </rule>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <destFile>${project.build.directory}/site/jacoco-aggregate/jacoco.exec</destFile>
                    <dataFile>${project.build.directory}/site/jacoco-aggregate/jacoco.exec</dataFile>
                    <outputDirectory>${project.build.directory}/site/jacoco-aggregate</outputDirectory>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-jar-handling-utils</artifactId>
            <version>${mule.jar.handling.utils.version}</version>
        </dependency>
        <dependency>
            <groupId>com.mulesoft.munit</groupId>
            <artifactId>munit-maven-plugins-common</artifactId>
            <version>${project.parent.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-extensions-api-persistence</artifactId>
            <version>${mule.api.persistence.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-api</artifactId>
            <version>${mule.api.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-core</artifactId>
            <scope>provided</scope>
        </dependency>
    </dependencies>

</project>
