<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>org.eclipse.collections</groupId>
        <artifactId>eclipse-collections-parent</artifactId>
        <version>11.1.0</version>
    </parent>

    <artifactId>p2-repository</artifactId>
    <packaging>pom</packaging>

    <name>Eclipse Collections p2 Repository Build</name>

    <modules>
        <module>org.eclipse.collections</module>
    </modules>

    <properties>

        <!-- include everything from all dependencies by default -->
        <recipe.includes>**/*</recipe.includes>

        <!-- but filter out maven instructions, we'll generate new ones below -->
        <recipe.excludes>META-INF/maven/**/*.*</recipe.excludes>

        <!-- BND specific instructions which can be overridden by recipe -->
        <recipe.Bundle-Name>%bundleName</recipe.Bundle-Name>
        <recipe.Bundle-Description />
        <recipe.Bundle-Vendor>%bundleVendor</recipe.Bundle-Vendor>

        <!-- remove some clutter from the generated manifests -->
        <recipe.removeheaders>
            Ignore-Package,Include-Resource,Private-Package,Embed-Dependency,Built-By,Build-Jdk,Bnd-*,Tool
        </recipe.removeheaders>

        <!-- for Orbit, by default we'll also remove the Require-Bundle header; recipe poms may override if they need this header -->
        <recipe.removeadditionalheaders>Require-Bundle</recipe.removeadditionalheaders>

        <!-- read BND settings from 'osgi.bnd' located next to pom.xml -->
        <recipe.bndfile>osgi.bnd</recipe.bndfile>

        <!-- pattern/format used for the qualifier -->
        <recipe.qualifier.format>'v'yyyyMMdd-HHmm</recipe.qualifier.format>

        <!-- project defaults -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!-- versions used for plug-ins below -->
        <tycho-version>1.7.0</tycho-version>

        <!-- versions of the EBR plug-in to use -->
        <ebr-version>1.3.0</ebr-version>

        <!-- property for generating Eclipse source reference bundle headers -->
        <tycho.scmUrl>scm:git:https://github.com/eclipse/eclipse-collections.git</tycho.scmUrl>

        <!-- by default complain if working tree is dirty (error|warning|ignore) -->
        <dirtyWorkingTree>warning</dirtyWorkingTree>

        <!-- set default vendor -->
        <bundleVendor>Eclipse Collections</bundleVendor>

        <!-- values needed for generating repositories -->
        <maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
        <buildTimestamp>${maven.build.timestamp}</buildTimestamp>
        <buildType>I</buildType>
        <buildId>${buildType}${buildTimestamp}</buildId>
        <buildLabel>${buildType}-${buildId}-${buildTimestamp}</buildLabel>

    </properties>

    <pluginRepositories>
        <!-- configure the EBR plug-in repo -->
        <pluginRepository>
            <id>ebr-releases</id>
            <url>https://repo.eclipse.org/content/repositories/ebr-releases/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>ebr-snapshots</id>
            <url>https://repo.eclipse.org/content/repositories/ebr-snapshots/</url>
            <releases>
                <enabled>false</enabled>
            </releases>
        </pluginRepository>
        <pluginRepository>
            <id>cbi-releases</id>
            <url>https://repo.eclipse.org/content/repositories/cbi-releases/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>cbi-snapshots</id>
            <url>https://repo.eclipse.org/content/repositories/cbi-snapshots/</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

    <build>
        <plugins>
            <!-- configure default plug-ins -->

            <!-- enable Tycho -->
            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-maven-plugin</artifactId>
                <extensions>true</extensions>
                <dependencies>
                    <dependency>
                        <groupId>org.eclipse.tycho</groupId>
                        <artifactId>tycho-core</artifactId>
                        <version>${tycho-version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.eclipse.tycho</groupId>
                        <artifactId>tycho-p2-facade</artifactId>
                        <version>${tycho-version}</version>
                    </dependency>
                </dependencies>
            </plugin>

            <!-- target platform configuration -->
            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>target-platform-configuration</artifactId>
                <configuration>
                    <environments>
                        <environment>
                            <os>*</os>
                            <ws>*</ws>
                            <arch>*</arch>
                        </environment>
                    </environments>
                    <includePackedArtifacts>true</includePackedArtifacts>
                </configuration>
            </plugin>

            <!-- configure build qualifier generation as well as source reference headers -->
            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-packaging-plugin</artifactId>
                <dependencies>
                    <dependency>
                        <groupId>org.eclipse.tycho.extras</groupId>
                        <artifactId>tycho-sourceref-jgit</artifactId>
                        <version>${tycho-version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.eclipse.tycho.extras</groupId>
                        <artifactId>tycho-buildtimestamp-jgit</artifactId>
                        <version>${tycho-version}</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <!-- use qualifier from properties -->
                    <format>${recipe.qualifier.format}</format>
                    <!-- generate bundle .qualifier from Git tags/commits -->
                    <timestampProvider>jgit</timestampProvider>
                    <!-- allow to ignore dirty working trees -->
                    <jgit.dirtyWorkingTree>${dirtyWorkingTree}</jgit.dirtyWorkingTree>
                    <!-- generate source references -->
                    <sourceReferences>
                        <generate>true</generate>
                    </sourceReferences>
                </configuration>
            </plugin>


            <!-- configure bundle build so that properties defined above will be considered -->
            <plugin>
                <groupId>org.eclipse.ebr</groupId>
                <artifactId>ebr-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <includes>${recipe.includes}</includes>
                    <excludes>${recipe.excludes}</excludes>
                    <bndInstructions>
                        <Bundle-Name>${recipe.Bundle-Name}</Bundle-Name>
                        <Bundle-Vendor>${recipe.Bundle-Vendor}</Bundle-Vendor>
                        <Bundle-Description>${recipe.Bundle-Description}</Bundle-Description>
                        <_removeheaders>${recipe.removeheaders},${recipe.removeadditionalheaders}</_removeheaders>
                        <_include>-${recipe.bndfile}</_include>
                    </bndInstructions>
                </configuration>
            </plugin>

        </plugins>
        <pluginManagement>
            <!-- define versions and defaults for plug-ins used in Maven -->

            <plugins>
                <plugin>
                    <groupId>org.eclipse.tycho</groupId>
                    <artifactId>tycho-maven-plugin</artifactId>
                    <version>${tycho-version}</version>
                </plugin>
                <plugin>
                    <groupId>org.eclipse.tycho</groupId>
                    <artifactId>tycho-packaging-plugin</artifactId>
                    <version>${tycho-version}</version>
                </plugin>
                <plugin>
                    <groupId>org.eclipse.tycho</groupId>
                    <artifactId>tycho-p2-plugin</artifactId>
                    <version>${tycho-version}</version>
                </plugin>
                <plugin>
                    <groupId>org.eclipse.tycho</groupId>
                    <artifactId>tycho-p2-director-plugin</artifactId>
                    <version>${tycho-version}</version>
                </plugin>
                <plugin>
                    <groupId>org.eclipse.tycho</groupId>
                    <artifactId>tycho-p2-repository-plugin</artifactId>
                    <version>${tycho-version}</version>
                </plugin>
                <plugin>
                    <groupId>org.eclipse.tycho</groupId>
                    <artifactId>target-platform-configuration</artifactId>
                    <version>${tycho-version}</version>
                </plugin>
                <plugin>
                    <groupId>org.eclipse.tycho</groupId>
                    <artifactId>tycho-source-plugin</artifactId>
                    <version>${tycho-version}</version>
                </plugin>
                <plugin>
                    <groupId>org.eclipse.tycho.extras</groupId>
                    <artifactId>tycho-source-feature-plugin</artifactId>
                    <version>${tycho-version}</version>
                </plugin>
                <plugin>
                    <groupId>org.eclipse.tycho.extras</groupId>
                    <artifactId>tycho-custom-bundle-plugin</artifactId>
                    <version>${tycho-version}</version>
                </plugin>
                <plugin>
                    <groupId>org.eclipse.tycho.extras</groupId>
                    <artifactId>tycho-p2-extras-plugin</artifactId>
                    <version>${tycho-version}</version>
                </plugin>
                <plugin>
                    <groupId>org.eclipse.ebr</groupId>
                    <artifactId>ebr-maven-plugin</artifactId>
                    <version>${ebr-version}</version>
                </plugin>
                <plugin>
                    <groupId>org.eclipse.ebr</groupId>
                    <artifactId>ebr-tycho-extras-plugin</artifactId>
                    <version>${ebr-version}</version>
                </plugin>
            </plugins>

        </pluginManagement>
    </build>

</project>
