<?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>

    <groupId>cn.octopusyan</groupId>
    <artifactId>dmt</artifactId>
    <version>0.1.2</version>
    <name>DayzModTranslator</name>

    <organization>
        <name>octopus_yan</name>
        <url>octopus_yan@foxmail.com</url>
    </organization>

    <inceptionYear>2024</inceptionYear>
    <description>DayZ/ArmA 模组汉化工具</description>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <maven.compiler.source>21</maven.compiler.source>
        <maven.compiler.target>21</maven.compiler.target>
        <java.version>21</java.version>

        <exec.mainClass>cn.octopusyan.dmt.AppLauncher</exec.mainClass>
        <cssSrcPath>${project.basedir}/src/main/resources/css</cssSrcPath>
        <cssTargetPath>${project.basedir}/target/classes/css</cssTargetPath>

        <junit.version>5.11.0</junit.version>
        <javafx.version>21.0.4</javafx.version>
        <slf4j.version>2.0.16</slf4j.version>
        <logback.version>1.5.7</logback.version>
        <fastjson.version>2.0.52</fastjson.version>
        <common-lang3.version>3.16.0</common-lang3.version>
        <common-io.version>2.17.0</common-io.version>
        <common-exec.version>1.4.0</common-exec.version>
        <lombok.version>1.18.32</lombok.version>
        <jackson.version>2.15.4</jackson.version>
        <ikonli.version>12.3.1</ikonli.version>
    </properties>

    <dependencies>
        <!-- javafx -->
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>${javafx.version}</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-fxml</artifactId>
            <version>${javafx.version}</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-swing</artifactId>
            <version>${javafx.version}</version>
        </dependency>

        <!-- https://mkpaz.github.io/atlantafx/ -->
        <dependency>
            <groupId>io.github.mkpaz</groupId>
            <artifactId>atlantafx-base</artifactId>
            <version>2.0.1</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <version>${logback.version}</version>
        </dependency>

        <!-- junit -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- common -->
        <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>${common-lang3.version}</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>${common-io.version}</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-exec -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-exec</artifactId>
            <version>${common-exec.version}</version>
        </dependency>

        <!-- lombok -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>${lombok.version}</version>
        </dependency>

        <!-- jackson -->
        <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-yaml</artifactId>
            <version>${jackson.version}</version>
        </dependency>

        <!-- https://kordamp.org/ikonli/ -->
        <dependency>
            <groupId>org.kordamp.ikonli</groupId>
            <artifactId>ikonli-javafx</artifactId>
        </dependency>
        <dependency>
            <groupId>org.kordamp.ikonli</groupId>
            <artifactId>ikonli-fontawesome-pack</artifactId>
        </dependency>
        <dependency>
            <groupId>org.kordamp.ikonli</groupId>
            <artifactId>ikonli-feather-pack</artifactId>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.kordamp.ikonli</groupId>
                <artifactId>ikonli-bom</artifactId>
                <version>${ikonli.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <pluginRepositories>
        <pluginRepository>
            <id>nexus</id>
            <name>nexus-snapshot-repository</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
            <releases>
                <enabled>false</enabled>
            </releases>
        </pluginRepository>
    </pluginRepositories>

    <profiles>
        <profile>
            <id>dev</id>
            <properties>
                <debug.option>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005</debug.option>
            </properties>
            <build>
                <resources>
                    <resource>
                        <directory>src/main/resources</directory>
                        <filtering>true</filtering>
                    </resource>
                </resources>
            </build>
        </profile>
        <profile>
            <id>build</id>
            <properties>
                <debug.option/>
            </properties>
            <build>
                <resources>
                    <resource>
                        <directory>src/main/resources</directory>
                        <filtering>true</filtering>
                        <excludes>
                            <exclude>bin/</exclude>
                        </excludes>
                    </resource>
                </resources>
            </build>
        </profile>
    </profiles>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.13.0</version>
                <configuration>
                    <source>21</source>
                    <target>21</target>
                    <compilerArgs>--enable-preview</compilerArgs>
                    <encoding>UTF-8</encoding>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                            <version>${lombok.version}</version>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.3.1</version>
                <configuration>
                    <nonFilteredFileExtensions>
                        <nonFilteredFileExtension>exe</nonFilteredFileExtension>
                        <nonFilteredFileExtension>dll</nonFilteredFileExtension>
                    </nonFilteredFileExtensions>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <version>0.0.8</version>
                <configuration>
                    <stripDebug>true</stripDebug>
                    <compress>2</compress>
                    <noHeaderFiles>true</noHeaderFiles>
                    <noManPages>true</noManPages>
                    <launcher>launcher</launcher>
                    <jlinkImageName>app</jlinkImageName>
                    <jlinkZipName>app</jlinkZipName>
                    <mainClass>cn.octopusyan.dmt/${exec.mainClass}</mainClass>
                </configuration>
                <executions>
                    <execution>
                        <!-- Default configuration for running with: mvn clean javafx:run -->
                        <id>default-cli</id>
                        <configuration>
                            <options>
                                <option>--enable-preview</option>
                                <option>${debug.option}</option>
                            </options>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>io.github.fvarrui</groupId>
                <artifactId>javapackager</artifactId>
                <version>1.7.7-SNAPSHOT</version>
                <configuration>
                    <mainClass>${exec.mainClass}</mainClass>
                    <bundleJre>true</bundleJre>
                    <generateInstaller>false</generateInstaller>
                    <copyDependencies>true</copyDependencies>
                    <vmArgs>
                        <arg>--enable-preview</arg>
                        <arg>-Xmx100m</arg>
                    </vmArgs>
                </configuration>
                <executions>
                    <execution>
                        <id>windows</id>
                        <phase>package</phase>
                        <goals>
                            <goal>package</goal>
                        </goals>
                        <configuration>
                            <platform>windows</platform>
                            <zipballName>${project.name}-windows</zipballName>
                            <createZipball>true</createZipball>
                            <winConfig>
                                <headerType>gui</headerType>
                                <generateMsi>false</generateMsi>
                            </winConfig>
                            <additionalResources>
                                <additionalResource>${project.basedir}/src/main/resources/bin</additionalResource>
                            </additionalResources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>windows-nojre</id>
                        <phase>package</phase>
                        <goals>
                            <goal>package</goal>
                        </goals>
                        <configuration>
                            <zipballName>${project.name}-windows-nojre</zipballName>
                            <platform>windows</platform>
                            <createZipball>true</createZipball>
                            <bundleJre>false</bundleJre>
                            <winConfig>
                                <headerType>gui</headerType>
                                <generateMsi>false</generateMsi>
                            </winConfig>
                            <additionalResources>
                                <additionalResource>${project.basedir}/src/main/resources/bin</additionalResource>
                            </additionalResources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>