<?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>se.digg.cose</groupId>
  <artifactId>cose-lib</artifactId>
  <version>2.0.0</version>

  <name>se.digg.cose:cose-lib</name>
  <description>A Java implementation that supports the COSE secure message specification.</description>
  <url>https://github.com/diggsweden/cose-lib</url>

  <organization>
    <name>Digg Sweden</name>
    <url>https://www.digg.se</url>
  </organization>

  <licenses>
    <license>
      <name>BSD-3-Clause</name>
      <url>https://raw.githubusercontent.com/diggsweden/cose-lib/refs/heads/main/LICENSE</url>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>Stefan Santesson</name>
      <email>stefan@aaa-sec.com</email>
      <organizationUrl>https://idsec.se</organizationUrl>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:https://github.com/diggsweden/cose-lib.git</connection>
    <developerConnection>scm:git:git@github.com:diggsweden/cose-lib.git</developerConnection>
    <url>https://github.com/diggsweden/cose-lib</url>
  </scm>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>21</java.version>
    <maven.compiler.source>${java.version}</maven.compiler.source>
    <maven.compiler.target>${java.version}</maven.compiler.target>
    <maven.compiler.release>${java.version}</maven.compiler.release>

    <!-- Dependency versions -->
    <junit.version>4.13.2</junit.version>
    <bouncycastle.version>1.80</bouncycastle.version>
    <cbor.version>5.0.0-alpha2</cbor.version>
    <eddsa.version>0.3.0</eddsa.version>

    <!-- Plugin versions -->
    <maven.compiler.plugin.version>3.13.0</maven.compiler.plugin.version>
    <maven-deploy-plugin.version>3.1.3</maven-deploy-plugin.version>
    <maven.source.plugin.version>3.3.1</maven.source.plugin.version>
    <maven.compiler.plugin.version>3.14.0</maven.compiler.plugin.version>
    <maven.javadoc.plugin.version>3.11.2</maven.javadoc.plugin.version>
    <maven.gpg.plugin.version>3.2.7</maven.gpg.plugin.version>
    <maven.enforcer.plugin.version>3.5.0</maven.enforcer.plugin.version>
    <jacoco.plugin.version>0.8.12</jacoco.plugin.version>
    <jreleaser-maven-plugin.version>1.17.0</jreleaser-maven-plugin.version>
    <formatter-maven-plugin.version>2.25.0</formatter-maven-plugin.version>
    <maven-checkstyle-plugin.version>3.6.0</maven-checkstyle-plugin.version>
    <checkstyle.version>10.21.4</checkstyle.version>
  </properties>

  <dependencies>
    <!-- Test Dependencies -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>

    <!-- Crypto Dependencies -->
    <dependency>
      <groupId>org.bouncycastle</groupId>
      <artifactId>bcprov-jdk18on</artifactId>
      <version>${bouncycastle.version}</version>
    </dependency>
    <dependency>
      <groupId>org.bouncycastle</groupId>
      <artifactId>bcpkix-jdk18on</artifactId>
      <version>${bouncycastle.version}</version>
    </dependency>

    <!-- Other Dependencies -->
    <dependency>
      <groupId>com.upokecenter</groupId>
      <artifactId>cbor</artifactId>
      <version>${cbor.version}</version>
    </dependency>
    <dependency>
      <groupId>net.i2p.crypto</groupId>
      <artifactId>eddsa</artifactId>
      <version>${eddsa.version}</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <!-- Code Quality -->
      <plugin>
        <groupId>net.revelc.code.formatter</groupId>
        <artifactId>formatter-maven-plugin</artifactId>
        <version>${formatter-maven-plugin.version}</version>
        <configuration>
          <configFile>${project.basedir}/development/format/eclipse-java-google-style.xml</configFile>
          <lineEnding>LF</lineEnding>
          <compilerSource>${java.version}</compilerSource>
          <compilerCompliance>${java.version}</compilerCompliance>
          <compilerTargetPlatform>${java.version}</compilerTargetPlatform>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>format</goal>
            </goals>
            <phase>verify</phase>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>${maven-checkstyle-plugin.version}</version>
        <dependencies>
          <dependency>
            <groupId>com.puppycrawl.tools</groupId>
            <artifactId>checkstyle</artifactId>
            <version>${checkstyle.version}</version>
          </dependency>
        </dependencies>
        <configuration>
          <configLocation>${project.basedir}/development/lint/google_checks.xml</configLocation>
          <consoleOutput>true</consoleOutput>
          <failsOnError>true</failsOnError>
          <linkXRef>false</linkXRef>
        </configuration>
        <executions>
          <execution>
            <id>validate</id>
            <phase>validate</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- Enforcer -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>${maven.enforcer.plugin.version}</version>
        <executions>
          <execution>
            <id>enforce-rules</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireMavenVersion>
                  <version>[3.8.0,)</version>
                </requireMavenVersion>
                <requireJavaVersion>
                  <version>[21,)</version>
                </requireJavaVersion>
                <dependencyConvergence/>
                <requireUpperBoundDeps/>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>


      <!-- Compiler -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${maven.compiler.plugin.version}</version>
      </plugin>

      <!-- Coverage -->
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${jacoco.plugin.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>report</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
      </plugin>


      <!-- Deployment -->
      <plugin>
        <groupId>org.sonatype.central</groupId>
        <artifactId>central-publishing-maven-plugin</artifactId>
        <version>0.7.0</version>
        <extensions>true</extensions>
        <configuration>
          <checksums>all</checksums>
          <skipPublishing>false</skipPublishing>
          <publishingServerId>central</publishingServerId>
        </configuration>
      </plugin>

      <!-- Release -->
      <plugin>
        <groupId>org.jreleaser</groupId>
        <artifactId>jreleaser-maven-plugin</artifactId>
        <version>${jreleaser-maven-plugin.version}</version>
        <configuration>
          <configFile>${project.basedir}/jreleaser.yml</configFile>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>central-release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>${maven.gpg.plugin.version}</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <!-- Sources -->
          <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>
          <!-- Documentation -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>${maven.javadoc.plugin.version}</version>
            <configuration>
              <source>${java.version}</source>
              <bottom>COSE for Java documentation, generated in {currentYear}.</bottom>
            </configuration>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
