<?xml version="1.0" encoding="UTF-8"?>
<!--
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership.  The ASF licenses this file
 to you 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.
-->
<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.apache.aries</groupId>
        <artifactId>parent</artifactId>
        <version>2.1.0</version>
        <relativePath>../../parent/pom.xml</relativePath>
    </parent>

    <groupId>org.apache.aries.spifly</groupId>
    <artifactId>org.apache.aries.spifly.dynamic.bundle</artifactId>
    <version>1.3.2</version>
    <name>Apache Aries SPI Fly Dynamic Weaving Bundle</name>
    <description>
        This bundle contains an extender that facilitates the use
        of JRE SPI providers (components typically plugged in to the
        JRE through META-INF/services resources).
    </description>

    <scm>
        <connection>scm:git:https://gitbox.apache.org/repos/asf/aries.git</connection>
        <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/aries.git</developerConnection>
        <url>https://gitbox.apache.org/repos/asf?p=aries.git;a=summary</url>
        <tag>spifly-1.3.2</tag>
    </scm>

    <properties>
        <asm.version>9.0</asm.version>
        <bnd.version>5.1.2</bnd.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm</artifactId>
            <version>${asm.version}</version>
        </dependency>
        <dependency>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm-commons</artifactId>
            <version>${asm.version}</version>
        </dependency>
        <dependency>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm-util</artifactId>
            <version>${asm.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.aries.spifly</groupId>
            <artifactId>org.apache.aries.spifly.core-internal</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.aries.spifly</groupId>
            <artifactId>org.apache.aries.spifly.weaver-internal</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>osgi.core</artifactId>
            <version>5.0.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>biz.aQute.bnd</groupId>
            <artifactId>aQute.libg</artifactId>
            <version>${bnd.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>biz.aQute.bnd</groupId>
            <artifactId>biz.aQute.bndlib</artifactId>
            <version>${bnd.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.framework</artifactId>
            <version>6.0.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.easymock</groupId>
            <artifactId>easymock</artifactId>
            <version>3.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>biz.aQute.bnd</groupId>
                <artifactId>bnd-maven-plugin</artifactId>
                <version>${bnd.version}</version>
                <configuration>
                    <bnd><![CDATA[
                    Bundle-Activator: org.apache.aries.spifly.dynamic.DynamicWeavingActivator
                    Export-Package: org.apache.aries.spifly.*;version=${project.version}
                    -conditionalpackage: \
                        aQute.bnd.header,\
                        aQute.bnd.stream,\
                        aQute.bnd.version,\
                        aQute.bnd.version.maven,\
                        aQute.lib.collections,\
                        aQute.lib.date,\
                        aQute.lib.exceptions,\
                        aQute.lib.hex,\
                        aQute.lib.io,\
                        aQute.lib.stringrover,\
                        aQute.lib.strings,\
                        aQute.libg.generics,\
                        aQute.libg.glob,\
                        aQute.libg.qtokens,\
                        aQute.service.reporter,\
                        org.apache.aries.spifly.dynamic,\
                        org.apache.aries.spifly.weaver
                    -includeresource: \
                        META-INF/LICENSE=LICENSE,\
                        META-INF/NOTICE=NOTICE
                    Provide-Capability: \
                        osgi.extender;osgi.extender=osgi.serviceloader.registrar;version:Version=1.0,\
                        osgi.extender;osgi.extender=osgi.serviceloader.processor;version:Version=1.0;uses:="org.apache.aries.spifly"
                    -fixupmessages: \
                        "Export org.apache.aries.spifly,  has 1,  private references"
                    ]]></bnd>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>bnd-process</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>biz.aQute.bnd</groupId>
                <artifactId>bnd-baseline-maven-plugin</artifactId>
                <version>${bnd.version}</version>
                <configuration>
                    <includeDistributionManagement>false</includeDistributionManagement>
                    <fullReport>true</fullReport>
                </configuration>
                <executions>
                    <execution>
                        <id>baseline</id>
                        <goals>
                            <goal>baseline</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>biz.aQute.bnd</groupId>
                <artifactId>bnd-resolver-maven-plugin</artifactId>
                <version>${bnd.version}</version>
                <configuration>
                    <failOnChanges>false</failOnChanges>
                    <scopes>
                        <scope>compile</scope>
                        <scope>runtime</scope>
                        <scope>test</scope>
                    </scopes>
                    <bndruns>
                        <bndrun>resolve.bndrun</bndrun>
                    </bndruns>
                    <bundles>
                        <bundle>target/${project.build.finalName}.jar</bundle>
                    </bundles>
                    <writeOnChanges>false</writeOnChanges>
                </configuration>
                <executions>
                    <execution>
                        <id>resolve</id>
                        <goals>
                            <goal>resolve</goal>
                        </goals>
                        <phase>package</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.aries.versioning</groupId>
                <artifactId>org.apache.aries.versioning.plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>apache-release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <version>3.1.1</version>
                        <executions>
                            <execution>
                                <id>unpack</id>
                                <phase>package</phase>
                                <goals>
                                  <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>biz.aQute.bnd</groupId>
                                            <artifactId>biz.aQute.bndlib</artifactId>
                                            <version>${bnd.version}</version>
                                            <type>jar</type>
                                            <classifier>sources</classifier>
                                            <overWrite>false</overWrite>
                                            <outputDirectory>${project.build.directory}/upacksources/bndlib</outputDirectory>
                                            <includes>
                                                aQute/bnd/header/*.java,
                                                aQute/bnd/stream/*.java,
                                                aQute/bnd/version/*.java,
                                                aQute/bnd/version/maven*.java,
                                                aQute/lib/collections/*.java,
                                                aQute/lib/date/*.java,
                                                aQute/lib/exceptions/*.java,
                                                aQute/lib/io/*.java,
                                                aQute/lib/stringrover/*.java,
                                                aQute/lib/strings/*.java,
                                                aQute/libg/generics/*.java,
                                                aQute/libg/glob/*.java,
                                                aQute/libg/qtokens/*.java,
                                                aQute/service/reporter/*.java
                                            </includes>
                                        </artifactItem>
                                    </artifactItems>
                                    <excludes>META-INF/**/*,META-INF</excludes>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <version>3.0.0</version>
                        <executions>
                            <execution>
                                <id>add-source</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>add-source</goal>
                                </goals>
                                <configuration>
                                    <sources>
                                        <source>${project.basedir}/../spi-fly-core/src/main/java/</source>
                                        <source>${project.basedir}/../spi-fly-weaver/src/main/java/</source>
                                        <source>${project.build.directory}/upacksources/bndlib</source>
                                    </sources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-source-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <configuration>
                            <excludePackageNames>aQute.*</excludePackageNames>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
