<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.pulsar</groupId>
        <artifactId>pulsar</artifactId>
        <version>4.11.6</version>
        <relativePath>../../pom.xml</relativePath>
    </parent>

    <name>Pulsar Browser</name>
    <artifactId>pulsar-browser</artifactId>

    <dependencies>
        <dependency>
            <groupId>ai.platon.pulsar</groupId>
            <artifactId>pulsar-common</artifactId>
        </dependency>
        <dependency>
            <groupId>ai.platon.pulsar</groupId>
            <artifactId>pulsar-jsoup</artifactId>
        </dependency>
        <dependency>
            <groupId>ai.platon.cdt</groupId>
            <artifactId>cdt-kotlin-client</artifactId>
            <version>${cdt-kotlin-client.version}</version>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-yaml</artifactId>
        </dependency>

        <dependency>
            <groupId>io.dropwizard.metrics</groupId>
            <artifactId>metrics-core</artifactId>
        </dependency>

        <!-- Ktor client for coroutine-friendly WebSocket transport -->
        <dependency>
            <groupId>io.ktor</groupId>
            <artifactId>ktor-client-core</artifactId>
        </dependency>
        <dependency>
            <groupId>io.ktor</groupId>
            <artifactId>ktor-client-core-jvm</artifactId>
        </dependency>
        <dependency>
            <groupId>io.ktor</groupId>
            <artifactId>ktor-client-cio</artifactId>
        </dependency>
        <dependency>
            <groupId>io.ktor</groupId>
            <artifactId>ktor-client-cio-jvm</artifactId>
        </dependency>

        <dependency>
            <groupId>io.ktor</groupId>
            <artifactId>ktor-client-websockets</artifactId>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.javassist/javassist -->
        <dependency>
            <groupId>org.javassist</groupId>
            <artifactId>javassist</artifactId>
            <version>${javassist.version}</version>
        </dependency>

        <!-- Test dependencies: JUnit 5 and Mockito (including Kotlin bindings) -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito.kotlin</groupId>
            <artifactId>mockito-kotlin</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <properties>
        <!-- Reflect, org.javassist:javassist, required by ProxyClasses -->
        <javassist.version>3.30.2-GA</javassist.version>
        <cdt-kotlin-client.version>4.8.0</cdt-kotlin-client.version>
    </properties>

    <profiles>
        <!--
        Browser-side JS unit tests (Jest). Not part of the default build because
        they require Node.js; activate with -DrunJsTests=true (CI nightly does).
        -->
        <profile>
            <id>js-tests</id>
            <activation>
                <property>
                    <name>runJsTests</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>3.5.0</version>
                        <executions>
                            <execution>
                                <id>npm-ci</id>
                                <phase>generate-test-resources</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <workingDirectory>${project.basedir}/src/test/js</workingDirectory>
                                    <executable>npm</executable>
                                    <arguments>
                                        <argument>ci</argument>
                                    </arguments>
                                </configuration>
                            </execution>
                            <execution>
                                <id>jest-tests</id>
                                <phase>test</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <workingDirectory>${project.basedir}/src/test/js</workingDirectory>
                                    <executable>npm</executable>
                                    <arguments>
                                        <argument>test</argument>
                                        <argument>--</argument>
                                        <argument>--ci</argument>
                                    </arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
