<?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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>net.shibboleth.idp.plugin.scripting</groupId>
        <artifactId>idp-plugin-scripting</artifactId>
        <version>1.1.0</version>
    </parent>
    
    <name>Shibboleth IdP :: Plugins :: Nashorn JDK Scripting Impl </name>
    <artifactId>idp-plugin-nashorn-jdk-impl</artifactId>
    <packaging>jar</packaging>
    
    <properties>
        <checkstyle.configLocation>${project.basedir}/../checkstyle.xml</checkstyle.configLocation>
        <automatic.module.name>net.shibboleth.idp.plugin.nashorn</automatic.module.name>
        <!-- Revise these two when JDK changes -->
        <asm.version>7.3.1</asm.version>
	<jdk.version>15.3</jdk.version>
    </properties>
    
    <description>
        A project to build a Nashorn ECMAScript plugin jar which uses the JDK provided engine.
    </description>

    <dependencies>
        <!-- All are provided or test -->

        <!--  Runtime - JDK & its dependencies -->

        <dependency>
	    <groupId>org.openjdk.nashorn</groupId>
	    <artifactId>nashorn-core</artifactId>
            <version>${jdk.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm</artifactId>
            <version>${asm.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm-tree</artifactId>
            <version>${asm.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm-analysis</artifactId>
            <version>${asm.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm-commons</artifactId>
            <version>${asm.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm-util</artifactId>
            <version>${asm.version}</version>
            <scope>runtime</scope>
        </dependency>

        <!--  Provided - IdP and its dependencies. -->

        <dependency>
            <groupId>net.shibboleth.idp.plugin.scripting</groupId>
            <artifactId>idp-plugin-scripting-api</artifactId>
            <version>1.1.0</version>
        </dependency>

        <dependency>
            <groupId>${slf4j.groupId}</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>net.shibboleth.idp</groupId>
            <artifactId>idp-admin-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>net.shibboleth.idp</groupId>
            <artifactId>idp-admin-impl</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>net.shibboleth.utilities</groupId>
            <artifactId>java-support</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>net.shibboleth.ext</groupId>
            <artifactId>spring-extensions</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${spring.groupId}</groupId>
            <artifactId>spring-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${spring.groupId}</groupId>
            <artifactId>spring-beans</artifactId>
            <scope>provided</scope>
        </dependency>

        <!--  TEST -->
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.target.directory}</outputDirectory>
                            <includeScope>runtime</includeScope>
                            <excludeTransitive>true</excludeTransitive> 
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId> 
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifestSections>
                            <manifestSection>
                                <name>net/shibboleth/idp/plugin/scripting/nashorn/jdk</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>
        </plugins>
    </build>
</project>
