<?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>8.0.1</version>
    </parent>

    <artifactId>bitbucket-plugin-extender</artifactId>
    <packaging>bundle</packaging>

    <name>Bitbucket Server - Gemini Extender Fragment</name>
    <description>Provides common beans and configurations for all plugins</description>

    <dependencies>
        <dependency>
            <groupId>com.atlassian.event</groupId>
            <artifactId>atlassian-event</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.sal</groupId>
            <artifactId>sal-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.gemini.blueprint</groupId>
            <artifactId>gemini-blueprint-extender</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-osgi</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</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>

        <!-- Test dependencies -->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Fragment-Host>org.eclipse.gemini.blueprint.extender</Fragment-Host>
                        <Bundle-SymbolicName>com.atlassian.bitbucket.plugin.extender</Bundle-SymbolicName>
                        <!--
                            We want bnd to automatically compute our imports, but we don't want any versions. The reason
                            is that this is a fragment bundle, and if we have mismatched attributes with our host, then
                            we can't attach (according to the OSGi) spec. Although Felix doesn't currently enforce this,
                            let's do the best we can. For forward evolution, we do it for all packages, since our host
                            might change its requirements also.

                            See https://bitbucket.org/atlassian/atlassian-plugins/pull-request/106/diff#comment-3854363
                        -->
                        <Import-Package>
                            com.atlassian.event.api;version=!,
                            com.atlassian.event.config;version=!,
                            com.atlassian.event.spi;version=!,
                            com.atlassian.sal.api.lifecycle;version=!,
                            javax.annotation;version=!,
                            org.eclipse.gemini.blueprint.extender;version=!,
                            org.osgi.framework;version=!,
                            org.osgi.util.tracker;version=!,
                            org.slf4j;version=!,
                            org.springframework.beans*;version=!,
                            org.springframework.context*;version=!,
                            org.springframework.core;version=!,
                        </Import-Package>
                        <Include-Resource>{maven-resources}</Include-Resource>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <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>
    </profiles>
</project>
