<?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>org.pragmatica-lite.aether</groupId>
        <artifactId>aether</artifactId>
        <version>1.0.0-rc1</version>
    </parent>

    <artifactId>cli</artifactId>
    <name>Aether CLI</name>
    <description>Command-line interface for Aether cluster management</description>

    <dependencies>
        <dependency>
            <groupId>info.picocli</groupId>
            <artifactId>picocli</artifactId>
        </dependency>

        <dependency>
            <groupId>org.pragmatica-lite</groupId>
            <artifactId>http-client</artifactId>
        </dependency>

        <dependency>
            <groupId>org.pragmatica-lite</groupId>
            <artifactId>jackson</artifactId>
        </dependency>

        <dependency>
            <groupId>org.pragmatica-lite.aether</groupId>
            <artifactId>aether-config</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>org.pragmatica-lite.aether</groupId>
            <artifactId>aether-management-api</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>org.pragmatica-lite.aether</groupId>
            <artifactId>environment-integration</artifactId>
            <version>${project.version}</version>
        </dependency>

        <!-- Cloud + container provider integrations.
             SPI-loaded via META-INF/services/org.pragmatica.aether.environment.EnvironmentIntegrationFactory.
             Required so `aether cluster bootstrap` against cloud-* configs can resolve providers. -->
        <dependency>
            <groupId>org.pragmatica-lite.aether</groupId>
            <artifactId>environment-docker</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>org.pragmatica-lite.aether</groupId>
            <artifactId>environment-hetzner</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>org.pragmatica-lite.aether</groupId>
            <artifactId>environment-aws</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>org.pragmatica-lite.aether</groupId>
            <artifactId>environment-gcp</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>org.pragmatica-lite.aether</groupId>
            <artifactId>environment-azure</artifactId>
            <version>${project.version}</version>
        </dependency>

        <!-- Suppress SLF4J "no provider" warnings at runtime -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-nop</artifactId>
            <version>${slf4j.version}</version>
            <scope>runtime</scope>
        </dependency>

        <!-- Testing -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <properties>
        <maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss'Z'</maven.build.timestamp.format>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.5.0</version>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>org.pragmatica.aether.cli.AetherCli</mainClass>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                        <manifestEntries>
                            <Implementation-Build-Date>${maven.build.timestamp}</Implementation-Build-Date>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.6.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>org.pragmatica.aether.cli.AetherCli</mainClass>
                                    <manifestEntries>
                                        <Implementation-Version>${project.version}</Implementation-Version>
                                        <Implementation-Build-Date>${maven.build.timestamp}</Implementation-Build-Date>
                                    </manifestEntries>
                                </transformer>
                                <!-- Concatenate META-INF/services/* across all shaded jars so SPI-loaded
                                     EnvironmentIntegrationFactory implementations (docker/hetzner/aws/gcp/azure)
                                     all register at runtime. Without this, only the last-shaded jar's service
                                     file survives and the others are silently dropped. -->
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                            </transformers>
                            <filters>
                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>META-INF/*.SF</exclude>
                                        <exclude>META-INF/*.DSA</exclude>
                                        <exclude>META-INF/*.RSA</exclude>
                                    </excludes>
                                </filter>
                            </filters>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                            <finalName>aether</finalName>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
