<?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>net.unit8.199x</groupId>
    <artifactId>199x-notation</artifactId>
    <version>0.1.0</version>
    <packaging>jar</packaging>

    <name>199x-notation</name>
    <description>The rules for reading text that Raoh and Souther share</description>
    <url>https://github.com/raoh-project/199x-notation</url>

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

    <scm>
        <url>https://github.com/raoh-project/199x-notation</url>
        <connection>scm:git:git://github.com/raoh-project/199x-notation.git</connection>
        <developerConnection>scm:git:git@github.com:raoh-project/199x-notation.git</developerConnection>
        <tag>HEAD</tag>
    </scm>

    <developers>
        <developer>
            <id>kawasima</id>
            <name>Yoshitaka Kawashima</name>
            <email>kawasima1016@gmail.com</email>
        </developer>
    </developers>

    <properties>
        <maven.compiler.release>25</maven.compiler.release>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <jspecify.version>1.0.1</jspecify.version>
        <errorprone.version>2.50.0</errorprone.version>
        <nullaway.version>0.14.1</nullaway.version>
        <junit.version>6.1.3</junit.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>${junit.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

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

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.14.0</version>
                <executions>
                    <!--
                        The nullness the packages state (@NullMarked) is checked by NullAway on every
                        compile of the main sources, and nothing else of Error Prone is: the other checks
                        are a lint this build does not take on. The tests share the packages and are not
                        held to it. javac needs the exports in .mvn/jvm.config to load the plugin.
                    -->
                    <execution>
                        <id>default-compile</id>
                        <configuration>
                            <compilerArgs>
                                <arg>-XDcompilePolicy=simple</arg>
                                <arg>--should-stop=ifError=FLOW</arg>
                                <arg>-Xplugin:ErrorProne -XepDisableAllChecks -Xep:NullAway:ERROR -XepOpt:NullAway:OnlyNullMarked=true -XepOpt:NullAway:JSpecifyMode=true</arg>
                            </compilerArgs>
                            <annotationProcessorPaths>
                                <path>
                                    <groupId>com.google.errorprone</groupId>
                                    <artifactId>error_prone_core</artifactId>
                                    <version>${errorprone.version}</version>
                                </path>
                                <path>
                                    <groupId>com.uber.nullaway</groupId>
                                    <artifactId>nullaway</artifactId>
                                    <version>${nullaway.version}</version>
                                </path>
                            </annotationProcessorPaths>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.5.2</version>
            </plugin>
            <!--
                The Javadoc is held to doclint's every group, the missing tags included, and a
                warning fails it. It is built for a release and checked on every pull request
                (mvn javadoc:javadoc). javadoc stops counting at a hundred warnings by default, which
                hides how many there are, so the count is lifted.
            -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.11.2</version>
                <configuration>
                    <doclint>all</doclint>
                    <failOnWarnings>true</failOnWarnings>
                    <additionalOptions>
                        <additionalOption>-Xmaxwarns</additionalOption>
                        <additionalOption>100000</additionalOption>
                    </additionalOptions>
                </configuration>
            </plugin>
            <!--
                Deploys to the Central Portal. A -SNAPSHOT version goes to the snapshot repository,
                which takes it as it is. A release is uploaded as one deployment, and autoPublish
                publishes it once the Portal has validated it, with nobody pressing Publish there.
            -->
            <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>

    <profiles>
        <!--
            A release: what Central requires beside the jar (the sources, the Javadoc, and a
            signature of each), and only of a version that is one. A -SNAPSHOT version, or one that
            depends on a snapshot, stops here rather than being signed and published as if it
            were a release; snapshots are deployed without this profile.
        -->
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-enforcer-plugin</artifactId>
                        <version>3.5.0</version>
                        <executions>
                            <execution>
                                <id>a-release-is-a-release-version</id>
                                <goals>
                                    <goal>enforce</goal>
                                </goals>
                                <configuration>
                                    <rules>
                                        <requireReleaseVersion>
                                            <message>The release profile deploys a release, and ${project.version} is a snapshot. Set the version first; snapshots are deployed without -Prelease.</message>
                                        </requireReleaseVersion>
                                        <requireReleaseDeps>
                                            <message>A release depends on no snapshot.</message>
                                        </requireReleaseDeps>
                                    </rules>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <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>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.2.7</version>
                        <configuration>
                            <bestPractices>true</bestPractices>
                        </configuration>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
