<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         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>studio.magemonkey</groupId>
        <artifactId>magemonkey-parent</artifactId>
        <version>1.21.11-R2</version>
    </parent>

    <artifactId>codex-parent</artifactId>
    <!-- CI sets both properties (-Drevision=X.Y.Z, -Dchangelist=-SNAPSHOT or empty) from the
         last release tag and PR labels; the values in <properties> are only for local builds.
         The modules' <parent> versions use the same two properties. -->
    <version>1.3.0-SNAPSHOT</version>
    <packaging>pom</packaging>
    <name>CodexParent</name>
    <description>The core plugin for VoidEdge plugins</description>

    <modules>
        <module>codex-core</module>
        <module>codex-plugin</module>
        <module>codex-api</module>
        <module>codex-bungee</module>
    </modules>

    <properties>
        <revision>1.2.0</revision>
        <changelist>-SNAPSHOT</changelist>
        <!-- Version plugin.yml/paper-plugin.yml/bungee.yml show. CI sets it to the build's name
             (X.Y.Z-dev.N for a dev build, X.Y.Z for a release) so users can tell exactly which build they run. -->
        <display.version>${project.version}</display.version>
        <delombok.dir>${project.build.directory}/javadoc-delombok</delombok.dir>
    </properties>

    <repositories>
        <repository>
            <id>magemonkey-releases</id>
            <url>https://repo.travja.dev/releases</url>
        </repository>
        <repository>
            <id>magemonkey-snapshots</id>
            <url>https://repo.travja.dev/snapshots</url>
        </repository>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>com.mojang</groupId>
            <artifactId>authlib</artifactId>
        </dependency>

        <dependency>
            <groupId>com.github.MilkBowl</groupId>
            <artifactId>VaultAPI</artifactId>
        </dependency>

        <dependency>
            <groupId>io.lumine</groupId>
            <artifactId>Mythic-Dist</artifactId>
        </dependency>
        <dependency>
            <groupId>io.lumine.xikage</groupId>
            <artifactId>MythicMobs</artifactId>
        </dependency>
        <dependency>
            <groupId>me.clip</groupId>
            <artifactId>placeholderapi</artifactId>
        </dependency>
        <dependency>
            <groupId>net.citizensnpcs</groupId>
            <artifactId>citizens-main</artifactId>
        </dependency>

        <dependency>
            <groupId>com.sk89q.worldguard</groupId>
            <artifactId>worldguard-bukkit</artifactId>
            <version>7.0.21</version>
            <exclusions>
                <exclusion>
                    <groupId>com.sk89q.worledit</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.sk89q.worldedit</groupId>
            <artifactId>worldedit-bukkit</artifactId>
            <version>7.4.6</version>
        </dependency>
        <dependency>
            <groupId>com.sk89q.worldedit</groupId>
            <artifactId>worldedit-core</artifactId>
            <version>7.4.6</version>
        </dependency>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-all</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mcmonkey</groupId>
            <artifactId>sentinel</artifactId>
            <version>2.7.3-SNAPSHOT</version>
            <type>jar</type>
            <scope>provided</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-j -->
        <dependency>
            <groupId>com.mysql</groupId>
            <artifactId>mysql-connector-j</artifactId>
            <version>${mysql.version}</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.google.protobuf</groupId>
                    <artifactId>protobuf-java</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>

        <!-- Test Dependencies -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
        </dependency>
        <dependency>
            <groupId>beer.devs</groupId>
            <artifactId>itemsadder-api</artifactId>
            <version>4.0.17</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.6.1</version>
                <configuration>
                    <systemPropertyVariables>
                        <CODEX_VERSION>${project.version}</CODEX_VERSION>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <!-- release (not just source/target) also checks API usage against Java 14, so a newer
                         build JDK can't sneak in calls that would break servers on older Java versions -->
                    <release>14</release>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok-maven-plugin</artifactId>
                <version>1.18.20.0</version>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>delombok</goal>
                        </goals>
                        <configuration>
                            <sourceDirectory>src/main/java</sourceDirectory>
                            <outputDirectory>${delombok.dir}</outputDirectory>
                            <addOutputDirectory>false</addOutputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- Writes the resolved version into the published pom instead of 1.3.0-SNAPSHOT -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>flatten-maven-plugin</artifactId>
                <version>1.9.0</version>
                <configuration>
                    <updatePomFile>true</updatePomFile>
                    <flattenMode>resolveCiFriendliesOnly</flattenMode>
                </configuration>
                <executions>
                    <execution>
                        <id>flatten</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>flatten</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>flatten-clean</id>
                        <phase>clean</phase>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <!-- The NMS modules need Spigot jars built locally with BuildTools, so they are only built
             when those are available. Pass -DskipNms to build everything else without them. -->
        <profile>
            <id>nms</id>
            <activation>
                <property>
                    <name>!skipNms</name>
                </property>
            </activation>
            <modules>
                <module>codex-nms</module>
            </modules>
        </profile>
        <profile>
            <id>module</id>
            <activation>
                <file>
                    <exists>.module</exists>
                </file>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.12.0</version>
                        <configuration>
                            <sourcepath>${delombok.dir}</sourcepath>
                            <doclint>all,-missing</doclint>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                                <configuration>
                                    <detectOfflineLinks>false</detectOfflineLinks>
                                    <attach>true</attach>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>parent</id>
            <activation>
                <file>
                    <exists>.github</exists>
                </file>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.12.0</version>
                        <configuration>
                            <outputDirectory>${project.basedir}</outputDirectory>
                            <doclint>all,-missing</doclint>
                            <sourcepath>codex-api/target/javadoc-delombok;codex-core/target/javadoc-delombok;codex-plugin/target/javadoc-delombok</sourcepath>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>aggregate</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.12.0</version>
            </plugin>
        </plugins>
    </reporting>

    <licenses>
        <license>
            <name>MIT License</name>
            <url>https://www.opensource.org/licenses/mit-license.php</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>VoidEdge</name>
            <organization>VoidEdge</organization>
            <organizationUrl>https://void.travja.dev</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/magemonkeystudio/codex.git</connection>
        <developerConnection>scm:git:ssh://github.com:magemonkeystudio/codex.git</developerConnection>
        <url>https://github.com/magemonkeystudio/codex</url>
    </scm>

    <distributionManagement>
        <snapshotRepository>
            <id>magemonkey-repo</id>
            <url>${deploy.url}/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>magemonkey-repo</id>
            <url>${deploy.url}/releases</url>
        </repository>
    </distributionManagement>
</project>
