<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.logicsquad</groupId>
  <artifactId>qr4j</artifactId>
  <version>1.1</version>
  <name>QR4J</name>
  <description>A Java-based QR code generator with a minimum of dependencies.</description>
  <url>https://github.com/logicsquad/qr4j</url>
  <inceptionYear>2023</inceptionYear>

  <organization>
    <name>Logic Squad</name>
    <url>https://logicsquad.net/</url>
  </organization>

  <licenses>
    <license>
      <name>2-Clause BSD License</name>
      <url>https://opensource.org/license/bsd-2-clause/</url>
      <distribution>repo</distribution>
      <comments>See LICENSE.txt in this project.</comments>
    </license>
  </licenses>

  <developers>
    <developer>
      <id>paulh</id>
      <name>Paul Hoadley</name>
      <email>paulh@logicsquad.net</email>
      <organization>Logic Squad</organization>
      <timezone>Australia/Adelaide</timezone>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:git://github.com/logicsquad/qr4j.git</connection>
    <developerConnection>scm:git:ssh://github.com:logicsquad/qr4j.git</developerConnection>
    <url>https://github.com/logicsquad/qr4j/tree/master</url>
  </scm>

  <properties>
    <main.class></main.class>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <pmd.version>6.20.0</pmd.version>
    <jacoco.version>0.8.13</jacoco.version>
    <spotbugs.version>4.10.3.0</spotbugs.version>
    <pitest.version>1.25.9</pitest.version>
    <pitest.junit5.version>1.2.3</pitest.junit5.version>
    <central-publishing-maven-plugin.version>0.11.0</central-publishing-maven-plugin.version>
    <maven-javadoc-plugin.version>3.11.2</maven-javadoc-plugin.version>
    <maven-source-plugin.version>3.3.1</maven-source-plugin.version>
    <maven-gpg-plugin.version>3.2.7</maven-gpg-plugin.version>
  </properties>

  <profiles>
    <profile>
      <id>disable-java8-doclint</id>
      <activation>
        <jdk>[1.8,)</jdk>
      </activation>
      <properties>
        <additionalparam>-Xdoclint:none</additionalparam>
      </properties>
    </profile>

    <!--
      Mutation testing, kept out of the default build because it takes about 90 seconds.
      Run with:

        mvn -Pmutation test-compile org.pitest:pitest-maven:mutationCoverage

      Report lands in target/pit-reports.

      READ THE HEADLINE NUMBER WITH CARE. QrCode.Template and ReedSolomonGenerator are
      cached in static Memoizers, so their constructors run only once per key for the whole
      suite. PIT attributes those lines to whichever few tests happened to trigger
      construction first and then runs only those against each mutant — three tests, where
      the rest of the codebase gets 15 to 68 — so almost everything there is recorded as
      surviving. It is an artefact of test selection, not a gap: apply one of those
      "survivors" by hand (say version * 4 -> version / 4 in the Template constructor) and
      91 tests fail. Judge those two classes by the golden master and round trip tests
      instead, and read the score for everything else.
    -->
    <profile>
      <id>mutation</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.pitest</groupId>
            <artifactId>pitest-maven</artifactId>
            <version>${pitest.version}</version>
            <dependencies>
              <dependency>
                <groupId>org.pitest</groupId>
                <artifactId>pitest-junit5-plugin</artifactId>
                <version>${pitest.junit5.version}</version>
              </dependency>
            </dependencies>
            <configuration>
              <targetClasses>
                <param>net.logicsquad.qr4j.*</param>
              </targetClasses>
              <!--
                Excluded as a mutation oracle: these tests are slow, and they sample thread
                interleavings rather than asserting a deterministic result, so they would
                make runs both lengthy and unrepeatable.
              -->
              <excludedTestClasses>
                <param>net.logicsquad.qr4j.QrCodeConcurrencyTest</param>
              </excludedTestClasses>
              <outputFormats>
                <param>HTML</param>
                <param>XML</param>
              </outputFormats>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>release</id>
      <activation>
        <property>
          <name>release</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-pmd-plugin</artifactId>
          <version>3.12.0</version>
          <dependencies>
            <dependency>
              <groupId>net.sourceforge.pmd</groupId>
              <artifactId>pmd-core</artifactId>
              <version>${pmd.version}</version>
            </dependency>
            <dependency>
              <groupId>net.sourceforge.pmd</groupId>
              <artifactId>pmd-java</artifactId>
              <version>${pmd.version}</version>
            </dependency>
            <dependency>
              <groupId>net.sourceforge.pmd</groupId>
              <artifactId>pmd-javascript</artifactId>
              <version>${pmd.version}</version>
            </dependency>
            <dependency>
              <groupId>net.sourceforge.pmd</groupId>
              <artifactId>pmd-jsp</artifactId>
              <version>${pmd.version}</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>4.0.0-M8</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-project-info-reports-plugin</artifactId>
          <version>3.4.5</version>
        </plugin>
	<plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>${maven-gpg-plugin.version}</version>
          <configuration>
            <gpgArguments>
              <arg>--batch</arg>
              <arg>--yes</arg>
              <arg>--pinentry-mode</arg>
              <arg>loopback</arg>
            </gpgArguments>
          </configuration>
          <executions>
            <execution>
              <id>sign-artifacts</id>
              <phase>verify</phase>
              <goals>
		<goal>sign</goal>
              </goals>
            </execution>
          </executions>
	</plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.0.0</version>
        <configuration>
          <workingDirectory>${project.build.directory}/test-run</workingDirectory>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${jacoco.version}</version>
        <executions>
          <execution>
            <id>prepare-agent</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>report</id>
            <phase>test</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.sonatype.central</groupId>
        <artifactId>central-publishing-maven-plugin</artifactId>
        <version>${central-publishing-maven-plugin.version}</version>
        <extensions>true</extensions>
        <configuration>
          <publishingServerId>central</publishingServerId>
          <autoPublish>true</autoPublish>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>${maven-source-plugin.version}</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>${maven-javadoc-plugin.version}</version>
        <configuration>
          <detectLinks />
          <detectJavaApiLinks />
        </configuration>
        <executions>
          <execution>
            <id>build-javadocs</id>
            <phase>package</phase>
            <goals>
              <goal>javadoc</goal>
            </goals>
          </execution>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>2.9</version>
        <configuration>
          <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jxr-plugin</artifactId>
        <version>3.0.0</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
        <version>3.12.0</version>
        <configuration>
          <linkXref>true</linkXref>
          <sourceEncoding>utf-8</sourceEncoding>
          <minimumTokens>100</minimumTokens>
          <targetJdk>1.8</targetJdk>
          <skipEmptyReport>false</skipEmptyReport>
          <rulesets>
            <!-- Path-style, region-specific URL: the virtual-host form does not work over
                 HTTPS, because the dotted bucket name does not match S3's wildcard cert. -->
            <ruleset>https://s3.ap-southeast-2.amazonaws.com/artefacts.logicsquad.net/logicsquad_pmd.xml</ruleset>
          </rulesets>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>3.2.1</version>
        <configuration>
          <!-- See the note on the PMD ruleset URL above. -->
          <configLocation>https://s3.ap-southeast-2.amazonaws.com/artefacts.logicsquad.net/logicsquad_checks.xml</configLocation>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-maven-plugin</artifactId>
        <version>${spotbugs.version}</version>
        <configuration>
          <effort>Max</effort>
          <threshold>Low</threshold>
          <maxHeap>2048</maxHeap>
          <excludeFilterFile>${project.basedir}/src/config/spotbugs-exclude.xml</excludeFilterFile>
        </configuration>
      </plugin>
      <!-- Note when reading this report: instruction and line coverage are dominated by
           ReedSolomonGenerator's precomputed lookup tables, which are ~300 lines of array
           literals covered in full by a single loop. Branch coverage and the per-class
           breakdown are the meaningful numbers. -->
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${jacoco.version}</version>
        <reportSets>
          <reportSet>
            <reports>
              <report>report</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
    </plugins>
  </reporting>

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

  <dependencies>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <scope>test</scope>
    </dependency>
    <!-- Test scope only: used as an independent oracle to decode the QR codes we
         generate. Never appears on a consumer's classpath. -->
    <dependency>
      <groupId>com.google.zxing</groupId>
      <artifactId>core</artifactId>
      <version>3.5.3</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>
