<?xml version="1.0" encoding="UTF-8"?>
<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>com.atlassian.oauth2</groupId>
        <artifactId>oauth2-client-parent</artifactId>
        <version>4.1.6</version>
    </parent>

    <artifactId>oauth2-client-plugin</artifactId>
    <packaging>atlassian-plugin</packaging>

    <name>Atlassian OAuth 2 Client - Plugin</name>
    <description>Plugin for Atlassian OAuth 2 Client</description>

    <properties>
        <bamboo.buildKey>UNKNOWN</bamboo.buildKey>
        <atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
        <nodeVersion>v14.21.3</nodeVersion>
        <yarnVersion>v1.22.19</yarnVersion>
        <yarn.cmd.install.dev>install --pure-lockfile --prefer-offline --mutex network</yarn.cmd.install.dev>
        <yarn.cmd.install>install --frozen-lockfile --prefer-offline --mutex network --no-progress</yarn.cmd.install>
        <yarn.cmd.build>build</yarn.cmd.build>
        <yarn.cmd.build.dev>build:dev</yarn.cmd.build.dev>
        <eirslett.frontend.version>1.12.1</eirslett.frontend.version>
        <frontend.maven.plugin.install.directory>${project.build.directory}</frontend.maven.plugin.install.directory>
        <frontend.working.directory>frontend</frontend.working.directory>
        <jvm.args.custom /> <!-- Allows to specify custom arguments in build scripts -->
        <!-- KRAK-3251 -->
        <product.jvmArgs>-Djavax.net.ssl.trustStore=${project.build.testOutputDirectory}/keycloak/cacerts -Djavax.net.ssl.trustStorePassword=changeit -Xms1g -Xmx4g ${jvm.args.custom}</product.jvmArgs>

        <product.httpsPort>8443</product.httpsPort>
        <product.useHttps>true</product.useHttps>
        <product.httpsKeystoreFile>${project.build.testOutputDirectory}/keycloak/tomcat.keystore</product.httpsKeystoreFile>
        <product.httpsKeystorePass>changeit</product.httpsKeystorePass>
        <product.httpsKeyAlias>tomcat</product.httpsKeyAlias>
        <product.httpsSslProtocol>TLS</product.httpsSslProtocol>
        <browserstack.project>Atlassian-oauth x-browser tests</browserstack.project>
        <browserstack.name>Edge Legacy - ${bamboo.buildKey}</browserstack.name>
        <browserstack.browser>edge</browserstack.browser>
        <browserstack.browser.version>${edge.legacy.version}</browserstack.browser.version>
        <browserstack.os>windows</browserstack.os>
        <browserstack.os.version>10</browserstack.os.version>
        <browserstack.idleTimeout>300</browserstack.idleTimeout>
        <edge.legacy.version>18</edge.legacy.version>
        <edge.chromium.version>80</edge.chromium.version>
        <chrome.version>80</chrome.version>
        <safari.version>13</safari.version>
        <firefox.version>74</firefox.version>
    </properties>

    <dependencies>
        <!-- Module dependencies -->
        <dependency>
            <groupId>com.atlassian.oauth2</groupId>
            <artifactId>oauth2-client-api</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.oauth2</groupId>
            <artifactId>oauth2-client-core</artifactId>
            <version>${project.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.oauth2</groupId>
            <artifactId>oauth2-client-rest</artifactId>
            <version>${project.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.oauth2</groupId>
            <artifactId>oauth2-common</artifactId>
            <version>${project.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.annotations</groupId>
            <artifactId>atlassian-annotations</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.nimbusds</groupId>
            <artifactId>oauth2-oidc-sdk</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-webresource</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.json</groupId>
            <artifactId>atlassian-json-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.analytics</groupId>
            <artifactId>analytics-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.soy</groupId>
            <artifactId>soy-template-renderer-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.seraph</groupId>
            <artifactId>atlassian-seraph</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.activeobjects</groupId>
            <artifactId>activeobjects-plugin</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-osgi-javaconfig</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.framework</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.sal</groupId>
            <artifactId>sal-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.scheduler</groupId>
            <artifactId>atlassian-scheduler-api</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.event</groupId>
            <artifactId>atlassian-event</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Test Dependencies -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.github.stefanbirkner</groupId>
            <artifactId>system-rules</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.keycloak</groupId>
            <artifactId>keycloak-admin-client</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-client</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jackson2-provider</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.awaitility</groupId>
            <artifactId>awaitility</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.selenium</groupId>
            <artifactId>atlassian-webdriver-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.reflections</groupId>
            <artifactId>reflections</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.testutils</groupId>
            <artifactId>atlassian-test-annotations</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <version>${eirslett.frontend.version}</version>
                <configuration>
                    <nodeVersion>${nodeVersion}</nodeVersion>
                    <yarnVersion>${yarnVersion}</yarnVersion>
                    <installDirectory>${frontend.maven.plugin.install.directory}</installDirectory>
                    <workingDirectory>${frontend.working.directory}</workingDirectory>
                </configuration>
                <executions>
                    <execution>
                        <id>install-node-and-yarn</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>install-node-and-yarn</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>install-prod-dependencies</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>yarn</goal>
                        </goals>
                        <configuration>
                            <arguments>${yarn.cmd.install}</arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>compile-the-ui</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>yarn</goal>
                        </goals>
                        <configuration>
                            <arguments>${yarn.cmd.build}</arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>yarn type-check</id>
                        <goals>
                            <goal>yarn</goal>
                        </goals>
                        <configuration>
                            <arguments>run type-check</arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>run-tests</id>
                        <phase>test</phase>
                        <goals>
                            <goal>yarn</goal>
                        </goals>
                        <configuration>
                            <arguments>test</arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>amps-maven-plugin</artifactId>
                <version>${amps.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <enableQuickReload>true</enableQuickReload>
                    <quickReloadVersion>${amps.quickreload.version}</quickReloadVersion>
                    <processI18nUsage>false</processI18nUsage>
                    <log4jProperties>src/main/resources/log4j-oauth2.properties</log4jProperties>

                    <includedFeModuleManifests>
                        <!-- Required to know what is development only & useful for other future projects -->
                        <includedFeModuleManifest>${project.basedir}/package.json</includedFeModuleManifest>
                        <!-- Required so all versions of all transitive dependencies are declared -->
                        <includedFeModuleManifest>${project.basedir}/yarn.lock</includedFeModuleManifest>
                    </includedFeModuleManifests>

                    <libArtifacts>
                        <libArtifact>
                            <groupId>com.atlassian.oauth2</groupId>
                            <artifactId>oauth2-client-api</artifactId>
                            <version>${project.version}</version>
                        </libArtifact>
                    </libArtifacts>

                    <instructions>
                        <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
                        <Atlassian-Scan-Folders>META-INF/plugin-descriptors</Atlassian-Scan-Folders>
                        <Import-Package>
                            org.springframework.osgi.*;resolution:="optional",
                            org.eclipse.gemini.blueprint.*;resolution:="optional",
                            com.atlassian.analytics.api.*;resolution:="optional",
                            com.atlassian.seraph.*;resolution:="optional",
                            com.atlassian.oauth2.client.api.*,
                            com.atlassian.sal.*;resolution:="optional",
                            com.atlassian.plugins.osgi.javaconfig.*;resolution:="optional",
                            com.atlassian.bamboo.*;resolution:="optional",
                            org.slf4j.*;resolution:="optional",
                            io.atlassian.util.concurrent*;resolution:="optional",
                            org.acegisecurity.userdetails*;resolution:="optional",
                            javax.annotation;version=!,

                            <!-- exclude pocketknife bits we don't need -->
                            !net.sf.cglib.proxy,
                            !org.jvnet.hudson.annotation_indexer,
                            !com.google.gson.stream,
                            !com.google.crypto.tink.subtle,
                            !com.ibm.uvm.tools,
                            !com.sun.jdmk.comm,
                            !javax.jmdns,
                            !javax.jms,
                            !net.sf.ehcache,
                            !net.spy.memcached,
                            !net.shibboleth.*,
                            !org.apache.avalon.framework*,
                            !org.apache.log,
                            !org.cryptomator.*,
                            !sun.security.util,
                            !com.mysema.query.*,
                            !com.mysema.query.spatial.path,
                            !com.mysema.query.spatial,
                            !org.postgis,
                            !org.bouncycastle.*,
                            !org.opensaml.*,
                            !oracle.spatial.geometry,
                            !org.geolatte.geom,
                            !org.geolatte.geom.codec,
                            !org.geolatte.geom.crs,
                            !bsh,
                            !sun.misc,
                            !org.reflections*,
                            !com.sun.research.ws.wadl,
                            !com.sun.activation.registries,
                            !org.joda.time,
                            !io.grpc.override,
                            *
                        </Import-Package>
                        <Spring-Context>*</Spring-Context>
                    </instructions>

                    <systemPropertyVariables>
                        <trimStackTrace>false</trimStackTrace>
                        <es.insecure.allow.root>true</es.insecure.allow.root>
                    </systemPropertyVariables>
                    <server>localhost</server>

                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.0.2</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <skipITs>true</skipITs>
            </properties>
        </profile>
        <profile>
            <id>watch-mode</id>
            <properties>
                <yarn.cmd.install>${yarn.cmd.install.dev}</yarn.cmd.install>
                <yarn.cmd.build>${yarn.cmd.build.dev}</yarn.cmd.build>
            </properties>
        </profile>
    </profiles>
</project>
