<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>net.shibboleth.metadata</groupId>
        <artifactId>mda-parent</artifactId>
        <version>1.0.1-SNAPSHOT</version>
    </parent>

    <name>Processing Framework</name>
    <description>Processing Framework</description>
    <artifactId>mda-framework</artifactId>
    <packaging>jar</packaging>

    <properties>
        <automatic.module.name>net.shibboleth.metadata</automatic.module.name>
        <checkstyle.configLocation>${project.basedir}/../resources/checkstyle/checkstyle.xml</checkstyle.configLocation>
    </properties>

    <dependencies>

        <!-- Compile Dependencies -->

        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcprov-jdk18on</artifactId>
        </dependency>
        <dependency>
            <groupId>org.cryptacular</groupId>
            <artifactId>cryptacular</artifactId>
        </dependency>

        <dependency>
            <groupId>net.shibboleth</groupId>
            <artifactId>shib-support</artifactId>
        </dependency>
        <dependency>
            <groupId>net.shibboleth</groupId>
            <artifactId>shib-networking</artifactId>
        </dependency>
        <dependency>
            <groupId>net.shibboleth</groupId>
            <artifactId>shib-security</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.santuario</groupId>
            <artifactId>xmlsec</artifactId>
        </dependency>
    	<dependency>
	       <groupId>org.springframework</groupId>
		   <artifactId>spring-core</artifactId>
        </dependency>

        <dependency>
            <groupId>${slf4j.groupId}</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>

        <!-- Provided Dependencies -->
        <dependency>
            <groupId>jakarta.json</groupId>
            <artifactId>jakarta.json-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Runtime Dependencies -->
        <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>jakarta.json</artifactId>
            <scope>runtime</scope>
        </dependency>

        <!-- Test Dependencies -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>mda-keylists-rsa</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>mda-keylists-rsa-legacy</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.shibboleth</groupId>
            <artifactId>shib-spring</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.shibboleth</groupId>
            <artifactId>shib-networking-spring</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.shibboleth</groupId>
            <artifactId>shib-security-spring</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jruby</groupId>
            <artifactId>jruby</artifactId>
            <version>9.2.13.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.python</groupId>
            <artifactId>jython-slim</artifactId>
            <version>2.7.2</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.bouncycastle</groupId>
                    <artifactId>bcpkix-jdk15on</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.bouncycastle</groupId>
                    <artifactId>bcprov-jdk15on</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${spring.groupId}</groupId>
            <artifactId>spring-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.xmlunit</groupId>
            <artifactId>xmlunit-core</artifactId>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <index>true</index>
                        <manifestEntries>
                            <Main-Class>net.shibboleth.metadata.Version</Main-Class>
                        </manifestEntries>
                        <manifestSections>
                            <manifestSection>
                                <name>net/shibboleth/metadata/</name>
                                <manifestEntries>
                                    <Implementation-Title>${project.artifactId}</Implementation-Title>
                                    <Implementation-Version>${project.version}</Implementation-Version>
                                    <Implementation-Vendor>shibboleth.net</Implementation-Vendor>
                                </manifestEntries>
                            </manifestSection>
                        </manifestSections>
                    </archive>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-check</id>
                        <!-- check goal is by default bound to verify phase -->
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <!-- We don't meet these constraints yet. -->
                            <haltOnFailure>false</haltOnFailure>
                            <rules>
                                <!-- Overall coverage rules. -->
                                <rule>
                                    <element>BUNDLE</element>
                                    <limits>
                                        <limit>
                                            <counter>INSTRUCTION</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>80%</minimum>
                                        </limit>
                                        <limit>
                                            <counter>CLASS</counter>
                                            <value>MISSEDCOUNT</value>
                                            <maximum>0</maximum>
                                        </limit>
                                    </limits>
                                </rule>
                                <!-- Package level coverage. -->
                                <rule>
                                    <element>PACKAGE</element>
                                    <limits>
                                        <limit>
                                            <counter>INSTRUCTION</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>80%</minimum>
                                        </limit>
                                        <limit>
                                            <counter>CLASS</counter>
                                            <value>MISSEDCOUNT</value>
                                            <maximum>0</maximum>
                                        </limit>
                                    </limits>
                                </rule>
                                <!-- Class level coverage. -->
                                <rule>
                                    <element>CLASS</element>
                                    <limits>
                                        <limit>
                                            <counter>METHOD</counter>
                                            <value>MISSEDCOUNT</value>
                                            <maximum>0</maximum>
                                        </limit>
                                    </limits>
                                </rule>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>

    <profiles>

        <!--
            Pull in a Javascript engine for testing in Java
            versions where the JDK doesn't provide one.
        -->
        <profile>
            <id>get-graal-nashorn</id>
            <activation>
                <jdk>[15,</jdk>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>org.openjdk.nashorn</groupId>
                    <artifactId>nashorn-core</artifactId>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>

    </profiles>

</project>
