<?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>Distribution Packages</name>
    <description>Distribution Packages</description>
    <artifactId>mda-distribution</artifactId>
    <packaging>pom</packaging>

    <properties>
        <mda.finalName>mda-distribution-${project.version}</mda.finalName>
        <dependenciesDirectory>${project.build.directory}/dependencies</dependenciesDirectory>
    </properties>

    <dependencies>
        <!-- Compile Dependencies -->

        <!-- Provided Dependencies -->

        <!-- Runtime Dependencies -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>mda-cli</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>mda-keylists-rsa</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>mda-keylists-rsa-legacy</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>net.shibboleth</groupId>
            <artifactId>shib-networking-spring</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>net.shibboleth</groupId>
            <artifactId>shib-spring</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>net.shibboleth</groupId>
            <artifactId>shib-security-spring</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>${httpclient.groupId}</groupId>
            <artifactId>${httpclient.artifactId}</artifactId>
            <scope>runtime</scope>
        </dependency>

        <!-- Test Dependencies -->

    </dependencies>

    <build>
        <plugins>

            <!-- Copy the executable's dependencies into a directory. -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${dependenciesDirectory}</outputDirectory>
                            <includeScope>runtime</includeScope>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
		    <overrideUid>1000</overrideUid>
		    <overrideGid>1000</overrideGid>
                    <tarLongFileMode>gnu</tarLongFileMode>
                    <ignoreMissingDescriptor>false</ignoreMissingDescriptor>
                    <appendAssemblyId>false</appendAssemblyId>
                    <descriptors>
                        <descriptor>src/main/assembly/assembly-tgz.xml</descriptor>
                        <descriptor>src/main/assembly/assembly-zip.xml</descriptor>
                    </descriptors>
                </configuration>
            </plugin>

            <!-- Run the artifact signature enforcer on the generated artifacts. -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <dependencies>
                    <dependency>
                        <groupId>net.shibboleth.maven.enforcer.rules</groupId>
                        <artifactId>maven-dist-enforcer</artifactId>
                        <version>${maven-dist-enforcer.version}</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>mda-enforce-signatures-zip</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <jarEnforcer implementation="net.shibboleth.mvn.enforcer.impl.JarEnforcer">
                                    <dataGroupId>net.shibboleth.maven.enforcer.rules</dataGroupId>
                                    <dataArtifactId>maven-dist-enforcer-data</dataArtifactId>
                                    <dataVersion>${maven-dist-enforcer-data.version}</dataVersion>
                                    <dataKeyRing>${basedir}/src/main/enforcer/shibbolethKeys.gpg</dataKeyRing>
                                    <parentPomDir>${basedir}/..</parentPomDir>
                                    <zipFiles>${project.build.directory}/${mda.finalName}.zip</zipFiles>
                                    <checkSignatures>true</checkSignatures>
                                    <sigCheckReportPath>${project.build.directory}/sigReport-zip.txt</sigCheckReportPath>
                                    <checkDependencies>true</checkDependencies>
                                    <depCheckReportPath>${project.build.directory}/depReport-zip.txt</depCheckReportPath>
                                    <listJarSources>false</listJarSources>
                                    <checkM2>false</checkM2>
                                </jarEnforcer>
                            </rules>
                        </configuration>
                    </execution>
                    <execution>
                        <id>mda-enforce-signatures-tgz</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <jarEnforcer implementation="net.shibboleth.mvn.enforcer.impl.JarEnforcer">
                                    <dataGroupId>net.shibboleth.maven.enforcer.rules</dataGroupId>
                                    <dataArtifactId>maven-dist-enforcer-data</dataArtifactId>
                                    <dataVersion>${maven-dist-enforcer-data.version}</dataVersion>
                                    <dataKeyRing>${basedir}/src/main/enforcer/shibbolethKeys.gpg</dataKeyRing>
                                    <parentPomDir>${basedir}/..</parentPomDir>
                                    <tgzFiles>${project.build.directory}/${mda.finalName}.tar.gz</tgzFiles>
                                    <checkSignatures>true</checkSignatures>
                                    <sigCheckReportPath>${project.build.directory}/sigReport-tgz.txt</sigCheckReportPath>
                                    <checkDependencies>true</checkDependencies>
                                    <depCheckReportPath>${project.build.directory}/depReport-tgz.txt</depCheckReportPath>
                                    <listJarSources>false</listJarSources>
                                    <checkM2>false</checkM2>
                                </jarEnforcer>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>

</project>
