<?xml version="1.0" encoding="UTF-8"?>
<!--
   Copyright 2017 Decipher Technology Studios LLC

   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>com.deciphernow</groupId>
    <artifactId>moby</artifactId>
    <packaging>pom</packaging>
    <version>1.0.0</version>

    <name>Moby Docker Libraries</name>
    <description>This project provides libraries for working with Docker from the JVM.</description>
    <url>https://github.com/deciphernow/moby</url>

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

    <modules>
        <module>moby-dns</module>
    </modules>

    <scm>
        <connection>scm:git:git@github.com:deciphernow/moby.git</connection>
        <developerConnection>scm:git:git@github.com:deciphernow/moby.git</developerConnection>
        <url>https://github.com/deciphernow/moby</url>
      <tag>v1.0.0</tag>
  </scm>

    <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>

    <developers>
        <developer>
            <name>Joshua Rutherford</name>
            <organization>Decipher Technology Studios</organization>
            <email>joshua.rutherford@deciphernow.com</email>
        </developer>
    </developers>

    <properties>
        <maven.test.runOrder>hourly</maven.test.runOrder>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <version.bouncycastle.plugin>1.0.0</version.bouncycastle.plugin>
        <version.deploy.plugin>2.8.2</version.deploy.plugin>
        <version.failsafe.plugin>${version.surefire.plugin}</version.failsafe.plugin>
        <version.guava>19.0</version.guava>
        <version.java.plugin>3.6.0</version.java.plugin>
        <version.java.source>1.8</version.java.source>
        <version.java.target>1.8</version.java.target>
        <version.javadoc.plugin>2.10.4</version.javadoc.plugin>
        <version.junit>4.10</version.junit>
        <version.release.plugin>2.5.3</version.release.plugin>
        <version.scala.plugin>3.2.2</version.scala.plugin>
        <version.scala.source>2.11.8</version.scala.source>
        <version.scala.target>2.11</version.scala.target>
        <version.scalastyle.plugin>0.8.0</version.scalastyle.plugin>
        <version.scalatest>3.0.0</version.scalatest>
        <version.scalatest.plugin>1.0</version.scalatest.plugin>
        <version.scoverage.plugin>1.2.0</version.scoverage.plugin>
        <version.source.plugin>3.0.1</version.source.plugin>
        <version.surefire.plugin>2.19.1</version.surefire.plugin>
        <version.vault.plugin>1.0.0</version.vault.plugin>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>${version.guava}</version>
            </dependency>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>${version.junit}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.scala-lang</groupId>
                <artifactId>scala-library</artifactId>
                <version>${version.scala.source}</version>
            </dependency>
            <dependency>
                <groupId>org.scala-lang</groupId>
                <artifactId>scala-compiler</artifactId>
                <version>${version.scala.source}</version>
            </dependency>
            <dependency>
                <groupId>org.scalatest</groupId>
                <artifactId>scalatest_${version.scala.target}</artifactId>
                <version>${version.scalatest}</version>
            </dependency>
            <dependency>
                <groupId>org.scalacheck</groupId>
                <artifactId>scalacheck_${version.scala.target}</artifactId>
                <version>${version.scalacheck}</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.deciphernow</groupId>
                    <artifactId>bouncycastle-maven-plugin</artifactId>
                    <version>${version.bouncycastle.plugin}</version>
                    <configuration>
                        <passphrase>${pgp.passphrase}</passphrase>
                        <rings>${pgp.private}</rings>
                        <userId>build@deciphernow.com</userId>
                    </configuration>
                    <executions>
                        <execution>
                            <id>sign-artifacts</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>sign</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>com.deciphernow</groupId>
                    <artifactId>vault-maven-plugin</artifactId>
                    <version>${version.vault.plugin}</version>
                    <executions>
                        <execution>
                            <id>pull</id>
                            <phase>initialize</phase>
                            <goals>
                                <goal>pull</goal>
                            </goals>
                            <configuration>
                                <servers>
                                    <server>
                                        <url>${env.VAULT_SERVER}</url>
                                        <token>${env.VAULT_TOKEN}</token>
                                        <paths>
                                            <path>
                                                <name>pgp-keys/build</name>
                                                <mappings>
                                                    <mapping>
                                                        <key>pgp.passphrase</key>
                                                        <property>pgp.passphrase</property>
                                                    </mapping>
                                                    <mapping>
                                                        <key>pgp.private</key>
                                                        <property>pgp.private</property>
                                                    </mapping>
                                                </mappings>
                                            </path>
                                        </paths>
                                    </server>
                                </servers>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>net.alchim31.maven</groupId>
                    <artifactId>scala-maven-plugin</artifactId>
                    <version>${version.scala.plugin}</version>
                    <executions>
                        <execution>
                            <id>scala-attach-scaladocs</id>
                            <phase>package</phase>
                            <goals>
                                <goal>doc-jar</goal>
                            </goals>
                            <configuration>
                                <args>
                                    <arg>-no-link-warnings</arg>
                                </args>
                            </configuration>
                        </execution>
                        <execution>
                            <id>scala-compile-first</id>
                            <phase>process-resources</phase>
                            <goals>
                                <goal>add-source</goal>
                                <goal>compile</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>scala-test-compile</id>
                            <phase>process-test-resources</phase>
                            <goals>
                                <goal>testCompile</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${version.java.plugin}</version>
                    <configuration>
                        <source>${version.java.source}</source>
                        <target>${version.java.target}</target>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>compile</phase>
                            <goals>
                                <goal>compile</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>${version.deploy.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${version.failsafe.plugin}</version>
                    <executions>
                        <execution>
                            <id>integration-test</id>
                            <phase>integration-test</phase>
                            <goals>
                                <goal>integration-test</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>verify</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>verify</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <redirectTestOutputToFile>true</redirectTestOutputToFile>
                        <runOrder>${maven.test.runOrder}</runOrder>
                        <includes>
                            <include>**/IntTest*.class</include>
                            <include>**/IntSpec*.class</include>
                        </includes>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${version.javadoc.plugin}</version>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <phase>package</phase>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>${version.release.plugin}</version>
                    <configuration>
                        <autoVersionSubmodules>true</autoVersionSubmodules>
                        <tagNameFormat>v@{project.version}</tagNameFormat>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>${version.source.plugin}</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${version.surefire.plugin}</version>
                    <configuration>
                        <redirectTestOutputToFile>true</redirectTestOutputToFile>
                        <runOrder>${maven.test.runOrder}</runOrder>
                        <includes>
                            <include>**/Test*.class</include>
                            <include>**/Spec*.class</include>
                        </includes>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.scalastyle</groupId>
                    <artifactId>scalastyle-maven-plugin</artifactId>
                    <version>${version.scalastyle.plugin}</version>
                    <configuration>
                        <verbose>false</verbose>
                        <failOnViolation>true</failOnViolation>
                        <failOnWarning>true</failOnWarning>
                        <sourceDirectory>${basedir}/src/main/scala</sourceDirectory>
                        <configLocation>${project.basedir}/../scalastyle.xml</configLocation>
                        <outputFile>${project.build.directory}/scalastyle-output.xml</outputFile>
                        <outputEncoding>UTF-8</outputEncoding>
                    </configuration>
                    <executions>
                        <execution>
                            <id>check-code-style</id>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.scoverage</groupId>
                    <artifactId>scoverage-maven-plugin</artifactId>
                    <version>${version.scoverage.plugin}</version>
                    <configuration>
                        <scalaVersion>${version.scala.source}</scalaVersion>
                        <minimumCoverage>100</minimumCoverage>
                        <failOnMinimumCoverage>true</failOnMinimumCoverage>
                    </configuration>
                    <executions>
                        <execution>
                            <id>check-code-coverage</id>
                            <phase>prepare-package</phase>
                            <goals>
                                <goal>integration-check</goal>
                                <goal>integration-report</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>deploy</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.deciphernow</groupId>
                        <artifactId>bouncycastle-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>com.deciphernow</groupId>
                        <artifactId>vault-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-deploy-plugin</artifactId>
                    </plugin>
                    <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>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
