<?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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.github.martinpaljak</groupId>
        <artifactId>gppro</artifactId>
        <version>26.04.20</version>
    </parent>
    <artifactId>gptool</artifactId>
    <name>GlobalPlatformPro CLI tool</name>
    <dependencies>
        <!-- For PC/SC reader access -->
        <dependency>
            <groupId>com.github.martinpaljak</groupId>
            <artifactId>apdu4j-pcsc</artifactId>
        </dependency>
        <!-- Library itself -->
        <dependency>
            <groupId>com.github.martinpaljak</groupId>
            <artifactId>globalplatformpro</artifactId>
            <version>${project.version}</version>
        </dependency>
        <!-- For PACE auth -->
        <dependency>
            <groupId>com.github.martinpaljak</groupId>
            <artifactId>pace</artifactId>
            <version>${project.version}</version>
        </dependency>
        <!-- apdu4j-apdulette moved to nextgen module -->
        <!-- For logging in the command line tool -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <optional>true</optional>
        </dependency>
        <!-- For command line parsing -->
        <dependency>
            <groupId>net.sf.jopt-simple</groupId>
            <artifactId>jopt-simple</artifactId>
            <version>5.0.4</version>
        </dependency>
        <!-- For tests  -->
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <scope>test</scope>
        </dependency>
        <!-- for CBOR -->
        <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-cbor</artifactId>
            <version>2.21.2</version>
        </dependency>
    </dependencies>
    <profiles>
        <profile>
            <id>jdk21</id>
            <activation>
                <jdk>[21,)</jdk>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>com.github.martinpaljak</groupId>
                    <artifactId>gptool-nextgen</artifactId>
                    <version>${project.version}</version>
                    <optional>true</optional>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>exe</id>
            <build>
                <plugins>
                    <!-- Parse and mangle version for Windows, to have no leading '0' -->
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <version>3.6.1</version>
                        <executions>
                            <execution>
                                <id>windows-file-version</id>
                                <goals>
                                    <goal>parse-version</goal>
                                </goals>
                                <configuration>
                                    <propertyPrefix>windowsVersion</propertyPrefix>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <!-- Package for Windows -->
                    <plugin>
                        <groupId>com.akathist.maven.plugins.launch4j</groupId>
                        <artifactId>launch4j-maven-plugin</artifactId>
                        <version>2.7.0</version>
                        <executions>
                            <execution>
                                <id>gp-exe</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>launch4j</goal>
                                </goals>
                                <configuration>
                                    <headerType>console</headerType>
                                    <outfile>target/gp.exe</outfile>
                                    <jar>target/gp.jar</jar>
                                    <errTitle>GlobalPlatformPro</errTitle>
                                    <classPath>
                                        <mainClass>pro.javacard.gptool.GPTool</mainClass>
                                    </classPath>
                                    <jre>
                                        <path>./</path>
                                        <minVersion>11</minVersion>
                                    </jre>
                                    <versionInfo>
                                        <fileDescription>GlobalPlatformPro</fileDescription>
                                        <copyright>(C) 2015 - 2026 Martin Paljak and contributors (LGPL+MIT)</copyright>
                                        <productName>GlobalPlatformPro</productName>
                                        <internalName>gppro</internalName>
                                        <originalFilename>gp.exe</originalFilename>
                                    </versionInfo>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.6.2</version>
                <executions>
                    <execution>
                        <id>gp-jar</id>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                            <finalName>gp</finalName>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>pro.javacard.gptool.GPTool</mainClass>
                                    <manifestEntries>
                                        <Multi-Release>true</Multi-Release>
                                        <Implementation-Version>${project.version}</Implementation-Version>
                                    </manifestEntries>
                                </transformer>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer"/>
                            </transformers>
                            <filters>
                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>META-INF/*.SF</exclude>
                                        <exclude>META-INF/*.DSA</exclude>
                                        <exclude>META-INF/*.RSA</exclude>
                                        <exclude>META-INF/maven/**</exclude>
                                        <exclude>META-INF/MANIFEST.MF</exclude>
                                        <exclude>META-INF/LICENSE</exclude>
                                        <exclude>META-INF/NOTICE</exclude>
                                        <exclude>META-INF/**/OSGI-INF/**</exclude>
                                        <exclude>**/module-info.class</exclude>
                                    </excludes>
                                </filter>
                            </filters>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
