<?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.sling</groupId>
        <artifactId>sling</artifactId>
        <version>62</version>
        <relativePath />
    </parent>

    <artifactId>org.apache.sling.launchpad.base</artifactId>
    <!-- 
       This version is a concatenation of the framework version and a version for the launchpad base itself.
       For a release only the qualifier (launchpad base version) is increased.
     -->
    <version>7.0.5-2.8.2</version>
    <packaging>bundle</packaging>

    <name>Apache Sling Launchpad Base</name>
    <description>This module contains the common classes and configuration files used
        by the various launchpad modules..</description>

    <scm>
        <connection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-launchpad-base.git</connection>
        <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-launchpad-base.git</developerConnection>
        <tag>org.apache.sling.launchpad.base-7.0.5-2.8.2</tag>
        <url>https://github.com/apache/sling-org-apache-sling-launchpad-base.git</url>
    </scm>

    <properties>
        <sling.java.version>8</sling.java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.framework</artifactId>
            <version>7.0.5</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.compendium</artifactId>
            <version>4.2.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
            <version>5.0.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.http.proxy</artifactId>
            <version>4.0.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.sling</groupId>
            <artifactId>org.apache.sling.launchpad.api</artifactId>
            <version>1.2.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.sling</groupId>
            <artifactId>org.apache.sling.commons.osgi</artifactId>
            <version>2.0.6</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>5.4.0</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <dependencies>
                    <dependency>
                        <groupId>biz.aQute</groupId>
                        <artifactId>bnd</artifactId>
                        <version>0.0.384</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>testbundles</id>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <phase>process-test-classes</phase>
                        <configuration>
                            <skip>${maven.test.skip}</skip>
                            <target name="build">
                                <taskdef classpathref="maven.plugin.classpath" resource="aQute/bnd/ant/taskdef.properties" />
                                <bnd classpath="${project.build.testOutputDirectory}" exceptions="true" failok="false" files="src/test/resources/test1.bnd" output="${project.build.testOutputDirectory}" />
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>5.1.9</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-Category>sling</Bundle-Category>
                        <Bundle-SymbolicName>system.bundle</Bundle-SymbolicName>
                        <Bundle-DocURL>http://sling.apache.org/site/the-sling-launchpad.html</Bundle-DocURL>
                        <Private-Package>
                            <!-- External (app, webapp) components -->
                            !org.apache.sling.launchpad.base.shared.*,
                            org.apache.sling.launchpad.base.*
                        </Private-Package>
                        <Import-Package>!*</Import-Package>
                        <Export-Package>!*</Export-Package>
                        <DynamicImport-Package>*</DynamicImport-Package>
                        <Embed-Dependency>org.apache.felix.framework;inline=org/**|META-INF/**|default.properties,
                            org.apache.felix.http.proxy;inline=org/apache/**,
                            org.apache.sling.launchpad.api;inline=org/apache/sling/launchpad/api/**</Embed-Dependency>
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <!-- Embed code from osgi.commons -->
                    <execution>
                        <id>extract-sling-commons-osgi</id>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <includeArtifactIds>org.apache.sling.commons.osgi</includeArtifactIds>
                            <excludeTransitive>true</excludeTransitive>
                            <outputDirectory>${project.build.directory}/classes</outputDirectory>
                        </configuration>
                    </execution>
                    <!-- Embed osgi Version class from framework-->
                    <execution>
                        <id>extract-osgi-framework</id>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <includeArtifactIds>org.apache.felix.framework</includeArtifactIds>
                            <excludeTransitive>true</excludeTransitive>
                            <outputDirectory>${project.build.directory}/classes</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <id>base-app</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <archive>
                                <manifest>
                                    <mainClass>org.apache.sling.launchpad.app.Main</mainClass>
                                    <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                                </manifest>
                            </archive>
                            <classifier>app</classifier>
                            <includes>
                                <include>org/apache/sling/launchpad/base/shared/**</include>
                                <include>org/apache/sling/launchpad/app/**</include>
                                <include>org/apache/sling/commons/osgi/bundleversion/**</include>
                                <include>org/osgi/framework/Version*</include>
                                <include>META-INF/**</include>
                            </includes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <executions>
                    <execution>
                        <id>base-webapp</id>
                        <goals>
                            <goal>war</goal>
                        </goals>
                        <configuration>
                            <archive>
                                <manifest>
                                    <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                                </manifest>
                            </archive>
                            <classifier>webapp</classifier>
                            <packagingIncludes>META-INF/**,
                                WEB-INF/classes/org/apache/sling/launchpad/base/shared/**,
                                WEB-INF/classes/org/apache/sling/launchpad/webapp/**,
                                WEB-INF/classes/org/apache/sling/commons/osgi/bundleversion/**,
                                WEB-INF/classes/org/osgi/framework/Version*,
                                WEB-INF/resources/**</packagingIncludes>
                            <webResources>
                                <!-- ensure the legalize stuff is in the war -->
                                <webResource>
                                    <targetPath />
                                    <filtering>false</filtering>
                                    <directory>${project.build.directory}/maven-shared-archive-resources</directory>
                                </webResource>
                            </webResources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <!-- No javadocs -->
                    <excludePackageNames>org.apache.sling</excludePackageNames>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>animal-sniffer-maven-plugin</artifactId>
                <version>1.20</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <argLine>--add-reads=org.apache.felix.framework=java.management</argLine>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>jacoco-report</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <!--suppress UnresolvedMavenProperty -->
                            <argLine>${jacoco.ut.command} --add-reads=org.apache.felix.framework=java.management</argLine>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
