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

    <groupId>dev.promptlm</groupId>
    <artifactId>promptlm-dependencies</artifactId>
    <version>0.1.0</version>
    <packaging>pom</packaging>

    <name>promptLM Dependencies</name>
    <description>
        Bill-of-materials for the promptLM platform release train. Pins
        Spring Boot, Spring AI, Spring Modulith, and other promptLM-wide
        dependency versions. Consumers import via &lt;scope&gt;import&lt;/scope&gt; or
        inherit transitively through promptlm-parent.
    </description>
    <url>https://github.com/promptLM/promptlm-platform</url>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>promptLM</name>
            <organization>promptLM</organization>
            <organizationUrl>https://github.com/promptLM</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:https://github.com/promptLM/promptlm-platform.git</connection>
        <developerConnection>scm:git:https://github.com/promptLM/promptlm-platform.git</developerConnection>
        <url>https://github.com/promptLM/promptlm-platform</url>
    </scm>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <spring-boot.version>4.0.6</spring-boot.version>
        <spring-ai.version>2.0.0-M5</spring-ai.version>
        <spring-modulith.version>2.0.6</spring-modulith.version>
        <swagger-annotations.version>2.2.50</swagger-annotations.version>
        <junit-gitea-artifactory.version>1.3.0</junit-gitea-artifactory.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- Spring Boot BOM: transitively pins Jackson 3, SLF4J, Logback, Jetty, etc. -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring-boot.version}</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
            <dependency>
                <groupId>org.springframework.ai</groupId>
                <artifactId>spring-ai-bom</artifactId>
                <version>${spring-ai.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>io.swagger.core.v3</groupId>
                <artifactId>swagger-annotations</artifactId>
                <version>${swagger-annotations.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.modulith</groupId>
                <artifactId>spring-modulith-starter-core</artifactId>
                <version>${spring-modulith.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.modulith</groupId>
                <artifactId>spring-modulith-runtime</artifactId>
                <version>${spring-modulith.version}</version>
                <scope>runtime</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework.modulith</groupId>
                <artifactId>spring-modulith-events-api</artifactId>
                <version>${spring-modulith.version}</version>
            </dependency>

            <!-- promptLM-owned test support: JUnit 5 fixtures for Gitea + Artifactory containers. -->
            <dependency>
                <groupId>dev.promptlm.test</groupId>
                <artifactId>junit-gitea-artifactory</artifactId>
                <version>${junit-gitea-artifactory.version}</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <profiles>
        <!--
            Maven Central release profile. Defined here (the inheritance root) so
            both this BOM and promptlm-parent are signed + published, and every
            downstream repo whose parent chain includes promptlm-dependencies
            inherits the same signing / publishing / reproducible-build policy.
            Activated with -Prelease in CI only.
        -->
        <profile>
            <id>release</id>
            <properties>
                <!-- Reproducible build: stamp artifacts with the commit time, not build time. -->
                <project.build.outputTimestamp>${git.commit.time}</project.build.outputTimestamp>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.github.git-commit-id</groupId>
                        <artifactId>git-commit-id-maven-plugin</artifactId>
                        <version>10.0.0</version>
                        <executions>
                            <execution>
                                <id>resolve-git-commit-time</id>
                                <phase>initialize</phase>
                                <goals>
                                    <goal>revision</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <!--
                                Default dateFormat uses Z (+0000); Reproducible Central
                                rejects it. XXX yields +00:00. UTC pins the zone.
                            -->
                            <dateFormat>yyyy-MM-dd'T'HH:mm:ssXXX</dateFormat>
                            <dateFormatTimeZone>UTC</dateFormatTimeZone>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.2.8</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <!--
                                        Default signer 'gpg' uses the local GnuPG keyring
                                        that actions/setup-java imports the key into. The
                                        'bc' signer needs MAVEN_GPG_KEY, which setup-java
                                        does not emit. loopback pinentry lets the headless
                                        runner read the passphrase non-interactively.
                                    -->
                                    <signer>gpg</signer>
                                    <gpgArguments>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>0.10.0</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                            <!-- Upload + validate only; the promote job publishes (irreversible). -->
                            <autoPublish>false</autoPublish>
                            <waitUntil>validated</waitUntil>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
