<?xml version="1.0" encoding="UTF-8"?>
<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>ai.grakn.kgms</groupId>
        <artifactId>grakn-kgms</artifactId>
        <version>1.4.3</version>
    </parent>

    <artifactId>client</artifactId>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
        </dependency>
        <dependency>
            <groupId>ai.grakn.kgms</groupId>
            <artifactId>core</artifactId>
        </dependency>
        <dependency>
            <groupId>ai.grakn</groupId>
            <artifactId>grakn-core</artifactId>
        </dependency>
        <dependency>
            <groupId>ai.grakn.kgms</groupId>
            <artifactId>console</artifactId>
        </dependency>
        <dependency>
            <groupId>ai.grakn</groupId>
            <artifactId>client-java</artifactId>
        </dependency>
    </dependencies>
    <build>
        <extensions>
            <extension>
                <groupId>kr.motd.maven</groupId>
                <artifactId>os-maven-plugin</artifactId>
                <version>1.5.0.Final</version>
            </extension>
        </extensions>
        <plugins>
             <plugin>
                <groupId>org.xolstice.maven.plugins</groupId>
                <artifactId>protobuf-maven-plugin</artifactId>
                <version>0.5.0</version>
                <configuration>
                    <protocArtifact>com.google.protobuf:protoc:3.5.1-1:exe:${os.detected.classifier}</protocArtifact>
                    <pluginId>grpc-java</pluginId>
                    <pluginArtifact>io.grpc:protoc-gen-grpc-java:1.9.0:exe:${os.detected.classifier}</pluginArtifact>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>compile-custom</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <!--
            This profile is meant to be used for deploying to ossrh (ie., oss.sonatype.org, our production repository).
            When used, it will first sign the artifact and uses the nexus staging before deploying the artifact.
            -->
            <id>client-production-releases</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>2.9.1</version>
                        <configuration>
                            <javadocExecutable>${java.home}/../bin/javadoc</javadocExecutable>
                            <additionalparam>-Xdoclint:none</additionalparam>
                            <header><![CDATA[<a href="https://grakn.ai" target="_top">Grakn</a>]]></header>
                            <bottom><![CDATA[Copyright &#169; {currentYear} <a href="https://grakn.ai" target="_top">Grakn Labs Ltd</a>. All rights reserved.]]></bottom>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-aggregate-javadocs</id>
                                <goals>
                                    <goal>aggregate-jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.4</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.7</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
            <distributionManagement>
                <snapshotRepository>
                    <id>ossrh</id>
                    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
                </snapshotRepository>
                <repository>
                    <id>ossrh</id>
                    <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
                </repository>
            </distributionManagement>
        </profile>

        <profile>
            <!--
            This profile is meant to be used for deploying to internal-releases (ie., maven.grakn.ai, our internal repository).
            This profile skips the signing step and does not perform nexus staging.
            -->
            <id>client-internal-releases</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <configuration>
                            <skipStaging>true</skipStaging>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
            <distributionManagement>
                <repository>
                    <id>internal-releases</id>
                    <url>https://maven.grakn.ai/content/repositories/internal-releases/</url>
                </repository>
            </distributionManagement>
        </profile>
    </profiles>
</project>