<!--                   __                _      _   ________               -->
<!--                  / /   ____  ____ _(_)____/ | / / ____/               -->
<!--                 / /   / __ \/ __ `/ / ___/  |/ / / __                 -->
<!--                / /___/ /_/ / /_/ / / /__/ /|  / /_/ /                 -->
<!--               /_____/\____/\__, /_/\___/_/ |_/\____/                  -->
<!--                           /____/                                      -->
<!--                                                                       -->
<!--               The Next Generation Logic Library                       -->
<!--                                                                       -->
<!--  Copyright 2015-2023 Christoph Zengler                                -->
<!--  Copyright 2023-20xx BooleWorks GmbH                                  -->
<!--                                                                       -->
<!--  Licensed under the Apache License, Version 2.0 (the "License");      -->
<!--  you may not use this file except in compliance with the License.     -->
<!--  You may obtain a copy of the License at                              -->
<!--                                                                       -->
<!--  http://www.apache.org/licenses/LICENSE-2.0                           -->
<!--                                                                       -->
<!--  Unless required by applicable law or agreed to in writing, software  -->
<!--  distributed under the License is distributed on an "AS IS" BASIS,    -->
<!--  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or      -->
<!--  implied.  See the License for the specific language governing        -->
<!--  permissions and limitations under the License.                       -->

<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.logicng</groupId>
  <artifactId>logicng-serialization</artifactId>
  <version>2.6.0</version>
  <packaging>bundle</packaging>

  <name>LogicNG Serialization</name>
  <description>LogicNG Protocol Buffer Serialization Framework</description>
  <url>https://www.logicng.org</url>

  <licenses>
    <license>
      <name>Apache-2.0</name>
      <url>https://spdx.org/licenses/Apache-2.0.html</url>
    </license>
    <license>
      <name>MIT</name>
      <url>https://spdx.org/licenses/MIT.html</url>
    </license>
  </licenses>

  <developers>
    <developer>
      <id>BooleWorks</id>
      <name>BooleWorks Team</name>
      <organization>BooleWorks GmbH</organization>
      <organizationUrl>https://www.booleworks.com</organizationUrl>
      <email>info@booleworks.com</email>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:git://github.com:logic-ng/logicng-serialization.git</connection>
    <developerConnection>scm:git:ssh://github.com:logic-ng/logicng-serialization.git</developerConnection>
    <url>https://github.com/logic-ng/logicng-serialization</url>
  </scm>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>

    <!-- Dependency Versions -->
    <version.protobuf>4.27.1</version.protobuf>
    <version.junit>5.10.2</version.junit>
    <version.assertj>3.26.3</version.assertj>

    <!-- Plugin Versions -->
    <version.maven-helper-plugin>3.6.0</version.maven-helper-plugin>
    <version.jacoco>0.8.12</version.jacoco>
    <version.surefire>3.3.1</version.surefire>
    <version.nexus-staging>1.6.8</version.nexus-staging>
    <version.maven-gpg>1.6</version.maven-gpg>
    <version.osgi-plugin>5.1.9</version.osgi-plugin>
    <version.maven-compiler>3.12.1</version.maven-compiler>
    <version.maven-source>3.3.0</version.maven-source>
    <version.maven-javadoc>3.8.0</version.maven-javadoc>
    <version.maven-jar>3.3.0</version.maven-jar>
  </properties>

  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>${version.maven-helper-plugin}</version>
        <executions>
          <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>src/main/generated/java</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- Store POM version in application manifest and set Jigsaw module name-->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>${version.maven-jar}</version>
        <configuration>
          <skipIfEmpty>true</skipIfEmpty>
          <archive>
            <manifest>
              <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
              <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
            </manifest>
            <manifestEntries>
              <Built-By>BooleWorks GmbH</Built-By>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>

      <!-- Compile jar with sources -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>${version.maven-source}</version>
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- Compile jar with javadocs -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>${version.maven-javadoc}</version>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- JaCoCo (Test Coverage)  -->
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${version.jacoco}</version>
        <executions>
          <execution>
            <id>default-prepare-agent</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>default-report</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
          <execution>
            <id>default-check</id>
            <goals>
              <goal>check</goal>
            </goals>
            <configuration>
              <rules>
                <rule>
                  <element>BUNDLE</element>
                </rule>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- Support for OSGi -->
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>${version.osgi-plugin}</version>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Bundle-RequiredExecutionEnvironment>JavaSE-11</Bundle-RequiredExecutionEnvironment>
          </instructions>
        </configuration>
      </plugin>

      <!-- Necessary for Wercker toolchain -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${version.surefire}</version>
        <configuration>
          <useSystemClassLoader>false</useSystemClassLoader>
          <trimStackTrace>false</trimStackTrace>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <!-- LogicNG Core -->
    <dependency>
      <groupId>org.logicng</groupId>
      <artifactId>logicng</artifactId>
      <version>${project.version}</version>
    </dependency>

    <!-- Protocol Buffers -->
    <dependency>
      <groupId>com.google.protobuf</groupId>
      <artifactId>protobuf-java</artifactId>
      <version>${version.protobuf}</version>
    </dependency>

    <!-- Testing -->
    <dependency>
      <groupId>org.logicng</groupId>
      <artifactId>logicng-parser-j8</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>

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

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

    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <version>${version.assertj}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <pluginRepositories>
    <pluginRepository>
      <id>sonatype-nexus-snapshot</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </pluginRepository>
  </pluginRepositories>

  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <!-- Deploy to Maven Central -->
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>${version.nexus-staging}</version>
            <extensions>true</extensions>
            <configuration>
              <serverId>ossrh</serverId>
              <nexusUrl>https://oss.sonatype.org/</nexusUrl>
              <autoReleaseAfterClose>false</autoReleaseAfterClose>
            </configuration>
          </plugin>

          <!-- Sign components -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>${version.maven-gpg}</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
