<?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>io.github.glaforge.antigravity</groupId>
    <artifactId>antigravity-sdk-parent</artifactId>
    <version>0.1.1</version>
    <packaging>pom</packaging>

    <name>Antigravity Java SDK</name>
    <description>A Java SDK for building agents using the Antigravity localharness.</description>
    <url>https://github.com/glaforge/antigravity-java-sdk</url>

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

    <developers>
        <developer>
            <id>glaforge</id>
            <name>Guillaume Laforge</name>
            <email>glaforge@google.com</email>
        </developer>
    </developers>

    <modules>
        <module>antigravity-sdk-protocol</module>
        <module>antigravity-sdk-wrapper</module>
    </modules>

    <properties>
        <maven.compiler.source>21</maven.compiler.source>
        <maven.compiler.target>21</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <protobuf.version>3.25.3</protobuf.version>
        <jackson.version>2.17.1</jackson.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>2.43.0</version>
                <configuration>
                    <java>
                        <eclipse />
                        <licenseHeader>
                            <file>${maven.multiModuleProjectDirectory}/license-header.txt</file>
                        </licenseHeader>
                    </java>
                </configuration>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.13.0</version>
                    <configuration>
                        <parameters>true</parameters>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
    
    <dependencyManagement>
        <dependencies>
            <!-- Jackson Core -->
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-core</artifactId>
                <version>${jackson.version}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${jackson.version}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-annotations</artifactId>
                <version>${jackson.version}</version>
            </dependency>

            <!-- Google Protocol Buffers -->
            <dependency>
                <groupId>com.google.protobuf</groupId>
                <artifactId>protobuf-java</artifactId>
                <version>${protobuf.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.protobuf</groupId>
                <artifactId>protobuf-java-util</artifactId>
                <version>${protobuf.version}</version>
            </dependency>

            <!-- Internal modules -->
            <dependency>
                <groupId>io.github.glaforge.antigravity</groupId>
                <artifactId>antigravity-sdk-protocol</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.github.glaforge.antigravity</groupId>
                <artifactId>antigravity-sdk-wrapper</artifactId>
                <version>${project.version}</version>
            </dependency>

            <!-- MCP -->
            <dependency>
                <groupId>io.modelcontextprotocol.sdk</groupId>
                <artifactId>mcp</artifactId>
                <version>2.0.0-M3</version>
            </dependency>

            <!-- Testing -->
            <dependency>
                <groupId>org.awaitility</groupId>
                <artifactId>awaitility</artifactId>
                <version>4.3.0</version>
            </dependency>
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-api</artifactId>
                <version>6.1.0</version>
            </dependency>
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-engine</artifactId>
                <version>6.1.0</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <scm>
        <connection>scm:git:git://github.com/glaforge/antigravity-java-sdk.git</connection>
        <developerConnection>scm:git:git@github.com:glaforge/antigravity-java-sdk.git</developerConnection>
        <url>https://github.com/glaforge/antigravity-java-sdk</url>
        <tag>v0.1.1</tag>
    </scm>

    <profiles>
        <profile>
            <id>deployment</id>
            <properties>
                <altDeploymentRepository>local::file:./target/staging-deploy</altDeploymentRepository>
            </properties>
            <build>
                <defaultGoal>deploy</defaultGoal>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.5.0</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                                <configuration>
                                    <attach>true</attach>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.3.0</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                                <configuration>
                                    <attach>true</attach>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>publication</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jreleaser</groupId>
                        <artifactId>jreleaser-maven-plugin</artifactId>
                        <version>1.22.0</version>
                        <configuration>
                            <jreleaser>
                                <release>
                                    <github>
                                        <overwrite>true</overwrite>
                                        <changelog>
                                            <formatted>ALWAYS</formatted>
                                            <preset>conventional-commits</preset>
                                            <contributors>
                                                <format>- {{contributorName}}{{#contributorUsernameAsLink}} ({{.}}){{/contributorUsernameAsLink}}</format>
                                            </contributors>
                                        </changelog>
                                    </github>
                                </release>
                                <signing>
                                    <pgp>
                                        <active>ALWAYS</active>
                                        <armored>true</armored>
                                    </pgp>
                                </signing>
                                <deploy>
                                    <maven>
                                        <mavenCentral>
                                            <sonatype>
                                                <active>ALWAYS</active>
                                                <url>https://central.sonatype.com/api/v1/publisher</url>
                                                <stagingRepositories>target/staging-deploy</stagingRepositories>
                                            </sonatype>
                                        </mavenCentral>
                                    </maven>
                                </deploy>
                            </jreleaser>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-release-plugin</artifactId>
                        <version>3.3.1</version>
                        <configuration>
                            <preparationGoals>clean verify</preparationGoals>
                            <preparationProfiles>deployment,publication</preparationProfiles>
                            <tagNameFormat>v@{project.version}</tagNameFormat>
                            <goals>deploy</goals>
                            <arguments>-ntp -B -DskipTests</arguments>
                            <scmCommentPrefix>chore:</scmCommentPrefix>
                            <scmReleaseCommitComment>@{prefix} Releasing version @{releaseLabel}</scmReleaseCommitComment>
                            <scmDevelopmentCommitComment>@{prefix} Bump for next development cycle</scmDevelopmentCommitComment>
                            <scmShallowClone>false</scmShallowClone>
                            <releaseProfiles>deployment,publication</releaseProfiles>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
