<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2018 Johannes Donath <johannesd@torchmind.com>
  ~ and other copyright owners as documented in the project's IP log.
  ~
  ~ 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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <!-- Artifact Information -->
  <groupId>org.basinmc.plunger</groupId>
  <artifactId>parent</artifactId>
  <version>3.0</version>
  <packaging>pom</packaging>

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

  <!-- Artifact Metadata -->
  <name>Plunger</name>
  <description>A generic bytecode and sourcecode transformation library.</description>
  <url>https://github.com/BasinMC/Plunger</url>
  <inceptionYear>2018</inceptionYear>

  <organization>
    <name>Basin</name>
    <url>https://www.basinmc.org</url>
  </organization>

  <developers>
    <developer>
      <name>Johannes Donath</name>
      <email>johannesd@torchmind.com</email>
      <url>https://www.johannes-donath.com</url>

      <organization>Basin</organization>
      <organizationUrl>https://www.basinmc.org</organizationUrl>
    </developer>
  </developers>

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

  <scm>
    <url>https://github.com/BasinMC/Plunger</url>
    <connection>https://github.com/BasinMC/Plunger.git</connection>
    <developerConnection>git@github.com:BasinMC/Plunger.git</developerConnection>
  </scm>

  <issueManagement>
    <system>GitHub</system>
    <url>https://github.com/BasinMC/Plunger/issues</url>
  </issueManagement>

  <distributionManagement>
    <snapshotRepository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
    <repository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>

  <!-- Dependencies -->
  <dependencyManagement>
    <dependencies>
      <!-- Modules -->
      <dependency>
        <groupId>org.basinmc.plunger</groupId>
        <artifactId>bytecode</artifactId>
        <version>3.0</version>
      </dependency>
      <dependency>
        <groupId>org.basinmc.plunger</groupId>
        <artifactId>common</artifactId>
        <version>3.0</version>
      </dependency>
      <dependency>
        <groupId>org.basinmc.plunger</groupId>
        <artifactId>testing-harness</artifactId>
        <version>3.0</version>
        <scope>test</scope>
      </dependency>

      <!-- Bytecode -->
      <dependency>
        <groupId>org.ow2.asm</groupId>
        <artifactId>asm</artifactId>
        <version>6.1-beta2</version>
      </dependency>
      <dependency>
        <groupId>org.ow2.asm</groupId>
        <artifactId>asm-commons</artifactId>
        <version>6.1-beta2</version>
      </dependency>

      <!-- Sourcecode -->
      <dependency>
        <groupId>com.google.googlejavaformat</groupId>
        <artifactId>google-java-format</artifactId>
        <version>1.5</version>
      </dependency>
      <dependency>
        <groupId>org.jboss.forge.roaster</groupId>
        <artifactId>roaster-jdt</artifactId>
        <version>2.20.1.Final</version>
      </dependency>

      <!-- Common -->
      <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-collections4</artifactId>
        <version>4.1</version>
      </dependency>
      <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-csv</artifactId>
        <version>1.5</version>
      </dependency>
      <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.9.4</version>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.25</version>
      </dependency>
      <dependency>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-annotations</artifactId>
        <version>3.1.1</version>
        <scope>provided</scope>

        <exclusions>
          <exclusion>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
          </exclusion>
        </exclusions>
      </dependency>

      <!-- Testing -->
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>2.15.0</version>
        <scope>test</scope>
      </dependency>

      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.7.25</version>
        <scope>test</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <!-- Build Settings -->
  <build>
    <finalName>${project.groupId}.${project.artifactId}-${project.version}</finalName>
    <defaultGoal>clean install</defaultGoal>

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <version>3.0.0</version>

          <configuration>
            <configLocation>google_checks.xml</configLocation>
            <encoding>UTF-8</encoding>
            <consoleOutput>true</consoleOutput>
            <failsOnError>true</failsOnError>

            <excludes>**/module-info.java</excludes>
          </configuration>

          <executions>
            <execution>
              <id>validate</id>
              <phase>validate</phase>

              <goals>
                <goal>check</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.7.0</version>

          <configuration>
            <source>1.8</source>
            <target>1.8</target>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.0.2</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.0.0</version>

          <executions>
            <execution>
              <id>attach-javadocs</id>

              <goals>
                <goal>jar</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>3.0.1</version>

          <executions>
            <execution>
              <id>attach-sources</id>

              <goals>
                <goal>jar-no-fork</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <modules>
    <module>bytecode</module>
    <module>common</module>
    <module>sourcecode</module>

    <module>mapping-csv</module>
    <module>mapping-mcp</module>

    <module>testing-harness</module>
  </modules>

  <profiles>
    <profile>
      <id>deployment</id>

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.6</version>

            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>

                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
