<?xml version="1.0"?>
<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>

    <artifactId>pushy</artifactId>
    <name>Pushy</name>

    <parent>
        <groupId>com.relayrides</groupId>
        <artifactId>pushy-parent</artifactId>
        <version>0.9</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-codec-http2</artifactId>
        </dependency>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-handler-proxy</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty.alpn</groupId>
            <artifactId>alpn-api</artifactId>
        </dependency>
        <!-- Test dependencies -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
        </dependency>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-tcnative-boringssl-static</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.9.1</version>
                <configuration>
                    <overview>${basedir}/src/main/java/overview.html</overview>
                    <show>public</show>
                    <links>
                        <link>http://netty.io/4.1/api/</link>
                    </links>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>test-with-alpn-boot</id>
            <activation>
                <activeByDefault>true</activeByDefault>
                <property>
                    <name>env.PUSHY_SSL_PROVIDER</name>
                    <value>jdk</value>
                </property>
            </activation>
            <properties>
                <jetty.alpnAgent.version>2.0.5</jetty.alpnAgent.version>
                <jetty.alpnAgent.path>${settings.localRepository}/org/mortbay/jetty/alpn/jetty-alpn-agent/${jetty.alpnAgent.version}/jetty-alpn-agent-${jetty.alpnAgent.version}.jar</jetty.alpnAgent.path>
                <jetty.alpnAgent.option>forceNpn=false</jetty.alpnAgent.option>
                <argLine.alpnAgent>-javaagent:${jetty.alpnAgent.path}=${jetty.alpnAgent.option}</argLine.alpnAgent>
            </properties>
            <build>
                <plugins>
                    <!-- Download the alpn-boot.jar in advance to add it to the boot classpath. -->
                    <plugin>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>get-alpn-boot</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>get</goal>
                                </goals>
                                <configuration>
                                    <groupId>org.mortbay.jetty.alpn</groupId>
                                    <artifactId>jetty-alpn-agent</artifactId>
                                    <version>${jetty.alpnAgent.version}</version>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.16</version>
                        <configuration>
                            <argLine>${argLine.alpnAgent} -Dorg.slf4j.simpleLogger.defaultLogLevel=warn -Dio.netty.leakDetectionLevel=PARANOID -ea</argLine>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
