<?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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <artifactId>atlassian-profiling-base</artifactId>
        <groupId>com.atlassian.profiling</groupId>
        <version>7.0.0</version>
    </parent>

    <artifactId>atlassian-profiling-adaptor-plugin</artifactId>

    <name>Atlassian Profiling - API Adaptor Plugin</name>

    <description>An adaptor plugin that provides the implementation for the external facing API</description>
    <packaging>atlassian-plugin</packaging>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.atlassian.platform.dependencies</groupId>
                <artifactId>platform-public-api</artifactId>
                <version>${platform.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>com.atlassian.platform.dependencies</groupId>
                <artifactId>platform-internal-api</artifactId>
                <version>${platform.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>com.atlassian.platform.dependencies</groupId>
                <artifactId>platform-test-resources</artifactId>
                <version>${platform.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <!-- provided by platform-public-api -->
        <dependency>
            <groupId>com.atlassian.profiling</groupId>
            <artifactId>atlassian-profiling-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.profiling</groupId>
            <artifactId>atlassian-profiling</artifactId>
            <scope>provided</scope>
        </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>
            <scope>provided</scope>
        </dependency>
        <!-- provided by platform-internal-api -->
        <dependency>
            <groupId>jakarta.ws.rs</groupId>
            <artifactId>jakarta.ws.rs-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- OSGi Java Config dependencies -->
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-osgi-javaconfig</artifactId>
            <version>${osgi.javaconfig.version}</version>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>osgi.core</artifactId>
            <version>6.0.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.profiling</groupId>
            <artifactId>atlassian-profiling-micrometer</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <scope>test</scope>
        </dependency>


        <!-- WIRED TEST RUNNER DEPENDENCIES -->
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-osgi-testrunner</artifactId>
            <version>${plugin.testrunner.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.core</groupId>
            <artifactId>jersey-client</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>amps-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <productVersion>${refapp.version}</productVersion>
                    <containerId>tomcat10x</containerId>
                    <output>${project.build.directory}/refapp.log</output>
                    <enableQuickReload>true</enableQuickReload>
                    <systemPropertyVariables>
                        <refapp.profiling.enabled>true</refapp.profiling.enabled>
                    </systemPropertyVariables>
                    <libArtifacts>
                        <libArtifact>
                            <groupId>com.atlassian.profiling</groupId>
                            <artifactId>atlassian-profiling-api</artifactId>
                            <version>${project.version}</version>
                        </libArtifact>
                        <libArtifact>
                            <groupId>com.atlassian.profiling</groupId>
                            <artifactId>atlassian-profiling</artifactId>
                            <version>${project.version}</version>
                        </libArtifact>
                        <libArtifact>
                            <groupId>com.atlassian.profiling</groupId>
                            <artifactId>atlassian-profiling-micrometer</artifactId>
                            <version>${project.version}</version>
                        </libArtifact>
                    </libArtifacts>

                    <!-- See here for an explanation of default instructions: -->
                    <!-- https://developer.atlassian.com/docs/advanced-topics/configuration-of-instructions-in-atlassian-plugins -->
                    <instructions>
                        <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
                        <Bundle-SymbolicName>${atlassian.plugin.key}</Bundle-SymbolicName>

                        <!-- Add packages to export here -->
                        <Export-Package>
                        </Export-Package>

                        <!-- Add package import here -->
                        <Import-Package>
                            org.springframework.osgi.*;resolution:="optional",
                            org.eclipse.gemini.blueprint.*;resolution:="optional",
                            *
                        </Import-Package>

                        <!-- Ensure plugin is spring powered -->
                        <Spring-Context>*</Spring-Context>
                    </instructions>
                    <testInstructions>
                        <Atlassian-Plugin-Key>${atlassian.plugin.key}-tests</Atlassian-Plugin-Key>
                        <Bundle-SymbolicName>${atlassian.plugin.key}-tests</Bundle-SymbolicName>
                        <Spring-Context>*</Spring-Context>
                    </testInstructions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <configuration>
                    <argLine>
                        --add-opens=java.base/java.lang=ALL-UNNAMED
                    </argLine>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <properties>
        <refapp.version>${platform.version}</refapp.version>
        <plugin.testrunner.version>2.0.18</plugin.testrunner.version>
        <osgi.javaconfig.version>0.6.0</osgi.javaconfig.version>

        <!-- This property ensures consistency between the key in atlassian-plugin.xml and the OSGi bundle's key. -->
        <atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

</project>
