<?xml version="1.0" encoding="UTF-8"?>
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
	license agreements. See the NOTICE file distributed with this work for additional
	information regarding copyright ownership. The ASF licenses this file to
	you under the Apache License, Version 2.0 (the "License"); you may not use
	this file except in compliance with the License. You may obtain a copy of
	the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
	by applicable law or agreed to in writing, software distributed under the
	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
	OF ANY KIND, either express or implied. See the License for the specific
	language governing permissions and limitations under the License. -->
<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>

    <parent>
        <groupId>ai.platon</groupId>
        <artifactId>pulsar-parent</artifactId>
        <version>4.3.0</version>
        <relativePath>pulsar-parent/pom.xml</relativePath>
    </parent>

    <groupId>ai.platon.pulsar</groupId>
    <artifactId>pulsar</artifactId>
    <packaging>pom</packaging>

    <name>Browser4</name>
    <description>A lightning-fast, coroutine-safe browser for your AI.</description>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Vincent Zhang</name>
            <email>ivincent.zhang@gmail.com</email>
            <organization>browser4.io</organization>
            <timezone>+8</timezone>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:https://github.com/platonai/browser4.git</connection>
        <developerConnection>scm:git:https://github.com/platonai/browser4.git</developerConnection>
        <url>https://github.com/platonai/browser4</url>
        <tag>HEAD</tag>
    </scm>

    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/platonai/browser4/issues</url>
    </issueManagement>

    <ciManagement>
        <system>GitHub Actions</system>
        <url>https://github.com/platonai/browser4/actions</url>
    </ciManagement>

    <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>

    <!-- Default active modules. The main goal is to allow the user to run PulsarApplication
     with a single click in the IDE right after opening the project. -->
    <modules>
        <module>pulsar-parent</module>
        <module>pulsar-dependencies</module>
        <module>pulsar-core</module>
        <module>pulsar-rest</module>
        <module>pulsar-client</module>
        <module>pulsar-tests-common</module>
        <module>pulsar-tests</module>
        <module>pulsar-bom</module>
    </modules>

    <profiles>
        <profile>
            <id>examples</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <modules>
                <module>browser4/browser4-agents</module>
                <module>browser4/browser4-spa</module>
                <module>examples/browser4-examples</module>
                <module>examples/java-compatible</module>
            </modules>
        </profile>

        <!-- CI profile -->
        <profile>
            <id>ci</id>
            <properties>
                <skipTests>false</skipTests>
                <maven.test.failure.ignore>false</maven.test.failure.ignore>
            </properties>
            <build>
                <plugins>
                    <!--用于 Maven 项目中收集和生成 Java 代码的测试覆盖率报告 -->
                    <!-- instruction covered ratio is expected minimum is 0.70 -->
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>${jacoco-maven-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>report-aggregate</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>report-aggregate</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <dataFile>${project.build.directory}/jacoco.exec</dataFile>
                            <outputDirectory>${project.reporting.outputDirectory}/jacoco</outputDirectory>
                            <skip>false</skip>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Deployment profile -->
        <profile>
            <id>deploy</id>
            <properties>
                <deploy-active>true</deploy-active>
            </properties>
            <modules>
                <module>pulsar-parent</module>
                <module>pulsar-dependencies</module>
                <module>pulsar-core</module>

                <module>pulsar-tests-common</module>
                <module>pulsar-tests</module>
                <module>pulsar-client</module>
                <module>pulsar-bom</module>
            </modules>

            <build>
                <plugins>
                    <!-- Attach sources -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Help maven-source-plugin works with kotlin -->
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <version>3.6.0</version>

                        <executions>
                            <execution>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>add-source</goal>
                                </goals>
                                <configuration>
                                    <sources>
                                        <source>src/main/kotlin</source>
                                    </sources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Override parent pom's javadoc settings, skip generating javadoc, use kdoc instead -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <configuration>
                            <skip>true</skip>
                        </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 a dokka task, default: false -->
                            <skip>false</skip>

                            <!-- Use default or set to a 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>${javaVersion}</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>true</skipEmptyPackages>
                            <includeNonPublic>false</includeNonPublic>


                            <!-- 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>
                            <sourceDirectories>
                                <dir>${project.basedir}/src/main/kotlin</dir>
                            </sourceDirectories>
                        </configuration>
                    </plugin>

                    <!-- GPG signing -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <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>
                        <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>

                    <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>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <build>
        <defaultGoal>install</defaultGoal>
        <directory>target</directory>
        <finalName>${project.artifactId}-${project.version}</finalName>

        <plugins>
            <!--  kotlin plugin should come before maven-compiler-plugin  -->

            <!--  kotlin  -->
            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <version>${kotlin.version}</version>
                <!-- You can set this option to automatically take information about lifecycles -->
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <id>compile</id>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <sourceDirs>
                                <sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
                                <sourceDir>${project.basedir}/src/main/java</sourceDir>
                            </sourceDirs>
                        </configuration>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                        <configuration>
                            <sourceDirs>
                                <sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
                                <sourceDir>${project.basedir}/src/test/java</sourceDir>
                            </sourceDirs>
                        </configuration>
                    </execution>
                </executions>
                <!--  Required by spring  -->
                <dependencies>
                    <dependency>
                        <groupId>org.jetbrains.kotlin</groupId>
                        <artifactId>kotlin-maven-allopen</artifactId>
                        <version>${kotlin.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.jetbrains.kotlin</groupId>
                        <artifactId>kotlin-maven-noarg</artifactId>
                        <version>${kotlin.version}</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <args>
                        <arg>-Xjsr305=strict</arg>
                    </args>
                    <compilerPlugins>
                        <plugin>spring</plugin>
                        <plugin>jpa</plugin>
                        <plugin>all-open</plugin>
                    </compilerPlugins>
                    <pluginOptions>
                        <option>all-open:annotation=javax.persistence.Entity</option>
                        <option>all-open:annotation=javax.persistence.Embeddable</option>
                        <option>all-open:annotation=javax.persistence.MappedSuperclass</option>
                    </pluginOptions>
                    <jvmTarget>${kotlin.compiler.jvmTarget}</jvmTarget>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.owasp</groupId>
                <artifactId>dependency-check-maven</artifactId>
                <version>7.0.1</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>

            <!--
            The Surefire Plugin is used during the test phase of the build lifecycle to execute the unit tests of
            an application.
            see https://maven.apache.org/surefire/maven-surefire-plugin/
            -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <!--

                    -->
                    <excludedGroups>${surefire.excludedGroups}</excludedGroups>
                    <!-- All tests are in the same JVM process -->
                    <forkCount>1</forkCount>
                    <reuseForks>true</reuseForks>
                    <!-- Enable byte-buddy-agent -->
                    <argLine>-XX:+EnableDynamicAgentLoading</argLine>
                    <useModulePath>false</useModulePath>
                </configuration>

<!--                <dependencies>-->
<!--                    <dependency>-->
<!--                        <groupId>org.junit.jupiter</groupId>-->
<!--                        <artifactId>junit-jupiter-engine</artifactId>-->
<!--                        <version>${junit5.version}</version>-->
<!--                    </dependency>-->
<!--                </dependencies>-->
            </plugin>
        </plugins>
    </build>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>ai.platon</groupId>
                <artifactId>pulsar-dependencies</artifactId>
                <version>${project.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!-- Internal Dependencies -->
            <dependency>
                <groupId>ai.platon.pulsar</groupId>
                <artifactId>pulsar-common</artifactId>
                <version>${project.version}</version>
            </dependency>

            <dependency>
                <groupId>ai.platon.pulsar</groupId>
                <artifactId>pulsar-plugins</artifactId>
                <type>pom</type>
                <version>${project.version}</version>
            </dependency>

            <dependency>
                <groupId>ai.platon.pulsar</groupId>
                <artifactId>pulsar-persist</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>ai.platon.pulsar</groupId>
                <artifactId>pulsar-skeleton</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>ai.platon.pulsar</groupId>
                <artifactId>pulsar-resources</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>ai.platon.pulsar</groupId>
                <artifactId>pulsar-resources</artifactId>
                <type>test-jar</type>
                <classifier>tests</classifier>
                <scope>test</scope>
                <version>${project.version}</version>
            </dependency>

            <dependency>
                <groupId>ai.platon.pulsar</groupId>
                <artifactId>pulsar-protocol</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>ai.platon.pulsar</groupId>
                <artifactId>pulsar-parse</artifactId>
                <version>${project.version}</version>
            </dependency>

            <dependency>
                <groupId>ai.platon.pulsar</groupId>
                <artifactId>pulsar-browser</artifactId>
                <version>${project.version}</version>
            </dependency>

            <dependency>
                <groupId>ai.platon.pulsar</groupId>
                <artifactId>pulsar-llm</artifactId>
                <version>${project.version}</version>
            </dependency>

            <dependency>
                <groupId>ai.platon.pulsar</groupId>
                <artifactId>pulsar-dom</artifactId>
                <version>${project.version}</version>
            </dependency>

            <dependency>
                <groupId>ai.platon.pulsar</groupId>
                <artifactId>pulsar-beans</artifactId>
                <version>${project.version}</version>
            </dependency>

            <dependency>
                <groupId>ai.platon.pulsar</groupId>
                <artifactId>pulsar-ql-common</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>ai.platon.pulsar</groupId>
                <artifactId>pulsar-ql-common</artifactId>
                <classifier>shaded</classifier>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>ai.platon.pulsar</groupId>
                <artifactId>pulsar-ql</artifactId>
                <version>${project.version}</version>
            </dependency>

            <dependency>
                <groupId>ai.platon.pulsar</groupId>
                <artifactId>pulsar-agentic</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>ai.platon.pulsar</groupId>
                <artifactId>pulsar-rest</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>ai.platon.pulsar</groupId>
                <artifactId>pulsar-boot</artifactId>
                <version>${project.version}</version>
            </dependency>

            <dependency>
                <groupId>ai.platon.pulsar</groupId>
                <artifactId>pulsar-qa</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>ai.platon.pulsar</groupId>
                <artifactId>pulsar-qa</artifactId>
                <version>${project.version}</version>
                <type>test-jar</type>
                <classifier>tests</classifier>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>ai.platon.pulsar</groupId>
                <artifactId>pulsar-tests-common</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>ai.platon.pulsar</groupId>
                <artifactId>pulsar-tests-common</artifactId>
                <classifier>tests</classifier>
                <scope>test</scope>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>ai.platon.pulsar</groupId>
                <artifactId>pulsar-tests</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>ai.platon.pulsar</groupId>
                <artifactId>pulsar-tests</artifactId>
                <version>${project.version}</version>
                <type>test-jar</type>
                <classifier>tests</classifier>
                <scope>test</scope>
            </dependency>

        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-reflect</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlinx</groupId>
            <artifactId>kotlinx-coroutines-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-test-junit5</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <properties>

        <surefire.excludedGroups>
            TimeConsumingTest,ExternalResourceDependent,IntegrationTest,E2ETest,HeavyTest,
            SkippableLowerLevelTest,TestInfraCheck,MustManuallyRun,OptionalTest
        </surefire.excludedGroups>

        <jacoco-maven-plugin.version>0.8.11</jacoco-maven-plugin.version>
        <central-publishing-maven-plugin.version>0.9.0</central-publishing-maven-plugin.version>

        <dokka.version>1.9.10</dokka.version>

        <!--  Language  -->
        <javaVersion>17</javaVersion>
        <kotlinVersion>2.2.21</kotlinVersion>

        <!--  Kotlin  -->
        <kotlin.version>${kotlinVersion}</kotlin.version>
        <maven.compiler.release>${javaVersion}</maven.compiler.release>
        <kotlin.compiler.jvmTarget>${javaVersion}</kotlin.compiler.jvmTarget>
    </properties>

</project>
