<?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>de.hft.stuttgart</groupId>
        <artifactId>CityDoctorParent</artifactId>
        <version>3.16.0</version>
        <relativePath>../../pom.xml</relativePath>
    </parent>
    <artifactId>CityDoctorZipLoader</artifactId>
    <name>CityDoctorZipLoader</name>
    <description>ZipLoader enables the loading and parsing of zip archives</description>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.2.0</version>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>de.hft.stuttgart</groupId>
            <artifactId>CityDoctorModel</artifactId>
        </dependency>
        <dependency>
            <groupId>de.hft.stuttgart</groupId>
            <artifactId>CityDoctorValidation</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j18-impl</artifactId>
        </dependency>
        <dependency>
            <groupId>de.hft.stuttgart</groupId>
            <artifactId>CityDoctorGUI</artifactId>
        </dependency>
    </dependencies>
    <profiles>
        <profile>
            <id>create-binaries</id>
            <properties>
                <win-jre>jre-${jre-version-short}</win-jre>
                <lin-jre>${win-jre}</lin-jre>
                <mac-jre>${win-jre}.jre</mac-jre>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.googlecode.maven-download-plugin</groupId>
                        <artifactId>download-maven-plugin</artifactId>
                        <version>1.7.0</version>
                        <executions>
                            <execution>
                                <id>downloadWindowsJre</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>wget</goal>
                                </goals>
                                <configuration>
                                    <uri>https://download.bell-sw.com/java/${jre-version}/bellsoft-jre${jre-version}-windows-amd64.zip</uri>
                                    <unpack>false</unpack>
                                    <outputDirectory>${project.build.directory}/jre/jre-win</outputDirectory>
                                    <outputFileName>win-runtime.zip</outputFileName>
                                </configuration>
                            </execution>
                            <execution>
                                <id>downloadLinuxJre</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>wget</goal>
                                </goals>
                                <configuration>
                                    <uri>https://download.bell-sw.com/java/${jre-version}/bellsoft-jre${jre-version}-linux-amd64.tar.gz</uri>
                                    <unpack>false</unpack>
                                    <outputDirectory>${project.build.directory}/jre/jre-lin</outputDirectory>
                                    <outputFileName>lin-runtime.tar.gz</outputFileName>
                                </configuration>
                            </execution>
                            <execution>
                                <id>downloadMacJre</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>wget</goal>
                                </goals>
                                <configuration>
                                    <uri>https://download.bell-sw.com/java/${jre-version}/bellsoft-jre${jre-version}-macos-amd64.zip</uri>
                                    <unpack>false</unpack>
                                    <outputDirectory>${project.build.directory}/jre/jre-mac</outputDirectory>
                                    <outputFileName>mac-runtime.zip</outputFileName>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>3.1.0</version>
                        <executions>
                            <execution>
                                <id>unpack</id>
                                <phase>install</phase>
                                <configuration>
                                    <target name="unpack">
                                        <untar src="${project.build.directory}/jre/jre-lin/lin-runtime.tar.gz" dest="${project.build.directory}/jre/jre-lin/runtime" compression="gzip"></untar>
                                        <unzip src="${project.build.directory}/jre/jre-win/win-runtime.zip" dest="${project.build.directory}/jre/jre-win/runtime"></unzip>
                                        <unzip src="${project.build.directory}/jre/jre-mac/mac-runtime.zip" dest="${project.build.directory}/jre/jre-mac/runtime"></unzip>
                                    </target>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <configuration>
                            <appendAssemblyId>false</appendAssemblyId>
                        </configuration>
                        <executions>
                            <execution>
                                <id>create-archive-no-runtime</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <finalName>${project.artifactId}-${project.version}-no-runtime</finalName>
                                    <descriptors>
                                        <descriptor>${project.basedir}/src/assembly/no_runtime/assembly.xml</descriptor>
                                    </descriptors>
                                </configuration>
                            </execution>
                            <execution>
                                <id>create-archive-win</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <finalName>${project.artifactId}-${project.version}-win</finalName>
                                    <descriptors>
                                        <descriptor>${project.basedir}/src/assembly/win/assembly.xml</descriptor>
                                    </descriptors>
                                </configuration>
                            </execution>
                            <execution>
                                <id>create-archive-lin</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <finalName>${project.artifactId}-${project.version}-lin</finalName>
                                    <descriptors>
                                        <descriptor>${project.basedir}/src/assembly/lin/assembly.xml</descriptor>
                                    </descriptors>
                                </configuration>
                            </execution>
                            <execution>
                                <id>create-archive-mac</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <finalName>${project.artifactId}-${project.version}-mac</finalName>
                                    <descriptors>
                                        <descriptor>${project.basedir}/src/assembly/mac/assembly.xml</descriptor>
                                    </descriptors>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>