<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ This Original Work is copyright of 51 Degrees Mobile Experts Limited.
  ~ Copyright 2022 51 Degrees Mobile Experts Limited, Davidson House,
  ~ Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
  ~
  ~ This Original Work is licensed under the European Union Public Licence
  ~  (EUPL) v.1.2 and is subject to its terms as set out below.
  ~
  ~  If a copy of the EUPL was not distributed with this file, You can obtain
  ~  one at https://opensource.org/licenses/EUPL-1.2.
  ~
  ~  The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
  ~  amended by the European Commission) shall be deemed incompatible for
  ~  the purposes of the Work and the provisions of the compatibility
  ~  clause in Article 5 of the EUPL shall not apply.
  ~
  ~   If using the Work as, or as part of, a network application, by
  ~   including the attribution notice(s) required under Article 5 of the EUPL
  ~   in the end user terms of the application under an appropriate heading,
  ~   such notice(s) shall fulfill the requirements of that article.
  -->

<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>
    <properties>
        <!-- Selenium ships Java 11 class files from 4.14.0 onwards, so the
             browser tests are built and run on the Java 11+ legs only. See
             the profiles at the end of this file. -->
        <selenium.version>4.46.0</selenium.version>
    </properties>
    <parent>
        <groupId>com.51degrees</groupId>
        <artifactId>pipeline</artifactId>
        <version>4.5.13</version>
    </parent>
    <artifactId>pipeline.javascriptbuilder</artifactId>
    <packaging>jar</packaging>

    <name>51Degrees :: Pipeline :: Java Script Builder</name>
    <url>https://51degrees.com?utm_source=maven&amp;utm_medium=package&amp;utm_campaign=pipeline-java&amp;utm_content=pipeline.javascriptbuilder-pom.xml&amp;utm_term=url</url>

    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>pipeline.jsonbuilder</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>com.github.spullara.mustache.java</groupId>
            <artifactId>compiler</artifactId>
            <version>${mustache-compiler.version}</version>
        </dependency>
        <dependency>
            <groupId>org.graalvm.js</groupId>
            <artifactId>js-scriptengine</artifactId>
            <version>${graal-js-scriptengine.version}</version>
        </dependency>
        <dependency>
            <groupId>org.graalvm.js</groupId>
            <artifactId>js</artifactId>
            <version>${graal-js.version}</version>
        </dependency>

        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>pipeline.engines</artifactId>
            <version>${project.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>pipeline.common</artifactId>
            <version>${project.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
        </dependency>
    </dependencies>

    <profiles>
        <!-- Selenium 4.14.0 moved to Java 11 class files, and the last release
             that still runs on Java 8 (4.13.0) bundles a Selenium Manager that
             pairs a stale cached ChromeDriver with current Chrome, failing with
             "This version of ChromeDriver only supports Chrome version NNN".
             There is therefore no Selenium version that both compiles on Java 8
             and drives a current browser, so JavaScriptBuilderTests is built and
             run on Java 11+ only. Every test in that class needs a browser: it
             starts a ChromeDriver in Init() and quits it in Cleanup(). -->
        <profile>
            <id>jdk11-selenium</id>
            <activation>
                <jdk>[11,)</jdk>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>org.seleniumhq.selenium</groupId>
                    <artifactId>selenium-java</artifactId>
                    <version>${selenium.version}</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>

        <!-- On Java 8 the Selenium tests are dropped at test *compilation*, not
             just from the test run: javac fails reading the Java 11 class files
             ("class file has wrong version 55.0, should be 52.0") long before
             surefire is reached, so a surefire <excludes> alone would not help.
             The module's other tests are unaffected. -->
        <profile>
            <id>jdk8-no-selenium</id>
            <activation>
                <jdk>(,11)</jdk>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <configuration>
                            <testExcludes>
                                <testExclude>**/JavaScriptBuilderTests.java</testExclude>
                            </testExcludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>