<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (C) 2016-2019 The lgou2w <lgou2w@hotmail.com>
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~ http://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.
  -->
<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>com.lgou2w</groupId>
    <artifactId>ldk</artifactId>
    <version>0.1.8</version>
    <packaging>pom</packaging>
    <name>ldk</name>
    <description>A multi-platform lgou2w development kit</description>
    <url>https://github.com/lgou2w/ldk</url>

    <issueManagement>
        <url>https://github.com/lgou2w/ldk/issues</url>
        <system>GitHub Issues</system>
    </issueManagement>

    <scm>
        <connection>scm:git:git@github.com:lgou2w/ldk.git</connection>
        <developerConnection>scm:git:git@github.com:lgou2w/ldk.git</developerConnection>
        <url>git@github.com:lgou2w/ldk.git</url>
    </scm>

    <licenses>
        <license>
            <name>The Apache License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>lgou2w</id>
            <name>lgou2w</name>
            <email>lgou2w@hotmail.com</email>
            <url>https://lgou2w.com</url>
            <timezone>+8</timezone>
            <roles>
                <role>Owner</role>
                <role>Developer</role>
            </roles>
        </developer>
        <developer>
            <name>25</name>
            <url>https://github.com/25</url>
            <timezone>-5</timezone>
            <roles>
                <role>Contributor</role>
            </roles>
        </developer>
    </developers>

    <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>

    <properties>
        <kotlin.version>1.3.50</kotlin.version>
        <kotlin.compiler.incremental>true</kotlin.compiler.incremental>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <modules>
        <module>ldk-common</module>
        <module>ldk-coroutines</module>
        <module>ldk-asm</module>
        <module>ldk-reflect</module>
        <module>ldk-retrofit</module>
        <module>ldk-i18n</module>
        <module>ldk-chat</module>
        <module>ldk-nbt</module>
        <module>ldk-rx</module>
        <module>ldk-rsa</module>
        <module>ldk-sql</module>
        <module>ldk-exposed</module>
        <module>ldk-fx</module>
        <module>ldk-bukkit</module>
    </modules>

    <repositories>
        <!-- jcenter -->
        <repository>
            <id>jcenter</id>
            <url>https://jcenter.bintray.com/</url>
        </repository>
    </repositories>

    <dependencies>
        <!-- Kotlin -->
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib</artifactId>
            <version>${kotlin.version}</version>
            <scope>compile</scope>
        </dependency>
        <!-- Junit -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <!-- PowerMockito -->
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-api-mockito2</artifactId>
            <version>2.0.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-module-junit4</artifactId>
            <version>2.0.2</version>
            <scope>test</scope>
        </dependency>
        <!-- Mockito-Kotlin -->
        <dependency>
            <groupId>com.nhaarman.mockitokotlin2</groupId>
            <artifactId>mockito-kotlin</artifactId>
            <version>2.1.0</version>
            <scope>test</scope>
        </dependency>
        <!-- Kluent -->
        <dependency>
            <groupId>org.amshove.kluent</groupId>
            <artifactId>kluent</artifactId>
            <version>1.53</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <sourceDirectory>src/main/kotlin</sourceDirectory>
        <testSourceDirectory>src/test/kotlin</testSourceDirectory>
        <plugins>
            <!-- Kotlin Plugin -->
            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <version>${kotlin.version}</version>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <jvmTarget>${maven.compiler.target}</jvmTarget>
                            <sourceDirs>
                                <sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
                            </sourceDirs>
                        </configuration>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                        <configuration>
                            <jvmTarget>${maven.compiler.target}</jvmTarget>
                            <sourceDirs>
                                <sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
                            </sourceDirs>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- Jacoco Plugin -->
            <!-- FIXME: Currently Jacoco can't hit the kotlin top-level inline function -->
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.4</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <destFile>${project.build.directory}/coverage-reports/jacoco.exec</destFile>
                            <excludes>
                                <exclude>**/com/lgou2w/ldk/asm/ASMClass*</exclude>
                                <exclude>**/com/lgou2w/ldk/exposed/**</exclude>
                                <exclude>**/com/lgou2w/ldk/fx/**</exclude>
                                <exclude>**/com/lgou2w/ldk/bukkit/**</exclude>
                                <exclude>**/com/lgou2w/ldk/rsa/RSAUtils*</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <dataFile>${project.build.directory}/coverage-reports/jacoco.exec</dataFile>
                            <excludes>
                                <exclude>**/com/lgou2w/ldk/asm/ASMClass*</exclude>
                                <exclude>**/com/lgou2w/ldk/exposed/**</exclude>
                                <exclude>**/com/lgou2w/ldk/fx/**</exclude>
                                <exclude>**/com/lgou2w/ldk/bukkit/**</exclude>
                                <exclude>**/com/lgou2w/ldk/rsa/RSAUtils*</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- Source Plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.1.0</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Jar Plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.1.2</version>
                <executions>
                    <execution>
                        <!-- Generate empty javadoc jar -->
                        <id>empty-javadoc-jar</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <skipIfEmpty>false</skipIfEmpty>
                            <classifier>javadoc</classifier>
                            <classesDirectory>${basedir}/javadoc</classesDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- GPG Plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>1.6</version>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <phase>deploy</phase> <!-- deployment only -->
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Nexus Staging Plugin -->
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>1.6.8</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>ossrh</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>
