<?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>org.scip-code</groupId>
  <artifactId>scip-java-bindings</artifactId>
  <version>0.8.0</version>
  <packaging>jar</packaging>

  <name>scip-java-bindings</name>
  <description>
    Generated Java bindings for the Semantic Code Intelligence Protocol (SCIP).
  </description>
  <url>https://github.com/scip-code/scip</url>

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

  <developers>
    <developer>
      <name>SCIP Maintainers</name>
      <organization>scip-code</organization>
      <organizationUrl>https://github.com/scip-code</organizationUrl>
    </developer>
  </developers>

  <scm>
    <url>https://github.com/scip-code/scip</url>
    <connection>scm:git:https://github.com/scip-code/scip.git</connection>
    <developerConnection>scm:git:git@github.com:scip-code/scip.git</developerConnection>
  </scm>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
    <!--
      Must match the protoc version used for code generation (see flake.nix).
      Protobuf 4 generated code calls validateProtobufGencodeVersion() at
      class load: the runtime version must be >= the gencode version within
      the same major version. Consumers who pull a newer protobuf-java
      transitively are fine; consumers who downgrade to <4.34.2 will crash.
    -->
    <protobuf.version>4.34.2</protobuf.version>
    <project.build.outputTimestamp>${git.commit.time}</project.build.outputTimestamp>
  </properties>

  <dependencies>
    <dependency>
      <groupId>com.google.protobuf</groupId>
      <artifactId>protobuf-java</artifactId>
      <version>${protobuf.version}</version>
    </dependency>
    <!-- Optional: pulls Guava transitively. Re-declare without <optional> to use JsonFormat etc. -->
    <dependency>
      <groupId>com.google.protobuf</groupId>
      <artifactId>protobuf-java-util</artifactId>
      <version>${protobuf.version}</version>
      <optional>true</optional>
    </dependency>
  </dependencies>

  <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>get-git-properties</id>
            <phase>initialize</phase>
            <goals><goal>revision</goal></goals>
          </execution>
        </executions>
        <configuration>
          <dateFormat>yyyy-MM-dd'T'HH:mm:ssXXX</dateFormat>
          <dateFormatTimeZone>UTC</dateFormatTimeZone>
          <generateGitPropertiesFile>false</generateGitPropertiesFile>
          <verbose>false</verbose>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>3.4.0</version>
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals><goal>jar-no-fork</goal></goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>3.12.0</version>
        <configuration>
          <!-- Generated protobuf code is noisy; don't fail the build on it. -->
          <doclint>none</doclint>
          <quiet>true</quiet>
          <failOnError>false</failOnError>
        </configuration>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals><goal>jar</goal></goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <!--
      The `release` profile adds GPG signing and the Sonatype Central
      publishing plugin. Day-to-day `mvn install` (used by the PR check
      and by scip-kotlin-bindings to resolve this artifact locally) stays
      fast and does not need GPG keys configured.

      Activate from the release workflow with `mvn -Prelease deploy`.
    -->
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <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>
                  <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>
              <autoPublish>true</autoPublish>
              <waitUntil>published</waitUntil>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
