<?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>com.github.susom</groupId>
  <artifactId>vertx-parent</artifactId>
  <version>1.1</version>
  <packaging>pom</packaging>

  <!-- These are here because Sonatype requires them for release to Maven Central,
       but we don't want our (parent pom) values. -->
  <name>${project.groupId}:${project.artifactId}</name>
  <description>To be provided by child pom.</description>
  <url>https://github.com/susom/vertx-parent</url>

  <licenses>
    <license>
      <name>To be provided by child pom.</name>
      <url>https://example.com/to-be-provided-by-child-pom</url>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>To be provided by child pom.</name>
      <email>to-be-provided-by-child-pom@example.com</email>
    </developer>
  </developers>

  <scm>
    <url>https://github.com/susom/vertx-parent</url>
  </scm>

  <properties>
    <vertx.version>3.3.3</vertx.version>
    <checkerframework.version>2.1.8</checkerframework.version>
    <errorprone.version>2.0.13</errorprone.version>

    <maven.compiler.target>1.8</maven.compiler.target>
    <annotatedJdk>${org.checkerframework:jdk8:jar}</annotatedJdk>
    <forbiddenapis.parent.txt>target/parent-files/forbidden-apis-parent.txt</forbiddenapis.parent.txt>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  </properties>

  <dependencies>
    <dependency>
      <!-- This is used to get files into the child project so plugins can
           reference them (for example configuration files for source code
           static analysis) -->
      <groupId>com.github.susom</groupId>
      <artifactId>vertx-parent-files</artifactId>
      <version>1.1</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.github.susom</groupId>
      <artifactId>vertx-base</artifactId>
      <version>1.0</version>
    </dependency>
    <dependency>
      <groupId>com.github.susom</groupId>
      <artifactId>database-goodies</artifactId>
      <version>1.0</version>
    </dependency>
    <dependency>
      <groupId>com.github.susom</groupId>
      <artifactId>server-logging</artifactId>
      <version>1.0</version>
    </dependency>
    <dependency>
      <groupId>org.checkerframework</groupId>
      <artifactId>checker-qual</artifactId>
      <version>${checkerframework.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.checkerframework</groupId>
      <artifactId>checker</artifactId>
      <version>${checkerframework.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.checkerframework</groupId>
      <artifactId>jdk8</artifactId>
      <version>${checkerframework.version}</version>
      <scope>provided</scope>
    </dependency>
    <!-- TODO vertx-base embeds some Spring stuff that needs JCL -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jcl-over-slf4j</artifactId>
      <version>1.7.14</version>
      <scope>runtime</scope>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-unit</artifactId>
      <version>${vertx.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.5.1</version>
          <configuration>
            <source>8</source>
            <target>8</target>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-shade-plugin</artifactId>
          <version>2.4.1</version>
          <executions>
            <execution>
              <phase>package</phase>
              <goals>
                <goal>shade</goal>
              </goals>
              <configuration>
                <filters>
                  <filter>
                    <artifact>*:*</artifact>
                    <excludes>
                      <exclude>META-INF/*.SF</exclude>
                      <exclude>META-INF/*.DSA</exclude>
                      <exclude>META-INF/*.RSA</exclude>
                    </excludes>
                  </filter>
                </filters>
                <transformers>
                  <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                  <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                    <mainClass>${main.class}</mainClass>
                  </transformer>
                </transformers>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.19.1</version>
          <configuration>
            <redirectTestOutputToFile>true</redirectTestOutputToFile>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>2.19</version>
          <executions>
            <execution>
              <goals>
                <goal>integration-test</goal>
                <goal>verify</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <redirectTestOutputToFile>true</redirectTestOutputToFile>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>2.5</version>
          <configuration>
            <!-- To avoid overlapping classes warnings from shade plugin -->
            <forceCreation>true</forceCreation>
          </configuration>
          <executions>
            <execution>
              <id>default-jar</id>
              <goals>
                <goal>jar</goal>
              </goals>
              <phase>package</phase>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>2.6</version>
          <executions>
            <execution>
              <id>make-assembly</id>
              <phase>package</phase>
              <goals>
                <goal>single</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <finalName>deploy</finalName>
            <appendAssemblyId>false</appendAssemblyId>
            <descriptors>
              <descriptor>target/parent-files/deploy-zip.xml</descriptor>
            </descriptors>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>2.2.1</version>
          <executions>
            <execution>
              <id>attach-sources</id>
              <goals>
                <goal>jar-no-fork</goal>
              </goals>
              <configuration>
                <includes>
                  <include>**/*</include>
                </includes>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>2.9.1</version>
          <executions>
            <execution>
              <id>attach-javadocs</id>
              <goals>
                <goal>jar</goal>
              </goals>
              <configuration>
                <additionalparam>-Xdoclint:none</additionalparam>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <profiles>
    <profile>
      <id>hsql</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <dependencies>
        <dependency>
          <groupId>org.hsqldb</groupId>
          <artifactId>hsqldb</artifactId>
          <version>2.3.4</version>
          <scope>runtime</scope>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <configuration>
              <includes>
                <include>**/*DaoTest</include>
                <include>**/*DbTest</include>
                <include>**/*HsqlTest</include>
              </includes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>postgres</id>
      <dependencies>
        <dependency>
          <groupId>org.postgresql</groupId>
          <artifactId>postgresql</artifactId>
          <version>9.4-1201-jdbc41</version>
          <scope>runtime</scope>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <configuration>
              <includes>
                <include>**/*DaoTest</include>
                <include>**/*DbTest</include>
                <include>**/*PostgresTest</include>
              </includes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>oracle</id>
      <dependencies>
        <dependency>
          <groupId>com.oracle</groupId>
          <artifactId>ojdbc7</artifactId>
          <version>12.1.0.2</version>
          <scope>runtime</scope>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <configuration>
              <includes>
                <include>**/*DaoTest</include>
                <include>**/*DbTest</include>
                <include>**/*OracleTest</include>
              </includes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>check-errorprone</id>
      <!-- Error Prone is a static analysis tool for checking Java code. For more
           information see http://errorprone.info/ and https://github.com/google/error-prone -->
      <activation>
        <property>
          <!-- We use two sets of checking profiles because errorprone and the checker framework conflict -->
          <name>check1</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.5.1</version>
            <configuration>
              <source>8</source>
              <target>8</target>
              <compilerId>javac-with-errorprone</compilerId>
              <forceJavacCompilerUse>true</forceJavacCompilerUse>
            </configuration>
            <dependencies>
              <dependency>
                <groupId>org.codehaus.plexus</groupId>
                <artifactId>plexus-compiler-javac-errorprone</artifactId>
                <version>2.5</version>
              </dependency>
              <dependency>
                <groupId>com.google.errorprone</groupId>
                <artifactId>error_prone_core</artifactId>
                <version>${errorprone.version}</version>
              </dependency>
            </dependencies>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>check-macker</id>
      <!-- Macker enforces architectural constraints (static Java code dependencies)
           for more information see https://innig.net/macker/ and
           https://github.com/andrena/macker-maven-plugin -->
      <activation>
        <property>
          <name>check1</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>de.andrena.tools.macker</groupId>
            <artifactId>macker-maven-plugin</artifactId>
            <version>1.0.2</version>
            <configuration>
              <rule>src/tool/macker-rules.xml</rule>
            </configuration>
            <executions>
              <execution>
                <phase>compile</phase>
                <goals>
                  <goal>macker</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>check-forbidden</id>
      <!-- The Forbidden APIs tool makes sure your code does not call certain
           unsafe or undesirable classes or methods. For more information see
           https://github.com/policeman-tools/forbidden-apis -->
      <activation>
        <property>
          <name>check1</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>de.thetaphi</groupId>
            <artifactId>forbiddenapis</artifactId>
            <version>2.1</version>
            <configuration>
              <failOnUnsupportedJava>true</failOnUnsupportedJava>
              <bundledSignatures>
                <bundledSignature>jdk-unsafe</bundledSignature>
                <bundledSignature>jdk-deprecated</bundledSignature>
                <bundledSignature>jdk-internal</bundledSignature>
                <bundledSignature>jdk-non-portable</bundledSignature>
                <bundledSignature>jdk-reflection</bundledSignature>
              </bundledSignatures>
              <signaturesFiles>
                <signaturesFile>${forbiddenapis.parent.txt}</signaturesFile>
                <signaturesFile>src/tool/forbidden-apis.txt</signaturesFile>
              </signaturesFiles>
            </configuration>
            <executions>
              <execution>
                <goals>
                  <goal>check</goal>
                  <goal>testCheck</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>checkstyle</id>
      <!-- Checkstyle enforces some basic code formatting (e.g. spaces, not tabs).
           For more information see https://github.com/checkstyle/checkstyle -->
      <activation>
        <property>
          <name>check1</name>
        </property>
      </activation>
      <build>
        <plugins>
          <!-- Use checkstyle to verify basic source code formatting -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-checkstyle-plugin</artifactId>
            <version>2.17</version>
            <dependencies>
              <dependency>
                <groupId>com.puppycrawl.tools</groupId>
                <artifactId>checkstyle</artifactId>
                <version>6.18</version>
              </dependency>
            </dependencies>
            <executions>
              <execution>
                <id>validate</id>
                <phase>verify</phase>
                <configuration>
                  <configLocation>target/parent-files/checkstyle.xml</configLocation>
                  <encoding>UTF-8</encoding>
                  <consoleOutput>true</consoleOutput>
                  <failsOnError>true</failsOnError>
                  <violationSeverity>warning</violationSeverity>
                </configuration>
                <goals>
                  <goal>check</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>checker</id>
      <!-- The Checker Framework is a static analysis tool that can perform
           many kinds of advanced error checking. We use it primarily for
           making sure there are no SQL injection security problems. For
           more information see http://types.cs.washington.edu/checker-framework/ -->
      <activation>
        <property>
          <!-- We use two sets of checking profiles because errorprone and the checker framework conflict -->
          <name>check2</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <goals>
                  <goal>properties</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.5.1</version>
            <configuration>
              <source>8</source>
              <target>8</target>
              <fork>true</fork>
              <annotationProcessors>
                <!--<annotationProcessor>org.checkerframework.checker.nullness.NullnessChecker</annotationProcessor>-->
                <annotationProcessor>org.checkerframework.checker.tainting.TaintingChecker</annotationProcessor>
              </annotationProcessors>
              <compilerArgs>
                <arg>-J-Xmx1g</arg>
                <arg>-J-Xss32m</arg>
                <arg>-Xbootclasspath/p:${annotatedJdk}</arg>
                <arg>-version</arg>
                <arg>-AprintErrorStack</arg>
                <arg>-AprintAllQualifiers</arg>
                <arg>-AatfCacheSize=400</arg>
                <!--<arg>-Alint</arg>-->
                <arg>-Astubs=${com.github.susom:database:jar}</arg>
              </compilerArgs>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>release-as-parent-pom</id>
      <activation>
        <property>
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.5</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <modules>
    <module>vertx-parent-files</module>
  </modules>
</project>
