<?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>dev.snowdrop.mtool</groupId>
        <artifactId>migration-tool-parent</artifactId>
        <version>1.0.2</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>migration-cli</artifactId>
    <description>Quarkus CLI tool to migrate Java applications</description>
    <name>Migration Tool :: Client</name>
    <inceptionYear>2025</inceptionYear>
    <url>https://github.com/snowdrop/migration-tool</url>

    <properties>
        <jreleaser.version>1.21.0</jreleaser.version>
        <maven-assembly-plugin.version>3.8.0</maven-assembly-plugin.version>
        <os-maven-plugin.version>1.7.1</os-maven-plugin.version>
        <distribution.directory>${project.build.directory}/distributions</distribution.directory>
        <executable-suffix />

        <quarkus.package.type>uber-jar</quarkus.package.type>
    </properties>

    <dependencies>
        <dependency>
            <groupId>dev.snowdrop.mtool</groupId>
            <artifactId>model</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>dev.snowdrop.mtool</groupId>
            <artifactId>parser</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>dev.snowdrop.mtool</groupId>
            <artifactId>scanner</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>dev.snowdrop.mtool</groupId>
            <artifactId>openrewrite-recipes</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-picocli</artifactId>
        </dependency>

        <!-- CSV parsing -->
        <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-csv</artifactId>
        </dependency>

        <!-- ASCII Table for better table formatting -->
        <dependency>
            <groupId>com.github.freva</groupId>
            <artifactId>ascii-table</artifactId>
        </dependency>

        <!-- AI -->
        <dependency>
            <groupId>io.quarkiverse.langchain4j</groupId>
            <artifactId>quarkus-langchain4j-anthropic</artifactId>
            <version>1.4.2</version>
        </dependency>

        <!-- lsp4j -->
        <dependency>
            <groupId>org.eclipse.lsp4j</groupId>
            <artifactId>org.eclipse.lsp4j</artifactId>
        </dependency>
    </dependencies>

    <build>
        <extensions>
            <extension>
                <groupId>kr.motd.maven</groupId>
                <artifactId>os-maven-plugin</artifactId>
                <version>${os-maven-plugin.version}</version>
            </extension>
        </extensions>
    </build>

    <profiles>
        <profile>
            <id>native</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jreleaser</groupId>
                        <artifactId>jreleaser-maven-plugin</artifactId>
                        <version>${jreleaser.version}</version>
                        <configuration>
                            <jreleaser>
                                <release>
                                    <github>
                                        <changelog>
                                            <formatted>ALWAYS</formatted>
                                            <preset>conventional-commits</preset>
                                        </changelog>
                                    </github>
                                </release>
                                <distributions>
                                    <migration-cli>
                                        <name>migration-cli</name>
                                        <type>BINARY</type>
                                        <brew>
                                            <active>RELEASE</active>
                                            <multiPlatform>true</multiPlatform>
                                        </brew>
                                        <sdkman>
                                            <active>RELEASE</active>
                                        </sdkman>
                                        <artifacts>
                                            <artifact>
                                                <path>
                                                    {{artifactsDir}}/{{distributionName}}-{{projectVersion}}-linux-x86_64.tar.gz
                                                </path>
                                                <transform>
                                                    artifacts/{{distributionName}}-{{projectEffectiveVersion}}-linux-x86_64.tar.gz
                                                </transform>
                                                <platform>linux-x86_64</platform>
                                            </artifact>
                                            <!--<artifact>
                                                <path>
                                                    {{artifactsDir}}/{{distributionName}}-{{projectVersion}}-windows-x86_64.zip
                                                </path>
                                                <transform>
                                                    artifacts/{{distributionName}}-{{projectEffectiveVersion}}-windows-x86_64.zip
                                                </transform>
                                                <platform>windows-x86_64</platform>
                                            </artifact>-->
                                            <artifact>
                                                <path>
                                                    {{artifactsDir}}/{{distributionName}}-{{projectVersion}}-osx-x86_64.tar.gz
                                                </path>
                                                <transform>
                                                    artifacts/{{distributionName}}-{{projectEffectiveVersion}}-osx-x86_64.tar.gz
                                                </transform>
                                                <platform>osx-x86_64</platform>
                                            </artifact>
                                            <artifact>
                                                <path>
                                                    {{artifactsDir}}/{{distributionName}}-{{projectVersion}}-osx-aarch_64.tar.gz
                                                </path>
                                                <transform>
                                                    artifacts/{{distributionName}}-{{projectEffectiveVersion}}-osx-aarch_64.tar.gz
                                                </transform>
                                                <platform>osx-aarch_64</platform>
                                            </artifact>
                                        </artifacts>
                                    </migration-cli>
                                </distributions>
                            </jreleaser>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>dist</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>${maven-assembly-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>make-distribution</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <attach>false</attach>
                            <appendAssemblyId>false</appendAssemblyId>
                            <finalName>${project.artifactId}-${project.version}-${os.detected.classifier}</finalName>
                            <outputDirectory>${distribution.directory}</outputDirectory>
                            <workDirectory>${project.build.directory}/assembly/work</workDirectory>
                            <descriptors>
                                <descriptor>src/main/assembly/assembly.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>dist-windows</id>
            <activation>
                <os>
                    <family>windows</family>
                </os>
            </activation>
            <properties>
                <executable-suffix>.exe</executable-suffix>
            </properties>
        </profile>
    </profiles>

</project>