<?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>
        <groupId>org.ops4j</groupId>
        <artifactId>master</artifactId>
        <version>3.1.0</version>
    </parent>

    <groupId>org.ops4j.pax.tipi</groupId>
    <artifactId>tipi-master</artifactId>
    <packaging>pom</packaging>
    <version>1.0.0</version>
    <name>OPS4J Pax Tipi Master POM</name>

    <properties>
        <!-- groupId of wrapped artifact - override in child POM -->
        <tipi.orig.groupId />

        <!-- artifactId of wrapped artifact - override in child POM -->
        <tipi.orig.artifactId />
        
        <!-- version of wrapped artifact - override in child POM -->
        <tipi.orig.version />
        
        <!-- value of Export-Package header - override in child POM -->
        <tipi.osgi.export />

        <!-- value of Import-Package header - override in child POM if needed -->
        <tipi.osgi.import>*</tipi.osgi.import>

        <!-- value of Private-Package instruction - override in child POM if needed -->
        <tipi.osgi.private />

        <!-- value of DynamicImport-Package header - override in child POM if needed -->
        <tipi.osgi.dynamicimport />
        
        <!-- value of _failok instruction - override in child POM if needed -->
        <tipi.osgi.failok>false</tipi.osgi.failok>

        <!-- value of Embed-Dependency instruction - override in child POM if needed -->
        <tipi.osgi.embed.dependency />
        
        <tipi.osgi.doc>http://team.ops4j.org/wiki/display/PAXTIPI</tipi.osgi.doc>
    </properties>

    <prerequisites>
        <maven>3.0.0</maven>
    </prerequisites>

    <scm>
        <connection>scm:git:git@github.com:ops4j/org.ops4j.pax.tipi.git</connection>
        <developerConnection>scm:git:git@github.com:ops4j/org.ops4j.pax.tipi.git</developerConnection>
        <url>git@github.com:ops4j/org.ops4j.pax.tipi.git</url>
        <tag>tipi-master-1.0.0</tag>
    </scm>

    <build>
        <resources>
            <resource>
                <directory>target/unpacked-sources</directory>
                <includes>
                    <include>**/*.java</include>
                </includes>
            </resource>
        </resources>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <executions>
                        
                        <!--  unpack resources from original artifact to be included in wrapped artifact -->
                        <execution>
                            <id>unpack-resources</id>
                            <phase>generate-resources</phase>
                            <goals>
                                <goal>unpack</goal>
                            </goals>
                            <configuration>
                                <artifactItems>
                                    <artifactItem>
                                        <groupId>${tipi.orig.groupId}</groupId>
                                        <artifactId>${tipi.orig.artifactId}</artifactId>
                                        <version>${tipi.orig.version}</version>
                                    </artifactItem>
                                </artifactItems>
                                <excludes>**/*.class</excludes>
                                <failOnMissingClassifierArtifact>false</failOnMissingClassifierArtifact>
                                <outputDirectory>target/unpacked-resources</outputDirectory>
                            </configuration>
                        </execution>
                        
                        <!--  unpack resources from original source artifact to be included in source bundle -->
                        <execution>
                            <id>unpack-sources</id>
                            <phase>post-integration-test</phase>
                            <goals>
                                <goal>unpack</goal>
                            </goals>
                            <configuration>
                                <artifactItems>
                                    <artifactItem>
                                        <groupId>${tipi.orig.groupId}</groupId>
                                        <artifactId>${tipi.orig.artifactId}</artifactId>
                                        <version>${tipi.orig.version}</version>
                                        <classifier>sources</classifier>
                                    </artifactItem>
                                </artifactItems>
                                <includes>**/*.java</includes>
                                <failOnMissingClassifierArtifact>false</failOnMissingClassifierArtifact>
                                <outputDirectory>target/unpacked-sources</outputDirectory>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                
                <!-- create source bundle from unpacked sources -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>2.2.1</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <phase>post-integration-test</phase>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <attach>true</attach>
                        <archive>
                            <manifestEntries>
                                <Bundle-ManifestVersion>2</Bundle-ManifestVersion>
                                <Bundle-Name>${project.name}</Bundle-Name>
                                <Bundle-SymbolicName>${project.artifactId}.source</Bundle-SymbolicName>
                                <Bundle-Version>${project.version}</Bundle-Version>
                                <Eclipse-SourceBundle>
                                    ${project.artifactId};version="${project.version}";roots:="."
                                </Eclipse-SourceBundle>
                            </manifestEntries>
                        </archive>
                    </configuration>
                </plugin>


                <!-- create wrapped bundle -->
                <plugin>
                    <groupId>org.apache.felix</groupId>
                    <artifactId>maven-bundle-plugin</artifactId>
                    <version>2.3.7</version>
                    <extensions>true</extensions>
                    <configuration>
                        <instructions>
                            <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                            <Bundle-Description>${project.description}</Bundle-Description>
                            <Export-Package>${tipi.osgi.export}</Export-Package>
                            <Import-Package>${tipi.osgi.import}</Import-Package>
                            <Private-Package>${tipi.osgi.private}</Private-Package>
                            <DynamicImport-Package>${tipi.osgi.dynamicimport}</DynamicImport-Package>
                            <Embed-Dependency>${tipi.osgi.embed.dependency}</Embed-Dependency>
                            <Bundle-NativeCode>${tipi.osgi.native}</Bundle-NativeCode>
                            <Bundle-Activator>${tipi.osgi.activator}</Bundle-Activator>
                            <Bundle-DocURL>${tipi.osgi.doc}</Bundle-DocURL>
                            <Include-Resource>target/unpacked-resources</Include-Resource>
                            <_failok>${tipi.osgi.failok}</_failok>
                            <_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy>
                            <_removeheaders>Ignore-Package,Include-Resource,Private-Package,Embed-Dependency
                            </_removeheaders>
                        </instructions>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>


    </build>
    
    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0</url>
            <comments>
                Copyright 2012 OPS4J

                Licensed under the Apache License, Version 2.0 (the "License");
                you may not use this file except in compliance with the License.
                You may obtain a copy of the License at

                http://www.apache.org/licenses/LICENSE-2.0

                Unless required by applicable law or agreed to in writing, software
                distributed under the License is distributed on an "AS IS" BASIS,
                WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
                implied.

                See the License for the specific language governing permissions and
                limitations under the License.
            </comments>
        </license>
    </licenses>

    <url>${tipi.osgi.doc}</url>

    <issueManagement>
        <system>jira</system>
        <url>http://issues.ops4j.org/jira/browse/PAXTIPI</url>
    </issueManagement>

    <developers>
        <developer>
            <id>hwellmann</id>
            <name>Harald Wellmann</name>
            <email>harald.wellmann@gmx.de</email>
            <organization>independent software developer</organization>
            <roles>
                <role>Developer</role>
            </roles>
            <timezone>UTC+1</timezone>
        </developer>
    </developers>

</project>
