<?xml version="1.0"?>
<!--
  ~ Copyright (c) 2011-2014 The original author or authors
  ~
  ~  All rights reserved. This program and the accompanying materials
  ~  are made available under the terms of the Eclipse Public License v1.0
  ~  and Apache License v2.0 which accompanies this distribution.
  ~
  ~      The Eclipse Public License is available at
  ~      http://www.eclipse.org/legal/epl-v10.html
  ~
  ~      The Apache License v2.0 is available at
  ~      http://www.opensource.org/licenses/apache2.0.php
  ~
  ~  You may elect to redistribute this code under either of these licenses.
  --><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>

  <parent>
    <groupId>io.vertx</groupId>
    <artifactId>vertx-parent</artifactId>
    <version>10</version>
  </parent>

  <artifactId>vertx-grpc</artifactId>
  <version>3.4.2</version>

  <name>Vert.x gRPC</name>

  <properties>
    <stack.version>3.4.2</stack.version>
    <grpc.version>1.3.0</grpc.version>
<!-- CURRENT_GRPC_VERSION -->
    <vertx.grpc.version>1.3.0</vertx.grpc.version>
<!-- CURRENT_GRPC_VERSION -->
    <jetty.alpnAgent.version>2.0.6</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>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>io.vertx</groupId>
        <artifactId>vertx-dependencies</artifactId>
        <version>${stack.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>

    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-core</artifactId>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-codegen</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-docgen</artifactId>
      <optional>true</optional>
    </dependency>

    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-netty</artifactId>
      <version>${grpc.version}</version>
    </dependency>
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-protobuf</artifactId>
      <version>${grpc.version}</version>
    </dependency>
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-stub</artifactId>
      <version>${grpc.version}</version>
    </dependency>

    <dependency>
      <groupId>org.mortbay.jetty.alpn</groupId>
      <artifactId>jetty-alpn-agent</artifactId>
      <version>${jetty.alpnAgent.version}</version>
      <scope>test</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>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <build>
    <extensions>
      <extension>
        <groupId>kr.motd.maven</groupId>
        <artifactId>os-maven-plugin</artifactId>
        <version>1.4.1.Final</version>
      </extension>
    </extensions>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <configuration>
            <argLine> -javaagent:${jetty.alpnAgent.path}</argLine>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>

      <plugin>
        <groupId>org.bsc.maven</groupId>
        <artifactId>maven-processor-plugin</artifactId>
        <version>3.1.0</version>
        <configuration>
          <systemProperties>
            <java.util.logging.SimpleFormatter.format>%4$s: %3$s - %5$s %6$s%n</java.util.logging.SimpleFormatter.format>
          </systemProperties>
        </configuration>
        <executions>
          <execution>
            <id>generate-sources</id>
            <goals>
              <goal>process</goal>
            </goals>
            <phase>generate-sources</phase>
            <configuration>
              <processors>
                <processor>io.vertx.docgen.JavaDocGenProcessor</processor>
              </processors>
              <optionMap>
                <docgen.output>${asciidoc.dir}/java</docgen.output>
                <maven.groupId>${project.groupId}</maven.groupId>
                <maven.artifactId>${project.artifactId}</maven.artifactId>
                <maven.version>${project.version}</maven.version>
                <vertx.grpc.version>${vertx.grpc.version}</vertx.grpc.version>
              </optionMap>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.xolstice.maven.plugins</groupId>
        <artifactId>protobuf-maven-plugin</artifactId>
        <version>0.5.0</version>
        <configuration>
          <!--
            The version of protoc must match protobuf-java. If you don't depend on
            protobuf-java directly, you will be transitively depending on the
            protobuf-java version that grpc depends on.
          -->
          <protocArtifact>com.google.protobuf:protoc:3.2.0:exe:${os.detected.classifier}</protocArtifact>
          <pluginId>grpc-java</pluginId>
          <pluginArtifact>io.vertx:protoc-gen-grpc-java:${vertx.grpc.version}:exe:${os.detected.classifier}</pluginArtifact>
        </configuration>
        <executions>
          <execution>
            <id>compile</id>
            <configuration>
              <outputDirectory>${project.basedir}/src/main/java</outputDirectory>
              <clearOutputDirectory>false</clearOutputDirectory>
            </configuration>
            <goals>
              <goal>compile</goal>
              <goal>compile-custom</goal>
            </goals>
          </execution>
          <execution>
            <id>test-compile</id>
            <goals>
              <goal>test-compile</goal>
              <goal>test-compile-custom</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <id>package-docs</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <attach>true</attach>
              <descriptors>
                <descriptor>${basedir}/src/main/assembly/docs.xml</descriptor>
              </descriptors>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
