<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ /* ******************************************************************************
  ~  * Copyright (c) 2022 Konduit K.K.
  ~  *
  ~  * This program and the accompanying materials are made available under the
  ~  * terms of the Apache License, Version 2.0 which is available at
  ~  * https://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.
  ~  *
  ~  * SPDX-License-Identifier: Apache-2.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">
    <parent>
        <artifactId>konduit-serving-vertx-protocols</artifactId>
        <groupId>ai.konduit.serving</groupId>
        <version>0.0.2</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>konduit-serving-grpc</artifactId>

    <properties>
        <xolstice.protobuf-maven-plugin.version>0.6.1</xolstice.protobuf-maven-plugin.version>
        <vertx.protoc-gen-grpc-java.version>1.25.0</vertx.protoc-gen-grpc-java.version>
        <os-maven-plugin.version>1.4.1.Final</os-maven-plugin.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>io.vertx</groupId>
            <artifactId>vertx-grpc</artifactId>
            <version>${vertx-stack.version}</version>
        </dependency>
        <dependency>
            <groupId>ai.konduit.serving</groupId>
            <artifactId>konduit-serving-common-tests</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.xolstice.maven.plugins</groupId>
                <artifactId>protobuf-maven-plugin</artifactId>
                <version>${xolstice.protobuf-maven-plugin.version}</version>
                <configuration>
                <protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}</protocArtifact>
                    <pluginId>grpc-java</pluginId>
                    <pluginArtifact>io.vertx:protoc-gen-grpc-java:${vertx.protoc-gen-grpc-java.version}:exe:${os.detected.classifier}</pluginArtifact>
                    <additionalProtoPathElements>
                        <additionalProtoPathElement>${project.basedir}/../../konduit-serving-pipeline/src/main/java</additionalProtoPathElement>
                    </additionalProtoPathElements>
                </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>
                </executions>
            </plugin>

        </plugins>
        <extensions>
            <!-- this is included to resolve the `os.detected.classifier` property -->
            <extension>
                <groupId>kr.motd.maven</groupId>
                <artifactId>os-maven-plugin</artifactId>
                <version>${os-maven-plugin.version}</version>
            </extension>
        </extensions>
    </build>
</project>