<?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.bitbucket.server</groupId>
        <artifactId>bitbucket-plugins-parent</artifactId>
        <version>4.14.0-dev3</version>
    </parent>

    <artifactId>bitbucket-plugin-util</artifactId>
    <packaging>bundle</packaging>
    <name>Bitbucket Server - Plugin Utilities</name>
    <description>Provides additional utilities for plugin developers</description>

    <build>
        <!-- This is needed as we do not use AMPS to build this plugin, otherwise AMPS would take care of it -->
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>*.xml</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
                <excludes>
                    <exclude>*.xml</exclude>
                </excludes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Atlassian-Plugin-Key>${project.groupId}.${project.artifactId}</Atlassian-Plugin-Key>
                        <Bundle-SymbolicName>com.atlassian.bitbucket.plugin.util</Bundle-SymbolicName>
                        <Export-Package>
                            com.atlassian.bitbucket.plugin.util*
                        </Export-Package>
                        <Import-Package>
                            com.atlassian.event*,
                            com.atlassian.plugin*,
                            javax.annotation,
                            org.springframework.beans*;version="${spring.osgi.import.version}",
                            org.springframework.context*;version="${spring.osgi.import.version}",
                            org.springframework.core;version="${spring.osgi.import.version}",
                            org.slf4j;version="${slf4j.libversion}",
                        </Import-Package>
                        <Spring-Context>*</Spring-Context>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-core</artifactId>
            <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>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <!-- Instrumented classes include Clover references.
                 When running Clover, don't stress about bundle definitions -->
            <id>clover</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.felix</groupId>
                        <artifactId>maven-bundle-plugin</artifactId>
                        <configuration>
                            <instructions>
                                <Import-Package>
                                    *;resolution:=optional,
                                </Import-Package>
                            </instructions>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>api-compat</id>
            <activation>
                <property>
                    <name>api-compat</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.atlassian.maven.plugins</groupId>
                        <artifactId>api-compat-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
