<?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>us.hebi.quickbuf</groupId>
    <artifactId>quickbuf-parent</artifactId>
    <packaging>pom</packaging>
    <version>1.3.2</version>

    <name>QuickBuffers</name>
    <url>https://github.com/HebiRobotics/QuickBuffers</url>
    <description>
        Java library for reading and writing Google's Protocol Buffers v2 messages
    </description>

    <organization>
        <name>HEBI Robotics</name>
        <url>http://www.hebirobotics.com</url>
    </organization>
    <inceptionYear>2019</inceptionYear>

    <!-- Required: license information: -->
    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <!-- Required: source control information: -->
    <scm>
        <url>https://github.com/HebiRobotics/QuickBuffers</url>
        <connection>scm:git:git://github.com/HebiRobotics/QuickBuffers.git</connection>
        <developerConnection>scm:git:git@github.com:HebiRobotics/QuickBuffers.git</developerConnection>
        <tag>HEAD</tag>
    </scm>

    <!-- Maven Central Distribution -->
    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/
            </url>
        </repository>
    </distributionManagement>

    <!-- Required: developer information: -->
    <developers>
        <developer>
            <id>ennerf</id>
            <name>Florian Enner</name>
            <email>florian@hebirobotics.com</email>
            <url>https://github.com/ennerf</url>
            <organization>HEBI Robotics</organization>
            <organizationUrl>https://github.com/HebiRobotics</organizationUrl>
        </developer>
    </developers>

    <modules>
        <module>parser</module>
        <module>generator</module>
        <module>runtime</module>
        <module>compat</module>
        <module>conformance</module>
        <module>benchmarks</module>
    </modules>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <maven.compiler.testSource>8</maven.compiler.testSource>
        <maven.compiler.testTarget>8</maven.compiler.testTarget>
        <protobuf.version>3.21.12</protobuf.version>
        <protoc.jar.version>3.11.4</protoc.jar.version>
        <proto.dir>${project.basedir}/../runtime/src/test/resources/protos</proto.dir>
        <protoc.pluginExt><!-- empty for macOS/linux --></protoc.pluginExt>

        <graalvm.tools.version>0.9.27</graalvm.tools.version>
        <native.staticArg>--static</native.staticArg>
        <native.extension>.exe</native.extension>
        <protoc.os>determined-via-profile</protoc.os>
        <protoc.arch>x86_64</protoc.arch>

        <!-- Jigsaw module name -->
        <javaModuleName />
        <gpg.keyname /> <!-- set via settings.xml to sign release artifacts-->

        <!-- License Headers (http://www.mojohaus.org/license-maven-plugin/update-file-header-mojo.html) -->
        <license.licenseName>apache_v2</license.licenseName>
        <license.addJavaLicenseAfterPackage>false</license.addJavaLicenseAfterPackage>
        <license.trimHeaderLine>true</license.trimHeaderLine>
        <license.excludes>**/*.json,**/*.xml,**/*.sh,**/*.bat</license.excludes>

        <!-- For now, disable 'missing' warnings about undocumented @param and @throws -->
        <doclint>html,syntax,accessibility,reference</doclint>

    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-core</artifactId>
                <version>2.13.1</version>
            </dependency>
            <dependency>
                <groupId>com.google.code.gson</groupId>
                <artifactId>gson</artifactId>
                <version>2.9.0</version>
            </dependency>
            <dependency>
                <groupId>com.google.protobuf</groupId>
                <artifactId>protobuf-java</artifactId>
                <version>${protobuf.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.protobuf</groupId>
                <artifactId>protobuf-java-util</artifactId>
                <version>${protobuf.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.protobuf</groupId>
                <artifactId>protobuf-javalite</artifactId>
                <version>${protobuf.version}</version>
            </dependency>
            <dependency>
                <groupId>com.squareup</groupId>
                <artifactId>javapoet</artifactId>
                <version>1.13.0</version>
            </dependency>
            <dependency>
                <groupId>org.openjdk.jmh</groupId>
                <artifactId>jmh-core</artifactId>
                <version>1.21</version>
            </dependency>
            <dependency>
                <groupId>org.openjdk.jmh</groupId>
                <artifactId>jmh-generator-annprocess</artifactId>
                <version>1.21</version>
            </dependency>
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>1.18.30</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.openjdk.jol</groupId>
                <artifactId>jol-core</artifactId>
                <version>0.9</version>
            </dependency>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.13.1</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>

        <!-- Plugins that run for all modules -->
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>license-maven-plugin</artifactId>
            </plugin>
        </plugins>

        <!-- Configuration for plugins required for publishing to Maven Central -->
        <pluginManagement>
            <plugins>

                <!-- Add licenses to files -->
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <version>2.0.0</version>
                    <executions>
                        <execution>
                            <id>first</id>
                            <goals>
                                <goal>update-file-header</goal>
                            </goals>
                            <phase>process-sources</phase>
                        </execution>
                    </executions>
                </plugin>

                <!-- Optional: ensure the manifest contains artifact version information: -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>2.4</version>
                    <configuration>
                        <archive>
                            <manifest>
                                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                                <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                            </manifest>
                            <manifestEntries>
                                <Automatic-Module-Name>${javaModuleName}</Automatic-Module-Name>
                            </manifestEntries>
                        </archive>
                    </configuration>
                </plugin>

                <!-- Required: Source Jar -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.0.1</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <phase>package</phase>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <!-- Required: Javadoc Jar -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>3.0.1</version>
                    <executions>
                        <execution>
                            <id>attach-javadoc</id>
                            <phase>package</phase>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <!-- Required: Sign Artifacts -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>1.6</version>
                    <executions>
                        <execution>
                            <id>sign-artifacts</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>sign</goal>
                            </goals>
                            <configuration>
                                <keyname>${gpg.keyname}</keyname>
                                <passphraseServerId>${gpg.keyname}</passphraseServerId>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <!-- Deploy selected modules -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>3.0.0-M1</version>
                </plugin>

                <!-- Nexus Staging -->
                <plugin>
                    <groupId>org.sonatype.plugins</groupId>
                    <artifactId>nexus-staging-maven-plugin</artifactId>
                    <version>1.6.13</version>
                    <extensions>true</extensions>
                    <configuration>
                        <serverId>ossrh</serverId>
                        <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
                        <autoReleaseAfterClose>true</autoReleaseAfterClose>
                    </configuration>
                </plugin>

            </plugins>
        </pluginManagement>

    </build>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <!-- Plugins required for publishing to Maven Central -->
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>license-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>platform-windows</id>
            <activation>
                <os>
                    <family>windows</family>
                </os>
            </activation>
            <properties>
                <protoc.pluginExt>.bat</protoc.pluginExt>
                <protoc.os>windows</protoc.os>
                <native.extension><!-- added automatically --></native.extension>
            </properties>
        </profile>
        <profile>
            <id>platform-linux</id>
            <activation>
                <os>
                    <name>linux</name>
                </os>
            </activation>
            <properties>
                <protoc.os>linux</protoc.os>
            </properties>
        </profile>
        <profile>
            <id>platform-osx</id>
            <activation>
                <os>
                    <name>mac os x</name>
                </os>
            </activation>
            <properties>
                <protoc.os>osx</protoc.os>
                <native.staticArg>--verbose</native.staticArg> <!-- unsupported on osx -->
            </properties>
        </profile>
        <profile>
            <id>arch-aarch64</id>
            <activation>
                <os>
                    <arch>aarch64</arch>
                </os>
            </activation>
            <properties>
                <protoc.arch>aarch_64</protoc.arch>
            </properties>
        </profile>
        <profile>
            <id>useNativeGen</id>
            <properties>
                <protoc.pluginExt>-${project.version}-${protoc.os}-${protoc.arch}.exe</protoc.pluginExt>
            </properties>
        </profile>
    </profiles>

</project>