<?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.0.0</version>
    </parent>
    
    <name>Shibboleth IdP :: Plugins :: Nashorn Scripting Impl</name>
    <artifactId>idp-plugin-nashorn-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 Graal changes -->
        <asm.version>7.1</asm.version>
        <icu4j.version>64.2</icu4j.version>
    </properties>
    
    <description>
        A project to build a Nashorn ECMAScript plugin jar.
    </description>

    <dependencies>
        <!-- All dependencies except the api, GraalVM and it's dependencies are provided or test -->

        <!--  Compiled - GraalVM -->
        <dependency>
            <groupId>org.graalvm.sdk</groupId>
            <artifactId>graal-sdk</artifactId>
            <scope>compile</scope>
            <version>${graalvm.version}</version>
        </dependency>
        <dependency>
            <groupId>org.graalvm.js</groupId>
            <artifactId>js</artifactId>
            <version>${graalvm.version}</version>
            <scope>compile</scope>
        </dependency>
        
        <!--  Runtime - GraalVM dependencies -->

        <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>
        <dependency>
            <groupId>com.ibm.icu</groupId>
            <artifactId>icu4j</artifactId>
            <version>${icu4j.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.0.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 -->

        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <scope>test</scope>
        </dependency>        
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>test</scope>
        </dependency>

    </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>
                        <manifestEntries>
                            <Automatic-Module-Name>${automatic.module.name}</Automatic-Module-Name>
                        </manifestEntries>
                        <manifestSections>
                            <manifestSection>
                                <name>net/shibboleth/idp/plugin/scripting/nashorn/</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>
