<?xml version="1.0" encoding="UTF-8"?>
<!--

   Copyright (c) 2015 DataTorrent, Inc. ALL Rights Reserved.

   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>

  <groupId>com.datatorrent</groupId>
  <artifactId>netlet</artifactId>
  <version>1.3.2</version>
  <packaging>jar</packaging>

  <name>Netlet</name>
  <description>A networking library to facilitate a no-nonsense fast tcp nio</description>
  <url>http://www.datatorrent.com/product/netlet</url>

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

  <prerequisites>
    <maven>3.0.5</maven>
  </prerequisites>

  <developers>
    <developer>
      <id>243826</id>
      <name>Chetan Narsude</name>
      <email>chetan@datatorrent.com</email>
      <organization>DataTorrent, Inc.</organization>
      <roles>
        <role>architect</role>
        <role>developer</role>
      </roles>
    </developer>
    <developer>
      <id>vrozov</id>
      <name>Vlad Rozov</name>
      <email>v.rozov@datatorrent.com</email>
      <organization>DataTorrent, Inc.</organization>
      <roles>
        <role>developer</role>
      </roles>
    </developer>
    <developer>
      <id>PramodSSImmaneni</id>
      <name>Pramod Immaneni</name>
      <email>pramod@datatorrent.com</email>
      <organization>DataTorrent, Inc.</organization>
      <roles>
        <role>developer</role>
      </roles>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:git@github.com:DataTorrent/Netlet.git</connection>
    <developerConnection>scm:git:git@github.com:DataTorrent/Netlet.git</developerConnection>
    <url>git@github.com:DataTorrent/Netlet.git</url>
  </scm>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <checkstyle.console>false</checkstyle.console>
    <semver.skip>false</semver.skip>
    <powermock.version>1.6.5</powermock.version>
    <benchmark.count>1000000</benchmark.count>
    <benchmark.size>256</benchmark.size>
    <benchmark.host>localhost</benchmark.host>
    <benchmark.port>8080</benchmark.port>
  </properties>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.3</version>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>1.4.1</version>
        <executions>
          <execution>
            <id>enforce-java</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireJavaVersion>
                  <version>[1.6.0,)</version>
                  <message>Netlet build requires Java 1.6 or above.</message>
                </requireJavaVersion>
              </rules>
            </configuration>
          </execution>
          <execution>
            <id>enforce-maven</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireMavenVersion>
                  <version>[3.0.5,)</version>
                  <message>Netlet build requires Maven 3.0.5 or above.</message>
                </requireMavenVersion>
              </rules>
            </configuration>
          </execution>
          <execution>
            <id>enforce-release-dependencies</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireReleaseDeps>
                  <message>Snapshots dependencies are not allowed for release build.</message>
                  <onlyWhenRelease>true</onlyWhenRelease>
                </requireReleaseDeps>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>animal-sniffer-maven-plugin</artifactId>
        <version>1.14</version>
        <configuration>
          <signature>
            <groupId>org.codehaus.mojo.signature</groupId>
            <artifactId>java16</artifactId>
            <version>1.0</version>
          </signature>
        </configuration>
        <executions>
          <execution>
            <phase>process-classes</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.github.siom79.japicmp</groupId>
        <artifactId>japicmp-maven-plugin</artifactId>
        <version>0.8.1</version>
        <configuration>
          <oldVersion>
            <dependency>
              <groupId>com.datatorrent</groupId>
              <artifactId>netlet</artifactId>
              <version>1.3.0</version>
            </dependency>
          </oldVersion>
          <newVersion>
            <file>
              <path>${project.build.directory}/${project.artifactId}-${project.version}.jar</path>
            </file>
          </newVersion>
          <parameter>
            <onlyModified>true</onlyModified>
            <accessModifier>protected</accessModifier>
            <breakBuildBasedOnSemanticVersioning>true</breakBuildBasedOnSemanticVersioning>
            <onlyBinaryIncompatible>false</onlyBinaryIncompatible>
            <includeSynthetic>false</includeSynthetic>
            <ignoreMissingClasses>false</ignoreMissingClasses>
          </parameter>
          <skip>${semver.skip}</skip>
        </configuration>
        <executions>
          <execution>
            <phase>verify</phase>
            <goals>
              <goal>cmp</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <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.17</version>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <id>checkstyle</id>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <configLocation>netlet_checks.xml</configLocation>
          <maxAllowedViolations>185</maxAllowedViolations>
          <failOnViolation>true</failOnViolation>
          <includeTestSourceDirectory>true</includeTestSourceDirectory>
          <logViolationsToConsole>${checkstyle.console}</logViolationsToConsole>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <reporting>
    <plugins>
      <plugin>
        <groupId>com.github.siom79.japicmp</groupId>
        <artifactId>japicmp-maven-plugin</artifactId>
        <version>0.8.1</version>
        <configuration>
          <oldVersion>
            <dependency>
              <groupId>com.datatorrent</groupId>
              <artifactId>netlet</artifactId>
              <version>1.3.0</version>
            </dependency>
          </oldVersion>
          <newVersion>
            <file>
              <path>${project.build.directory}/${project.artifactId}-${project.version}.jar</path>
            </file>
          </newVersion>
          <parameter>
            <onlyModified>true</onlyModified>
            <accessModifier>protected</accessModifier>
            <onlyBinaryIncompatible>false</onlyBinaryIncompatible>
            <includeSynthetic>false</includeSynthetic>
            <ignoreMissingClasses>false</ignoreMissingClasses>
          </parameter>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>2.17</version>
        <configuration>
          <configLocation>netlet_checks.xml</configLocation>
          <includeTestSourceDirectory>true</includeTestSourceDirectory>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>findbugs-maven-plugin</artifactId>
        <version>3.0.3</version>
      </plugin>
    </plugins>
  </reporting>

  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>2.4</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.10.3</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.6</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>1.6.6</version>
            <extensions>true</extensions>
            <configuration>
              <serverId>ossrh</serverId>
              <nexusUrl>https://oss.sonatype.org/</nexusUrl>
              <autoReleaseAfterClose>true</autoReleaseAfterClose>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>Benchmark Netlet Server</id>
      <activation>
        <property>
          <name>benchmark</name>
          <value>netlet.server</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.4.0</version>
            <executions>
              <execution>
                <goals>
                  <goal>exec</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <executable>java</executable>
              <arguments>
                <argument>-server</argument>
                <argument>-XX:+PrintGCDetails</argument>
                <argument>-Xms2g</argument>
                <argument>-Xmx2g</argument>
                <argument>-XX:NewSize=768m</argument>
                <argument>-XX:MaxNewSize=768m</argument>
                <argument>-cp</argument>
                <classpath />
                <argument>-Dcom.datatorrent.netlet.benchmark.message.count=${benchmark.count}</argument>
                <argument>-Dcom.datatorrent.netlet.benchmark.message.size=${benchmark.size}</argument>
                <argument>com.datatorrent.netlet.benchmark.netlet.EchoTcpServer</argument>
                <argument>${benchmark.port}</argument>
              </arguments>
              <classpathScope>test</classpathScope>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>Benchmark Netty Server</id>
      <activation>
        <property>
          <name>benchmark</name>
          <value>netty.server</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.4.0</version>
            <executions>
              <execution>
                <goals>
                  <goal>exec</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <executable>java</executable>
              <arguments>
                <argument>-server</argument>
                <argument>-XX:+PrintGCDetails</argument>
                <argument>-Xms2g</argument>
                <argument>-Xmx2g</argument>
                <argument>-XX:NewSize=768m</argument>
                <argument>-XX:MaxNewSize=768m</argument>
                <argument>-cp</argument>
                <classpath />
                <argument>-Dcom.datatorrent.netlet.benchmark.message.count=${benchmark.count}</argument>
                <argument>-Dcom.datatorrent.netlet.benchmark.message.size=${benchmark.size}</argument>
                <argument>com.datatorrent.netlet.benchmark.netty.EchoTcpServer</argument>
                <argument>${benchmark.port}</argument>
              </arguments>
              <classpathScope>test</classpathScope>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>Benchmark Netlet Client</id>
      <activation>
        <property>
          <name>benchmark</name>
          <value>netlet.client</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.4.0</version>
            <executions>
              <execution>
                <goals>
                  <goal>exec</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <executable>java</executable>
              <arguments>
                <argument>-server</argument>
                <argument>-verbose:gc</argument>
                <argument>-Xms1g</argument>
                <argument>-Xmx1g</argument>
                <argument>-XX:NewSize=512m</argument>
                <argument>-XX:MaxNewSize=512m</argument>
                <argument>-cp</argument>
                <classpath />
                <argument>-Dcom.datatorrent.netlet.benchmark.message.count=${benchmark.count}</argument>
                <argument>-Dcom.datatorrent.netlet.benchmark.message.size=${benchmark.size}</argument>
                <argument>com.datatorrent.netlet.benchmark.netlet.BenchmarkTcpClient</argument>
                <argument>${benchmark.host}</argument>
                <argument>${benchmark.port}</argument>
              </arguments>
              <classpathScope>test</classpathScope>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>Benchmark Netty Client</id>
      <activation>
        <property>
          <name>benchmark</name>
          <value>netty.client</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.4.0</version>
            <executions>
              <execution>
                <goals>
                  <goal>exec</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <executable>java</executable>
              <arguments>
                <argument>-server</argument>
                <argument>-verbose:gc</argument>
                <argument>-Xms1g</argument>
                <argument>-Xmx1g</argument>
                <argument>-XX:NewSize=512m</argument>
                <argument>-XX:MaxNewSize=512m</argument>
                <argument>-cp</argument>
                <classpath />
                <argument>-Dcom.datatorrent.netlet.benchmark.message.count=${benchmark.count}</argument>
                <argument>-Dcom.datatorrent.netlet.benchmark.message.size=${benchmark.size}</argument>
                <argument>com.datatorrent.netlet.benchmark.netty.BenchmarkTcpClient</argument>
                <argument>${benchmark.host}</argument>
                <argument>${benchmark.port}</argument>
              </arguments>
              <classpathScope>test</classpathScope>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <dependencies>
    <dependency>
      <groupId>org.jctools</groupId>
      <artifactId>jctools-core</artifactId>
      <version>1.2.1</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>1.7.5</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
      <version>1.7.5</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
      <type>jar</type>
    </dependency>
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-all</artifactId>
      <version>5.0.0.Alpha2</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>commons-configuration</groupId>
      <artifactId>commons-configuration</artifactId>
      <version>1.10</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-math3</artifactId>
      <version>3.5</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.powermock</groupId>
      <artifactId>powermock-module-junit4</artifactId>
      <version>${powermock.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.powermock</groupId>
      <artifactId>powermock-api-mockito</artifactId>
      <version>${powermock.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

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

</project>
