<?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">
    <parent>
        <artifactId>apdu4j</artifactId>
        <groupId>com.github.martinpaljak</groupId>
        <version>26.04.20.1</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>apdu4j-tool</artifactId>

    <properties>
        <maven.javadoc.skip>true</maven.javadoc.skip>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.github.martinpaljak</groupId>
            <artifactId>apdu4j-pcsc</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.github.martinpaljak</groupId>
            <artifactId>apdu4j-apdulette</artifactId>
            <version>${project.version}</version>
        </dependency>
        <!-- cmdline -->
        <dependency>
            <groupId>info.picocli</groupId>
            <artifactId>picocli</artifactId>
            <version>4.7.7</version>
            <optional>true</optional>
        </dependency>
        <!-- FancyChooser terminal chooser -->
        <dependency>
            <groupId>com.googlecode.lanterna</groupId>
            <artifactId>lanterna</artifactId>
            <version>3.1.5</version>
            <optional>true</optional>
        </dependency>
        <!-- logging for cmdline -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <optional>true</optional>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>exe</id>
            <build>
                <plugins>
                    <!-- Package for Windows -->
                    <plugin>
                        <groupId>com.akathist.maven.plugins.launch4j</groupId>
                        <artifactId>launch4j-maven-plugin</artifactId>
                        <version>2.7.0</version>
                        <executions>
                            <execution>
                                <id>apdu4j-exe</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>launch4j</goal>
                                </goals>
                                <configuration>
                                    <headerType>console</headerType>
                                    <outfile>target/apdu4j.exe</outfile>
                                    <downloadUrl>https://adoptopenjdk.net</downloadUrl>
                                    <jar>target/apdu4j.jar</jar>
                                    <errTitle>apdu4j</errTitle>
                                    <classPath>
                                        <mainClass>apdu4j.tool.SCTool</mainClass>
                                    </classPath>
                                    <jre>
                                        <path>%JAVA_HOME%;%PATH%</path>
                                        <minVersion>21</minVersion>
                                    </jre>
                                    <versionInfo>
                                        <fileDescription>apdu4j</fileDescription>
                                        <copyright>(C) 2015 - 2026 Martin Paljak and contributors (LGPL+MIT)</copyright>
                                        <productName>apdu4j</productName>
                                        <internalName>apdu4j</internalName>
                                        <originalFilename>apdu4j.exe</originalFilename>
                                    </versionInfo>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <release>21</release>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.6.2</version>
                <executions>
                    <execution>
                        <id>default-shade</id>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <finalName>apdu4j</finalName>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                            <transformers>
                                <transformer
                                        implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>apdu4j.tool.SCTool</mainClass>
                                    <manifestEntries>
                                        <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/MANIFEST.MF</exclude>
                                        <exclude>META-INF/*.SF</exclude>
                                        <exclude>META-INF/*.DSA</exclude>
                                        <exclude>META-INF/*.RSA</exclude>
                                        <exclude>META-INF/maven/**</exclude>
                                        <exclude>**/module-info.class</exclude>
                                    </excludes>
                                </filter>
                            </filters>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
