<!--
  ~ SPDX-License-Identifier: Apache-2.0
  ~ Copyright (c) 2020-2022 MariaDB Corporation Ab
  -->

<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>org.mariadb</groupId>
    <artifactId>r2dbc-mariadb</artifactId>
    <version>1.2.2</version>
    <packaging>jar</packaging>
    <url>https://github.com/mariadb-corporation/mariadb-connector-r2dbc</url>

    <name>R2DBC driver for MariaDB</name>
    <description>R2DBC driver for MariaDB</description>

    <properties>
        <java.version>1.8</java.version>
        <jsr305.version>3.0.2</jsr305.version>
        <junit.version>5.10.0</junit.version>
        <jmh.version>1.37</jmh.version>
        <logback.version>1.4.14</logback.version>
        <logback-java8.version>1.3.12</logback-java8.version>
        <netty.version>4.1.113.Final</netty.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <r2dbc-spi.version>1.0.0.RELEASE</r2dbc-spi.version>
        <reactor.version>2023.0.9</reactor.version>
        <mariadb-jdbc.version>3.3.2</mariadb-jdbc.version>
        <uberjar.name>benchmarks</uberjar.name>
        <spotless.version>2.43.0</spotless.version>
        <jacoco.version>0.8.11</jacoco.version>
    </properties>

    <licenses>
        <license>
            <name>Apache License 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <organization>
        <name>MariaDB Corporation Ab</name>
        <url>https://www.mariadb.com</url>
    </organization>

    <developers>
        <developer>
            <id>mariadbDevelopers</id>
            <name>mariadb developers</name>
            <url>http://www.mariadb.com</url>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/mariadb-corporation/mariadb-connector-r2dbc.git</connection>
        <url>https://github.com/mariadb-corporation/mariadb-connector-r2dbc</url>
        <developerConnection>scm:git:git@github.com/mariadb-corporation/mariadb-connector-r2dbc.git
        </developerConnection>
    </scm>

    <issueManagement>
        <system>JIRA</system>
        <url>https://mariadb.atlassian.net/browse/R2DC</url>
    </issueManagement>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.projectreactor</groupId>
                <artifactId>reactor-bom</artifactId>
                <version>${reactor.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>io.netty</groupId>
                <artifactId>netty-bom</artifactId>
                <version>${netty.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>${junit.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <repositories>
        <repository>
            <id>sonatype-nexus-snapshots</id>
            <name>Sonatype Nexus Snapshots</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>io.r2dbc</groupId>
            <artifactId>r2dbc-spi</artifactId>
            <version>${r2dbc-spi.version}</version>
        </dependency>
        <dependency>
            <groupId>io.r2dbc</groupId>
            <artifactId>r2dbc-spi-test</artifactId>
            <version>${r2dbc-spi.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-core</artifactId>
        </dependency>
        <dependency>
            <groupId>io.projectreactor.netty</groupId>
            <artifactId>reactor-netty-core</artifactId>
        </dependency>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-transport-native-epoll</artifactId>
            <classifier>linux-x86_64</classifier>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-transport-native-kqueue</artifactId>
            <classifier>osx-x86_64</classifier>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
            <version>${jsr305.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mariadb.jdbc</groupId>
            <artifactId>mariadb-java-client</artifactId>
            <version>${mariadb-jdbc.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <compilerArgs>
                        <arg>-Xlint:all,-options,-path,-processing,-requires-transitive-automatic,-requires-automatic
                        </arg>
                    </compilerArgs>
                    <showWarnings>true</showWarnings>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
                <executions>
                    <execution>
                        <id>compile-java-8</id>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <!--          <execution>-->
                    <!--            <id>compile-java-9</id>-->
                    <!--            <phase>compile</phase>-->
                    <!--            <goals>-->
                    <!--              <goal>compile</goal>-->
                    <!--            </goals>-->
                    <!--            <configuration>-->
                    <!--              <release>9</release>-->
                    <!--              <source>9</source>-->
                    <!--              <target>9</target>-->
                    <!--              <compileSourceRoots>-->
                    <!--                <compileSourceRoot>${project.basedir}/src/main/java9</compileSourceRoot>-->
                    <!--              </compileSourceRoots>-->
                    <!--              <multiReleaseOutput>true</multiReleaseOutput>-->
                    <!--            </configuration>-->
                    <!--          </execution>-->
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                        </manifest>
                        <manifestEntries>
                            <R2DBC-Specification-Version>${r2dbc-spi.version}</R2DBC-Specification-Version>
                            <Multi-Release>true</Multi-Release>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.1.1</version>
                <configuration>
                    <source>8</source>
                    <excludePackageNames>
                        org.mariadb.r2dbc.client,org.mariadb.r2dbc.client.codec,org.mariadb.r2dbc.client.message,org.mariadb.r2dbc.client.util
                    </excludePackageNames>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.2.0</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M5</version>
                <configuration>
                    <systemPropertyVariables>
                        <io.netty.leakDetectionLevel>paranoid</io.netty.leakDetectionLevel>
                        <io.netty.leakDetection.targetRecords>1</io.netty.leakDetection.targetRecords>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>1.6.6</version>
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <phase>deploy</phase>
                    </execution>
                </executions>
                <configuration>
                    <serverId>ossrh</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>false</autoReleaseAfterClose>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>1.6</version>
                <executions>
                    <execution>
                        <phase>install</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>${spotless.version}</version>
                <configuration>
                    <!-- optional: limit format enforcement to just the files changed by this feature branch -->
                    <!--                    <ratchetFrom>origin/src</ratchetFrom>-->
                    <formats>
                        <!-- you can define as many formats as you want, each is independent -->
                        <format>
                            <!-- define the files to apply to -->
                            <includes>
                                <include>*.md</include>
                                <include>.gitignore</include>
                            </includes>
                            <excludes>
                                <exclude>Ed25519*.java</exclude>
                            </excludes>
                            <!-- define the steps to apply to those files -->
                            <trimTrailingWhitespace/>
                            <endWithNewline/>
                            <indent>
                                <tabs>true</tabs>
                                <spacesPerTab>2</spacesPerTab>
                            </indent>
                        </format>
                    </formats>
                    <java>
                        <excludes>
                            <exclude>src/main/java/org/mariadb/r2dbc/authentication/standard/ed25519/**/*.java</exclude>
                        </excludes>
                        <includes>
                            <include>src/main/java/**/*.java</include>
                            <include>src/test/java/**/*.java</include>
                        </includes>
                        <googleJavaFormat>
                            <version>1.18.1</version>
                            <style>GOOGLE</style>
                            <reflowLongStrings>true</reflowLongStrings>
                            <formatJavadoc>true</formatJavadoc>
                            <groupArtifact>com.google.googlejavaformat:google-java-format</groupArtifact>
                        </googleJavaFormat>
                        <licenseHeader>
                            <file>${project.basedir}/licenseheader.txt</file>
                        </licenseHeader>
                    </java>
                </configuration>
            </plugin>
        </plugins>

        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>${project.basedir}</directory>
                <includes>
                    <include>LICENSE</include>
                    <include>CHANGELOG</include>
                </includes>
                <targetPath>META-INF</targetPath>
            </resource>
        </resources>
    </build>

    <profiles>
        <profile>
            <id>java8</id>
            <dependencies>
                <dependency>
                    <groupId>ch.qos.logback</groupId>
                    <artifactId>logback-classic</artifactId>
                    <version>${logback-java8.version}</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>3.10.1</version>
                        <configuration>
                            <showWarnings>true</showWarnings>
                            <compilerArgs>
                                <arg>-Xlint:all,-options,-path,-processing</arg>
                            </compilerArgs>
                            <source>1.8</source>
                            <target>1.8</target>
                        </configuration>
                        <executions>
                            <execution>
                                <id>compile-java-8</id>
                                <goals>
                                    <goal>compile</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>${jacoco.version}</version>
                        <configuration>
                            <excludes>
                                <exclude>**/ed25519/**/*.class</exclude>
                                <exclude>META-INF/**</exclude>
                            </excludes>
                        </configuration>
                        <executions>
                            <execution>
                                <id>jacoco-initialize</id>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>report</id>
                                <phase>test</phase>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <dependencies>
                <dependency>
                    <groupId>ch.qos.logback</groupId>
                    <artifactId>logback-classic</artifactId>
                    <version>${logback.version}</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>bench</id>
            <dependencies>
                <dependency>
                    <groupId>org.openjdk.jmh</groupId>
                    <artifactId>jmh-core</artifactId>
                    <version>${jmh.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.openjdk.jmh</groupId>
                    <artifactId>jmh-generator-annprocess</artifactId>
                    <version>${jmh.version}</version>
                </dependency>
                <dependency>
                    <groupId>ch.qos.logback</groupId>
                    <artifactId>logback-classic</artifactId>
                    <version>${logback.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.mariadb.jdbc</groupId>
                    <artifactId>mariadb-java-client</artifactId>
                    <version>${mariadb-jdbc.version}</version>
                </dependency>
            </dependencies>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>3.0.0-M5</version>
                        <configuration>
                            <systemPropertyVariables>
                                <io.netty.leakDetectionLevel>DISABLED</io.netty.leakDetectionLevel>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <version>3.4.0</version>
                        <executions>
                            <execution>
                                <id>add-source</id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>add-source</goal>
                                </goals>
                                <configuration>
                                    <sources>
                                        <source>src/benchmark/java</source>
                                    </sources>
                                </configuration>
                            </execution>
                            <execution>
                                <id>add-resource</id>
                                <phase>generate-resources</phase>
                                <goals>
                                    <goal>add-resource</goal>
                                </goals>
                                <configuration>
                                    <resources>
                                        <resource>
                                            <directory>src/benchmark/resources</directory>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-shade-plugin</artifactId>
                        <version>3.2.4</version>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>shade</goal>
                                </goals>
                                <configuration>
                                    <finalName>${uberjar.name}</finalName>
                                    <transformers>
                                        <transformer
                                                implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                            <mainClass>org.openjdk.jmh.Main</mainClass>
                                        </transformer>
                                    </transformers>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
