<?xml version="1.0"?>
<!--
  ~ Copyright 2015 MiLaboratory.com
  ~
  ~ 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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" 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.milaboratory</groupId>
    <artifactId>mitools</artifactId>
    <version>1.5</version>
    <packaging>jar</packaging>
    <name>MiTools</name>
    <url>https://github.com/milaboratory/mitools</url>

    <parent>
        <groupId>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>7</version>
        <relativePath/>
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <milib.version>1.8</milib.version>
    </properties>

    <description>
        Yet another Java library for Next Generation Sequencing (NGS) data processing.
    </description>

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

    <dependencies>
        <dependency>
            <groupId>com.milaboratory</groupId>
            <artifactId>milib</artifactId>
            <version>${milib.version}</version>
        </dependency>
        <dependency>
            <groupId>com.milaboratory</groupId>
            <artifactId>milib</artifactId>
            <version>${milib.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.beust</groupId>
            <artifactId>jcommander</artifactId>
            <version>1.48</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.10</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>1.9.5</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <developers>
        <developer>
            <id>dbolotin</id>
            <email>bolotin.dmitriy@gmail.com</email>
            <name>Bolotin Dmitriy</name>
            <organization>MiLaboratory</organization>
            <organizationUrl>http://milaboratory.com/</organizationUrl>
            <roles>
                <role>architect</role>
                <role>developer</role>
                <role>tester</role>
                <role>documentation</role>
            </roles>
            <timezone>UTC+04:00</timezone>
            <url>https://github.com/dbolotin</url>
        </developer>
        <developer>
            <id>PoslavskySV</id>
            <email>stvlpos@mail.ru</email>
            <name>Poslavsky Stanislav</name>
            <organization>MiLaboratory</organization>
            <organizationUrl>http://milaboratory.com/</organizationUrl>
            <roles>
                <role>architect</role>
                <role>developer</role>
                <role>tester</role>
                <role>documentation</role>
            </roles>
            <timezone>UTC+04:00</timezone>
            <url>https://github.com/PoslavskySV</url>
        </developer>
        <developer>
            <id>mikesh</id>
            <email>mikhail.shugay@gmail.com</email>
            <name>Mikhail Shugay</name>
            <organization>MiLaboratory</organization>
            <organizationUrl>http://milaboratory.com/</organizationUrl>
            <roles>
                <role>developer</role>
                <role>tester</role>
                <role>documentation</role>
            </roles>
            <timezone>UTC+04:00</timezone>
            <url>https://github.com/mikessh</url>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:https://github.com/milaboratory/mitools.git</connection>
    </scm>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <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>
                            </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>
                            </execution>
                        </executions>
                    </plugin>

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

    <build>
        <plugins>
            <plugin>
                <!-- Workaround maven not being able to set a property conditionally -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.8</version>
                <executions>
                    <execution>
                        <id>read_hostname</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <exportAntProperties>true</exportAntProperties>
                            <target>
                                <exec executable="hostname" failonerror="false" outputproperty="hostname"/>
                                <condition property="hostname" value="unknown">
                                    <not>
                                        <isset property="hostname"/>
                                    </not>
                                </condition>
                            </target>
                        </configuration>
                    </execution>
                    <execution>
                        <id>delete_tokens</id>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <delete>
                                    <fileset dir="${basedir}/src/main/java/" includes="*.tokens"/>
                                </delete>
                            </tasks>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>buildnumber-maven-plugin</artifactId>
                <version>1.4</version>
                <executions>
                    <execution>
                        <id>create-buildnumber</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>create</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>create-metadata</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>create-metadata</goal>
                        </goals>
                        <configuration>
                            <properties>
                                <branch>${scmBranch}</branch>
                                <host>${hostname}</host>
                            </properties>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <doCheck>false</doCheck>
                    <doUpdate>false</doUpdate>
                    <attach>true</attach>
                    <outputName>${project.artifactId}-build.properties</outputName>
                    <shortRevisionLength>7</shortRevisionLength>
                    <addOutputDirectoryToResources>true</addOutputDirectoryToResources>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.17</version>
                <configuration>
                    <forkMode>never</forkMode>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.3</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                            <minimizeJar>true</minimizeJar>
                            <filters>
                                <filter>
                                    <artifact>com.milaboratory:milib</artifact>
                                    <includes>
                                        <include>**</include>
                                    </includes>
                                </filter>
                            </filters>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer">
                                </transformer>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer">
                                    <addHeader>false</addHeader>
                                </transformer>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>com.milaboratory.mitools.cli.Main</mainClass>
                                </transformer>
                            </transformers>
                            <shadedArtifactAttached>true</shadedArtifactAttached>
                            <shadedClassifierName>distribution</shadedClassifierName>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>1.6.4</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>ossrh</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
