<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>

    <!-- NOTE(kklisura): Do not add parent tag here, since it gets deployed (via mvn deploy)[at least on snapshot repo],
         so clients won't be able to pull it unless parent is also deployed -->

    <groupId>ai.platon.cdt</groupId>
    <artifactId>cdt-kotlin-client</artifactId>
    <!-- match browser4base-4.8.x -->
    <version>4.8.0</version>
    <packaging>jar</packaging>

    <name>cdt-kotlin-client</name>
    <description>Chrome DevTools Kotlin client</description>
    <url>https://github.com/galaxyeye/chrome-devtools-kotlin-client</url>

    <developers>
        <developer>
            <name>Vincent Zhang</name>
            <email>ivincent.zhang@gmail.com</email>
            <organization>browser4.io</organization>
            <timezone>+8</timezone>
        </developer>
    </developers>

    <organization>
        <name>browser4.io</name>
        <url>https://browser4.io</url>
    </organization>

    <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>

    <scm>
        <connection>scm:git:git://github.com/galaxyeye/chrome-devtools-kotlin-client.git</connection>
        <developerConnection>scm:git:ssh://github.com/galaxyeye/chrome-devtools-kotlin-client.git</developerConnection>
        <url>https://github.com/galaxyeye/chrome-devtools-kotlin-client</url>
    </scm>

    <distributionManagement>
        <repository>
            <id>central</id>
            <url>https://central.sonatype.com/api/v1/publisher</url>
        </repository>
    </distributionManagement>

    <repositories>
        <repository>
            <id>Central</id>
            <url>https://repo1.maven.org/maven2/</url>
        </repository>
    </repositories>

    <!-- Required by dokka-maven-plugin -->
    <pluginRepositories>
        <pluginRepository>
            <id>jcenter</id>
            <name>JCenter</name>
            <url>https://jcenter.bintray.com/</url>
        </pluginRepository>
    </pluginRepositories>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-bom</artifactId>
                <version>${kotlin.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib-jdk8</artifactId>
            <version>${kotlin.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>2.21</version>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.3.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                                <configuration>
                                    <includes>
                                        <include>src/main/java/**</include>
                                        <include>src/main/kotlin/**</include>
                                    </includes>
                                    <excludes>
                                        <exclude>target/**</exclude>
                                    </excludes>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.6.3</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                                <configuration>
                                    <doclint>none</doclint>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.1.0</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>${central-publishing-maven-plugin.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                            <autoPublish>true</autoPublish>
                            <waitForPublishCompletion>true</waitForPublishCompletion>
                        </configuration>
                    </plugin>

                </plugins>
            </build>
        </profile>
    </profiles>

    <build>
        <resources>
            <resource>
                <includes>
                    <include>LICENSE.txt</include>
                    <include>THIRD-PARTY.txt</include>
                </includes>
                <directory>.</directory>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <!-- This plugin is also present in cdt-java-client, so be sure to copy any changes here to that module as well -->
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>2.0.0</version>
                <executions>
                    <execution>
                        <id>update-file-header</id>
                        <goals>
                            <goal>update-file-header</goal>
                        </goals>
                        <phase>process-sources</phase>
                    </execution>
                    <execution>
                        <id>attach-licenses</id>
                        <goals>
                            <goal>update-project-license</goal>
                            <goal>add-third-party</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <outputDirectory>${project.basedir}</outputDirectory>
                    <canUpdateCopyright>true</canUpdateCopyright>
                    <failOnMissing>true</failOnMissing>
                    <licenseName>apache_v2</licenseName>
                    <useMissingFile>true</useMissingFile>
                    <skipUpdateLicense>true</skipUpdateLicense>
                    <excludes>
                        <exclude>**/*.json</exclude>
                    </excludes>
                    <roots>
                        <root>src/main/java</root>
                        <root>src/test</root>
                    </roots>
                    <licenseMerges>
                        <licenseMerge>The Apache Software License, Version 2.0|Apache License, Version 2.0|Apache
                            Public License 2.0|Apache 2|Apache 2.0|Apache License 2.0|Apache License
                        </licenseMerge>
                        <licenseMerge>Eclipse Public License v1.0|Eclipse Public License 1.0|Eclipse Public License
                            - v 1.0
                        </licenseMerge>
                        <licenseMerge>BSD 3-Clause License|BSD|New BSD License</licenseMerge>
                        <licenseMerge>Dual license consisting of the CDDL v1.1 and GPL v2|CDDL+GPL</licenseMerge>
                    </licenseMerges>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.coveo</groupId>
                <artifactId>fmt-maven-plugin</artifactId>
                <version>2.9.1</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>format</goal>
                        </goals>
                        <phase>process-sources</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <version>${kotlin.version}</version>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <sourceDirs>
                                <source>src/main/kotlin</source>
                            </sourceDirs>
                        </configuration>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                        <configuration>
                            <sourceDirs>
                                <source>src/test/kotlin</source>
                            </sourceDirs>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <jvmTarget>${maven.compiler.target}</jvmTarget>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${version.maven-compiler-plugin}</version>
                <configuration>
                    <source>${javac.src.version}</source>
                    <target>${javac.target.version}</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.jetbrains.dokka</groupId>
                <artifactId>dokka-maven-plugin</artifactId>
                <version>${dokka.version}</version>
                <executions>
                    <execution>
                        <!-- generate javadoc.jar before package gpg plugin can generate asc for it -->
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>dokka</goal>
                            <goal>javadocJar</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <!-- Set to true to skip dokka task, default: false -->
                    <skip>false</skip>

                    <!-- Use default or set to custom path to cache directory to enable package-list caching. -->
                    <!-- When set to default, caches stored in $USER_HOME/.cache/dokka -->
                    <cacheRoot>default</cacheRoot>

                    <!-- Used for linking to JDK, default: 11 -->
                    <jdkVersion>11</jdkVersion>

                    <!-- Do not output deprecated members, applies globally, can be overridden by packageOptions -->
                    <skipDeprecated>true</skipDeprecated>
                    <!-- Emit warnings about not documented members, applies globally, also can be overridden by packageOptions -->
                    <reportUndocumented>true</reportUndocumented>
                    <!-- Do not create index pages for empty packages -->
                    <skipEmptyPackages>false</skipEmptyPackages>
                    <includeNonPublic>false</includeNonPublic>

                    <!-- Short form list of sourceRoots, by default, set to ${project.compileSourceRoots} -->
                    <sourceDirectories>
                        <dir>${project.basedir}/src/main/java</dir>
                        <dir>${project.basedir}/src/main/kotlin</dir>
                    </sourceDirectories>

                    <!-- Disable linking to online kotlin-stdlib documentation  -->
                    <noStdlibLink>false</noStdlibLink>
                    <noJdkLink>false</noJdkLink>

                    <!-- Allows to customize documentation generation options on a per-package basis -->
                    <perPackageOptions>
                        <packageOptions>
                            <!-- Will match kotlin and all sub-packages of it -->
                            <!-- <prefix>kotlin</prefix>-->

                            <!-- All options are optional, default values are below: -->
                            <skipDeprecated>false</skipDeprecated>
                            <!-- Emit warnings about not documented members  -->
                            <reportUndocumented>true</reportUndocumented>
                            <includeNonPublic>false</includeNonPublic>
                        </packageOptions>
                    </perPackageOptions>
                </configuration>
            </plugin>
            <!-- GPG signing -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>${maven-gpg-plugin.version}</version>
                <configuration>
                    <gpgArguments>
                        <arg>--pinentry-mode</arg>
                        <arg>loopback</arg>
                    </gpgArguments>
                </configuration>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Calculate checksums -->
            <plugin>
                <groupId>net.nicoulaj.maven.plugins</groupId>
                <artifactId>checksum-maven-plugin</artifactId>
                <version>${checksum-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>source-release-checksum</id>
                        <goals>
                            <goal>files</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <algorithms>
                        <algorithm>SHA-512</algorithm>
                        <algorithm>SHA-256</algorithm>
                    </algorithms>
                    <csvSummary>false</csvSummary>
                    <fileSets>
                        <fileSet>
                            <directory>${project.build.directory}</directory>
                            <includes>
                                <include>${project.artifactId}-${project.version}-sources.jar</include>
                                <include>${project.artifactId}-${project.version}-javadoc.jar</include>
                                <include>${project.artifactId}-${project.version}.jar</include>
                            </includes>
                        </fileSet>
                    </fileSets>
                    <failIfNoFiles>false</failIfNoFiles>
                </configuration>
            </plugin>

        </plugins>
    </build>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.inceptionYear>2025</project.inceptionYear>

        <javac.src.version>17</javac.src.version>
        <javac.target.version>17</javac.target.version>
        <maven.compiler.target>17</maven.compiler.target>
        <kotlin.version>2.2.20</kotlin.version>
        <kotlin.coroutine.version>1.10.2</kotlin.coroutine.version>
        <kotlin.compiler.incremental>true</kotlin.compiler.incremental>

        <jackson.version>2.21.3</jackson.version>

        <dokka.version>2.2.0</dokka.version>
        <version.maven-compiler-plugin>3.14.1</version.maven-compiler-plugin>
        <maven.surefire.plugin.version>3.2.5</maven.surefire.plugin.version>
        <maven-gpg-plugin.version>3.1.0</maven-gpg-plugin.version>
        <version.checksum-maven-plugin>1.11</version.checksum-maven-plugin>
        <checksum-maven-plugin.version>1.11</checksum-maven-plugin.version>
        <central-publishing-maven-plugin.version>0.10.0</central-publishing-maven-plugin.version>
    </properties>

</project>
