<?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>dev.sympho</groupId>
    <artifactId>d4j-encoding-extra</artifactId>
    <version>0.1.1</version>

    <name>d4j-encoding-extra</name>
    <description>Extra encodings for Discord4J types to make them work as fields in Immutables.</description>
    <url>https://d4j-encoding-extra.sympho.dev</url>

    <licenses>
        <license>
            <name>MIT License</name>
            <url>https://opensource.org/licenses/MIT</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>tmarback</id>
            <name>Thiago Marback</name>
            <email>tmarback@sympho.dev</email>
            <url>https://www.github.com/tmarback</url>
            <roles>
                <role>architect</role>
                <role>developer</role>
            </roles>
            <timezone>America/Los_Angeles</timezone>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/tmarback/d4j-encoding-extra.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/tmarback/d4j-encoding-extra.git</developerConnection>
        <tag>v0.1.1</tag>
        <url>https://github.com/tmarback/d4j-encoding-extra/tree/main</url>
    </scm>

    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/tmarback/d4j-encoding-extra/issues</url>
    </issueManagement>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.release>17</maven.compiler.release>
        <d4j.version>3.2.4</d4j.version> <!-- Version of Discord4J used -->
    </properties>

    <dependencies>

        <dependency>
            <groupId>com.discord4j</groupId>
            <artifactId>discord4j-core</artifactId>
            <version>${d4j.version}</version>
        </dependency>

        <dependency>
            <!-- the annotation processor, compile only -->
            <groupId>org.immutables</groupId>
            <artifactId>value</artifactId>
            <version>2.9.3</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <!-- annotation to encodings, need to be reexported transitively, so annotation can be read at compile time for using modules -->
            <groupId>org.immutables</groupId>
            <artifactId>encode</artifactId>
            <version>2.9.3</version>
        </dependency>

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>31.1-jre</version>
        </dependency>

    </dependencies>

    <build>
        <!-- Plugin versions and global configs -->
        <pluginManagement>
            <plugins>

                <!-- tools -->
                <plugin>
                    <artifactId>maven-help-plugin</artifactId>
                    <version>3.4.0</version>
                </plugin>

                <plugin>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>3.0.0</version>
                </plugin>
            
                <!-- clean lifecycle -->
                <plugin>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.2.0</version>
                </plugin>
                
                <!-- default lifecycle -->
                <plugin>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.3.1</version>
                </plugin>

                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.11.0</version>
                    <configuration>
                        <!-- Without showWarnings and verbose, maven-compiler-plugin may not show output. -->
                        <showWarnings>true</showWarnings>
                        <!-- <verbose>true</verbose> -->
                    </configuration>
                </plugin>

                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>3.0.0</version>
                </plugin>

                <plugin>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.3.0</version>
                </plugin>

                <plugin>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.2.1</version>
                </plugin>

                <plugin>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>3.5.0</version>
                    <configuration>
                        <tags>
                            <!-- Enable unofficial specification tags -->
                            <tag>
                                <name>apiNote</name>
                                <placement>a</placement>
                                <head>API Note:</head>
                            </tag>

                            <tag>
                                <name>implSpec</name>
                                <placement>a</placement>
                                <head>Implementation Requirements:</head>
                            </tag>

                            <tag>
                                <name>implNote</name>
                                <placement>a</placement>
                                <head>Implementation Note:</head>
                            </tag>

                        </tags>
                        <links>
                            <link>https://javadoc.io/doc/com.discord4j/discord4j-core/${d4j.version}/</link>
                            <link>https://javadoc.io/doc/com.discord4j/discord4j-common/${d4j.version}/</link>
                        </links>
                        <configuration>
                            <sourcepath>${project.basedir}/src/main/java;${project.basedir}/target/generated-sources/annotations</sourcepath>
                        </configuration>
                    </configuration>
                </plugin>

                <plugin>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>3.0.0</version>
                </plugin>

                <plugin>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>3.0.1</version>
                </plugin>

                <plugin>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>3.1.1</version>
                </plugin>

                <plugin>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>3.1.1</version>
                </plugin>

                <plugin>
                    <groupId>org.sonatype.plugins</groupId>
                    <artifactId>nexus-staging-maven-plugin</artifactId>
                    <version>1.6.13</version>
                </plugin>
                
                <!-- site lifecycle -->
                <plugin>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.12.1</version>
                </plugin>

                <plugin>
                    <artifactId>maven-project-info-reports-plugin</artifactId>
                    <version>3.4.3</version>
                </plugin>

            </plugins>
        </pluginManagement>
        <plugins>

            <!-- Release management -->
            <plugin>
                <artifactId>maven-release-plugin</artifactId>
                <configuration>
                    <tagNameFormat>v@{project.version}</tagNameFormat>
                </configuration>
            </plugin>

        </plugins>
    </build>

    <profiles>
    
        <!-- Deployment profile (required so these plugins are only used when deploying) -->
        <profile>
            <id>deploy</id>
            <build>
                <plugins>
                
                    <!-- Source plugin -->
                    <plugin>
                        <artifactId>maven-source-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Javadoc plugin -->
                    <plugin>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- GPG plugin -->
                    <plugin>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <!-- GPG key used for signing -->
                                    <keyname>6B59AC1D86E77E1F7B3C6702E6A62DA8E718D59B</keyname>
                                    <!-- Prevent `gpg` from using pinentry programs -->
                                    <gpgArguments>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                </plugins>
            </build>
        </profile>
        
        <!-- Deployment to OSSRH -->
        <profile>
            <id>ossrh</id>
            <distributionManagement>
                <snapshotRepository>
                    <id>ossrh</id>
                    <name>OSSRH Snapshots</name>
                    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
                </snapshotRepository>
                <repository>
                    <id>ossrh</id>
                    <name>OSSRH Staging</name>
                    <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
                </repository>
            </distributionManagement>
            <build>
                <plugins>
        
                    <!-- Nexus Staging Plugin -->
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>

                </plugins>
            </build>
        </profile>
        
        <!-- Deployment to GitHub Packages -->
        <profile>
            <id>github</id>
            <distributionManagement>
                <snapshotRepository>
                    <id>github</id>
                    <name>GitHub Packages</name>
                    <url>https://maven.pkg.github.com/tmarback/d4j-encoding-extra</url>
                </snapshotRepository>
                <repository>
                    <id>github</id>
                    <name>GitHub Packages</name>
                    <url>https://maven.pkg.github.com/tmarback/d4j-encoding-extra</url>
                </repository>
            </distributionManagement>
        </profile>

    </profiles>

</project>
