<?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>

    <groupId>io.bloombox</groupId>
    <artifactId>java-client</artifactId>
    <name>Bloombox: Java Client</name>
    <version>1.0-beta3</version>
    <url>https://bloombox.github.io/Java</url>
    <description>Java RPCAPI client for the Bloombox Cloud.</description>
    <inceptionYear>2017</inceptionYear>

    <scm>
        <url>https://github.com/bloombox/java</url>
        <connection>scm:git:https://github.com/bloombox/java.git</connection>
        <developerConnection>scm:git:git@github.com:bloombox/java.git</developerConnection>
        <tag>v1.0-beta3</tag>
    </scm>

    <organization>
        <url>https://bloombox.io</url>
        <name>Bloombox</name>
    </organization>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
            <comments>A business-friendly OSS license. All Bloombox OSS code is distributed under Apache 2.0.</comments>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Sam Gammon</name>
            <url>https://github.com/sgammon</url>
            <email>sam@bloombox.io</email>
            <organization>Bloombox</organization>
            <organizationUrl>https://bloombox.io</organizationUrl>
            <roles>
                <role>architect</role>
                <role>developer</role>
            </roles>
            <timezone>America/Los_Angeles</timezone>
        </developer>
    </developers>

    <issueManagement>
        <system>GitHub Issues</system>
        <url>https://github.com/bloombox/java/issues</url>
    </issueManagement>

    <pluginRepositories>
        <pluginRepository>
            <id>jcenter</id>
            <name>JCenter</name>
            <url>https://jcenter.bintray.com/</url>
        </pluginRepository>
    </pluginRepositories>

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

    <properties>
        <!-- Configuration -->
        <bloombox.shop.version>v1</bloombox.shop.version>
        <bloombox.shop.endpoint>shop.api.bloombox.cloud</bloombox.shop.endpoint>
        <bloombox.telemetry.version>v1beta3</bloombox.telemetry.version>
        <bloombox.telemetry.endpoint>telemetry.api.bloombox.cloud</bloombox.telemetry.endpoint>

        <!-- Dependencies -->
        <grpc.version>1.7.0</grpc.version>
        <protobuf.version>3.4.0</protobuf.version>
        <netty.boringssl.version>2.0.7.Final</netty.boringssl.version>
        <kotlin.version>1.2.0</kotlin.version>

        <!-- Testing -->
        <junit.version>4.12</junit.version>

        <!-- Plugins -->
        <maven.jar.version>3.0.2</maven.jar.version>
        <maven.clean.version>2.6.1</maven.clean.version>
        <maven.surefire.version>2.20</maven.surefire.version>
        <maven.compiler.version>3.7.0</maven.compiler.version>
        <maven.jacoco.version>0.7.9</maven.jacoco.version>
        <maven.shade.version>3.1.0</maven.shade.version>
        <maven.source.version>3.0.1</maven.source.version>
        <maven.dokka.version>0.9.15</maven.dokka.version>
        <maven.site.version>3.6</maven.site.version>
        <maven.reports.version>2.9</maven.reports.version>
        <maven.deploy.version>2.8.2</maven.deploy.version>
        <maven.release.version>2.5.3</maven.release.version>
        <maven.github.version>0.9</maven.github.version>
        <maven.gpg.version>1.4</maven.gpg.version>
        <maven.javadoc.version>2.10.4</maven.javadoc.version>
        <maven.nexus.version>1.6.7</maven.nexus.version>

        <!-- Settings -->
        <jvm.target>1.8</jvm.target>
        <kotlin.compiler.incremental>true</kotlin.compiler.incremental>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <!-- Protobuf -->
        <dependency>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protobuf-java</artifactId>
            <version>${protobuf.version}</version>
        </dependency>

        <!-- gRPC -->
        <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>io.grpc</groupId>
            <artifactId>grpc-core</artifactId>
            <version>${grpc.version}</version>
        </dependency>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-tcnative-boringssl-static</artifactId>
            <version>${netty.boringssl.version}</version>
        </dependency>

        <!-- Kotlin Stdlib -->
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib</artifactId>
            <version>${kotlin.version}</version>
        </dependency>

        <!-- Testing -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-test-junit</artifactId>
            <version>${kotlin.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>${maven.site.version}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <version>${maven.clean.version}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven.surefire.version}</version>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${maven.jacoco.version}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>${maven.jar.version}</version>
                <executions>
                    <execution>
                        <id>attach-test-jar</id>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <version>${kotlin.version}</version>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <sourceDirs>
                                <sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
                                <sourceDir>${project.basedir}/src/main/java</sourceDir>
                            </sourceDirs>
                        </configuration>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                        <configuration>
                            <sourceDirs>
                                <sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
                            </sourceDirs>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <jvmTarget>${jvm.target}</jvmTarget>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.version}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>${maven.source.version}</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>attach-test-sources</id>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>${maven.shade.version}</version>
                <configuration>
                    <shadedArtifactAttached>true</shadedArtifactAttached>
                    <shadedClassifierName>bundled</shadedClassifierName>

                    <!-- Artifacts -->
                    <artifactSet>
                        <!-- Exclusions -->
                        <excludes>
                            <exclude>classworlds:classworlds</exclude>
                            <exclude>junit:junit</exclude>
                            <exclude>jmock:*</exclude>
                            <exclude>*:xml-apis</exclude>
                            <exclude>org.apache.maven:lib:tests</exclude>
                        </excludes>
                    </artifactSet>

                    <!-- Transformers -->
                    <transformers>
                        <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                            <manifestEntries>
                                <Main-Class>bloombox.client.CLITool</Main-Class>
                            </manifestEntries>
                        </transformer>
                        <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer">
                        </transformer>
                        <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer">
                            <addHeader>false</addHeader>
                        </transformer>
                    </transformers>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.github.github</groupId>
                <artifactId>site-maven-plugin</artifactId>
                <version>${maven.github.version}</version>
                <configuration>
                    <message>Update site.</message>
                    <project>bloombox/java</project>
                    <server>github</server>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>site</goal>
                        </goals>
                        <phase>site-deploy</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>${maven.reports.version}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>${maven.deploy.version}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>${maven.release.version}</version>
                <configuration>
                    <tagNameFormat>v@{project.version}</tagNameFormat>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <goals>deploy</goals>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>${maven.gpg.version}</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>${maven.nexus.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>ossrh</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jetbrains.dokka</groupId>
                <artifactId>dokka-maven-plugin</artifactId>
                <version>${maven.dokka.version}</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>dokka</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <moduleName>java-client</moduleName>
                    <outputFormat>html</outputFormat>

                    <jdkVersion>8</jdkVersion>
                    <sourceDirectories>
                        <sourceDirectory>src/main/kotlin</sourceDirectory>
                    </sourceDirectories>
                    <outputDir>target/site/client</outputDir>
                    <perPackageOptions>
                        <packageOptions>
                            <prefix>bloombox</prefix>
                            <skipDeprecated>false</skipDeprecated>
                            <reportUndocumented>true</reportUndocumented>
                            <includeNonPublic>false</includeNonPublic>
                        </packageOptions>
                    </perPackageOptions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven.javadoc.version}</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>javadoc</goal>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <attach>true</attach>
                    <classifier>javadoc</classifier>
                    <level>public</level>
                    <outputDirectory>target/site/schema</outputDirectory>
                    <excludePackageNames>io.bloombox.schema.services.*:io.bloombox.schema.identity.*:io.bloombox.schema.services.*:io.bloombox.schema.security.*</excludePackageNames>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven.javadoc.version}</version>
                <configuration>
                    <attach>true</attach>
                    <classifier>docs</classifier>
                    <level>public</level>
                    <outputDirectory>target/site/schema</outputDirectory>
                    <excludePackageNames>io.bloombox.schema.services.*:io.bloombox.schema.identity.*:io.bloombox.schema.services.*:io.bloombox.schema.security.*</excludePackageNames>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jetbrains.dokka</groupId>
                <artifactId>dokka-maven-plugin</artifactId>
                <version>${maven.dokka.version}</version>
                <configuration>
                    <moduleName>java-client</moduleName>
                    <outputFormat>html</outputFormat>

                    <jdkVersion>8</jdkVersion>
                    <sourceDirectories>
                        <sourceDirectory>src/main/kotlin</sourceDirectory>
                    </sourceDirectories>
                    <outputDir>target/site/client</outputDir>
                    <perPackageOptions>
                        <packageOptions>
                            <prefix>bloombox</prefix>
                            <skipDeprecated>false</skipDeprecated>
                            <reportUndocumented>true</reportUndocumented>
                            <includeNonPublic>false</includeNonPublic>
                        </packageOptions>
                    </perPackageOptions>
                </configuration>
            </plugin>
        </plugins>
    </reporting>
</project>
