<?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>com.github.auties00</groupId>
    <artifactId>whatsappweb4j</artifactId>
    <version>2.2.2</version>
    <name>${project.groupId}:${project.artifactId}</name>
    <description>Standalone fully-featured Whatsapp Web API for Java and Kotlin</description>
    <url>https://github.com/Auties00/WhatsappWeb4j</url>
    <developers>
        <developer>
            <name>Alessandro Autiero</name>
            <email>alautiero@gmail.com</email>
        </developer>
    </developers>
    <licenses>
        <license>
            <name>MIT License</name>
            <url>http://www.opensource.org/licenses/mit-license.php</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <scm>
        <url>https://github.com/Auties00/WhatsappWeb4j/tree/master</url>
        <connection>scm:git:https://github.com/Auties00/WhatsappWeb4j.git</connection>
        <tag>whatsappweb4j-2.2.2</tag>
    </scm>
    <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>
    <profiles>
        <profile>
            <id>release-sign-artifacts</id>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven.gpg.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
    <packaging>jar</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>17</java.version>
        <maven.surefire.plugin.version>3.0.0-M5</maven.surefire.plugin.version>
        <maven.gpg.plugin.version>1.6</maven.gpg.plugin.version>
        <maven.compiler.plugin.version>3.8.1</maven.compiler.plugin.version>
        <maven.source.plugin.version>3.0.1</maven.source.plugin.version>
        <maven.javadoc.plugin.version>3.2.0</maven.javadoc.plugin.version>
        <maven.deploy.plugin.version>2.8.2</maven.deploy.plugin.version>
        <delombok.plugin.version>1.18.20</delombok.plugin.version>
        <nexus.staging.maven.plugin.version>1.6.7</nexus.staging.maven.plugin.version>
        <lombok.version>1.18.22</lombok.version>
        <maven.jmod.version>3.0.0-alpha.1</maven.jmod.version>
        <jackson.version>2.13.0</jackson.version>
        <junit.version>5.8.1</junit.version>
        <bouncy.castle.version>1.69</bouncy.castle.version>
        <zxing.version>3.4.1</zxing.version>
        <protoc.version>1.4</protoc.version>
        <tyrus.version>2.0.0</tyrus.version>
        <jna.version>5.9.0</jna.version>
        <delombok.output>${project.build.directory}\delomboked-sources</delombok.output>
    </properties>

    <build>
        <plugins>
            <!-- Compile the project-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.plugin.version}</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <release>${java.version}</release>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                            <version>${lombok.version}</version>
                        </path>
                    </annotationProcessorPaths>
                    <compilerArgs>
                        <compilerArg>--enable-preview</compilerArg>
                    </compilerArgs>
                    <failOnError>true</failOnError>
                </configuration>
            </plugin>

            <!-- Test the library to be sure that everything works-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven.surefire.plugin.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>org.junit.jupiter</groupId>
                        <artifactId>junit-jupiter-engine</artifactId>
                        <version>${junit.version}</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <argLine>--enable-preview</argLine>
                </configuration>
            </plugin>

            <!-- Generate and attach the sourcecode -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>${maven.source.plugin.version}</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Delombok the project to prepare for javadoc generation -->
            <plugin>
                <groupId>com.github.auties00</groupId>
                <artifactId>delombok-plugin</artifactId>
                <version>${delombok.plugin.version}</version>
                <configuration>
                    <rootDirectory>${project.build.sourceDirectory}</rootDirectory>
                    <outputDirectory>${delombok.output}</outputDirectory>
                    <excludedFiles>
                        <excludedFile>module-info.java</excludedFile>
                    </excludedFiles>
                </configuration>
                <executions>
                    <execution>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>delombok</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Generate and attach javadocs from delomboked source -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven.javadoc.plugin.version}</version>
                <executions>
                    <execution>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <sourcepath>${delombok.output}</sourcepath>
                    <release>${java.version}</release>
                    <failOnError>true</failOnError>
                    <additionalOptions>--enable-preview</additionalOptions>
                    <debug>true</debug>
                    <verbose>true</verbose>
                </configuration>
            </plugin>

            <!-- Deploy the result-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>${maven.deploy.plugin.version}</version>
                <executions>
                    <execution>
                        <id>default-deploy</id>
                        <phase>deploy</phase>
                        <goals>
                            <goal>deploy</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>${nexus.staging.maven.plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>ossrh</serverId>
                    <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <!-- WebSocket client, TOOD: Replace with native implementation when bug fix is found -->
        <dependency>
            <groupId>org.glassfish.tyrus</groupId>
            <artifactId>tyrus-server</artifactId>
            <version>${tyrus.version}</version>
        </dependency>

        <!-- Project lombok, used for annotations -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>${lombok.version}</version>
        </dependency>

        <!-- Cryptographic dependencies -->
        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcpkix-jdk15on</artifactId>
            <version>${bouncy.castle.version}</version>
        </dependency>

        <!-- Zxing -->
        <dependency>
            <groupId>com.google.zxing</groupId>
            <artifactId>javase</artifactId>
            <version>${zxing.version}</version>
        </dependency>

        <!-- ModernProtoc, used to decode and encode protobuf objects -->
        <dependency>
            <groupId>com.github.auties00</groupId>
            <artifactId>protoc-api</artifactId>
            <version>${protoc.version}</version>
        </dependency>

        <!-- Jackson dependency, used for json operations -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
        </dependency>

        <!-- Testing libraries -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.java.dev.jna</groupId>
            <artifactId>jna</artifactId>
            <version>${jna.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>