<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.github.almasb</groupId>
    <artifactId>grammy-lib</artifactId>
    <version>0.1.1</version>
    <modules>
        <module>grammy</module>
        <module>grammy-editor</module>
    </modules>

    <packaging>pom</packaging>

    <name>${project.groupId}:${project.artifactId}</name>
    <description>A story-grammar generation library</description>
    <url>https://github.com/AlmasB/grammy</url>

    <licenses>
        <license>
            <name>Apache License, 2.0</name>
            <url>https://opensource.org/licenses/Apache-2.0</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <url>https://github.com/AlmasB/grammy</url>
        <connection>scm:git:git://github.com/AlmasB/grammy.git</connection>
        <developerConnection>scm:git:git@github.com:AlmasB/grammy.git</developerConnection>
    </scm>

    <developers>
        <developer>
            <email>almaslvl@gmail.com</email>
            <name>Almas Baimagambetov</name>
            <url>https://github.com/AlmasB</url>
            <id>almasb</id>
        </developer>
    </developers>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <issueManagement>
        <url>https://github.com/AlmasB/grammy/issues</url>
        <system>GitHub Issues</system>
    </issueManagement>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <source.version>11</source.version>
        <grammy.version>${project.version}</grammy.version>

        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <kotlin.compiler.jvmTarget>1.8</kotlin.compiler.jvmTarget>
        <kotlin.compiler.incremental>true</kotlin.compiler.incremental>

        <!-- plugins -->
        <maven.gpg.version>1.6</maven.gpg.version>
        <sonatype.nexus.staging.version>1.6.7</sonatype.nexus.staging.version>
        <maven.compiler.version>3.8.0</maven.compiler.version>
        <maven.source.version>3.2.0</maven.source.version>
        <maven.jar.version>3.2.0</maven.jar.version>
        <maven.shade.version>3.2.2</maven.shade.version>
        <jacoco.version>0.8.7</jacoco.version>
        <maven.surefire.version>3.0.0-M4</maven.surefire.version>

        <!-- dependencies -->
        <jfx.version>17.0.0.1</jfx.version>
        <kotlin.version>1.5.10</kotlin.version>
        <jackson.version>2.12.1</jackson.version>

        <!-- test dependencies -->
        <junit.jupiter.version>5.6.0</junit.jupiter.version>
        <junit.platform.version>1.6.0</junit.platform.version>
        <hamcrest.version>1.3</hamcrest.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib</artifactId>
            <version>${kotlin.version}</version>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
        </dependency>

        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>${jfx.version}</version>
        </dependency>

        <!-- test scope dependencies -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit.jupiter.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <version>${junit.jupiter.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-library</artifactId>
            <version>${hamcrest.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <!-- Compile java -->
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven.compiler.version}</version>
                    <configuration>
                        <release>${source.version}</release>
                    </configuration>
                </plugin>

                <!-- Compile kotlin -->
                <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>
                                    <source>src/main/kotlin</source>
                                    <source>src/main/java</source>
                                </sourceDirs>
                                <jvmTarget>1.8</jvmTarget>
                            </configuration>
                        </execution>
                        <execution>
                            <id>test-compile</id>
                            <phase>process-test-sources</phase>
                            <goals>
                                <goal>test-compile</goal>
                            </goals>
                            <configuration>
                                <sourceDirs>
                                    <source>src/test/kotlin</source>
                                    <source>src/test/java</source>
                                </sourceDirs>
                                <jvmTarget>1.8</jvmTarget>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <!-- Create sources.jar -->
                <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</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <!-- Create javadoc.jar -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${maven.jar.version}</version>
                    <executions>
                        <execution>
                            <id>empty-javadoc-jar</id>
                            <phase>package</phase>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                            <configuration>
                                <classifier>javadoc</classifier>
                                <classesDirectory>${basedir}/javadoc</classesDirectory>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <!-- Sign artifact using gpg -->
            <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>

            <!-- Upload to sonatype nexus / maven central -->
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>${sonatype.nexus.staging.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>ossrh</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven.surefire.version}</version>
            </plugin>
        </plugins>
    </build>
</project>