<?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.micro-manager</groupId>
  <artifactId>MM-OME-BigTiff-Storage</artifactId>
  <version>0.1.0</version>
  <packaging>jar</packaging>

  <name>MM-OME-BigTiff-Storage</name>
  <description>High-performance streaming pyramidal OME-BigTIFF writer and reader with
    multiscale (SubIFD) pyramid support and concurrent read-while-write. Modeled on
    MM-OME-Zarr-Storage / NDTiffStorage; no dependency on Micro-Manager.</description>
  <url>https://github.com/micro-manager/MM-OME-BigTiff-Storage</url>

  <licenses>
    <license>
      <name>BSD 3-Clause License</name>
      <url>https://opensource.org/licenses/BSD-3-Clause</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <developers>
    <developer>
      <id>nicost</id>
      <name>Nico Stuurman</name>
      <url>https://github.com/nicost</url>
      <organization>Micro-Manager</organization>
      <organizationUrl>https://micro-manager.org</organizationUrl>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:https://github.com/micro-manager/MM-OME-BigTiff-Storage.git</connection>
    <developerConnection>scm:git:ssh://git@github.com/micro-manager/MM-OME-BigTiff-Storage.git</developerConnection>
    <url>https://github.com/micro-manager/MM-OME-BigTiff-Storage</url>
    <tag>HEAD</tag>
  </scm>

  <properties>
    <!-- Target Java 8 so the jar is usable from the Micro-Manager build (which is Java 8).
         source/target (rather than release) so the project also builds under a JDK 8 toolchain.
         The source uses no Java 9+ APIs, and the only dependency (jackson) is Java 8 bytecode. -->
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <junit.version>5.10.2</junit.version>
    <jackson.version>2.17.1</jackson.version>
  </properties>

  <dependencies>

    <!-- JSON (de)serialization for per-image metadata sidecars and summary/custom metadata. -->
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>${jackson.version}</version>
    </dependency>

    <!-- Testing -->
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.11.0</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.2.5</version>
      </plugin>

      <!-- Maven Central requires a sources jar alongside the main artifact. -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>3.3.1</version>
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals><goal>jar-no-fork</goal></goals>
          </execution>
        </executions>
      </plugin>

      <!-- Maven Central requires a javadoc jar alongside the main artifact.
           doclint is disabled: Central only requires that a javadoc jar is
           attached, not that every method has complete @param/@return tags.
           Without this, the strict doclint fails the build on missing tags. -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>3.6.3</version>
        <configuration>
          <doclint>none</doclint>
        </configuration>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals><goal>jar</goal></goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <!--
    Release profile: signs every artifact with GPG and publishes to the Sonatype
    Central Portal. Activate with `mvn -Prelease deploy`. Kept in a profile so
    ordinary `mvn package` / `mvn install` builds don't require a GPG key.
  -->
  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <!-- Sign all artifacts (jar, sources, javadoc, pom) with GPG. -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>3.2.4</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals><goal>sign</goal></goals>
                <configuration>
                  <!-- Non-interactive signing for CI: read the passphrase from the
                       gpg.passphrase property (supplied via -D or the GITHUB env) and
                       use loopback pinentry so gpg never tries to prompt on a tty.
                       Harmless for local interactive signing via the gpg-agent. -->
                  <gpgArguments>
                    <arg>--pinentry-mode</arg>
                    <arg>loopback</arg>
                  </gpgArguments>
                </configuration>
              </execution>
            </executions>
          </plugin>

          <!-- Upload the signed bundle to the Sonatype Central Portal. -->
          <plugin>
            <groupId>org.sonatype.central</groupId>
            <artifactId>central-publishing-maven-plugin</artifactId>
            <version>0.5.0</version>
            <extensions>true</extensions>
            <configuration>
              <publishingServerId>central</publishingServerId>
              <!-- Leave manual: review and release from the Portal UI.
                   Set to true to auto-publish once validation passes. -->
              <autoPublish>false</autoPublish>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
