<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright 2021 Contributors to the Eclipse Foundation.
    Copyright (c) 2009, 2020 Oracle and/or its affiliates. All rights reserved.

    This program and the accompanying materials are made available under the
    terms of the Eclipse Public License v. 2.0, which is available at
    http://www.eclipse.org/legal/epl-2.0.

    This Source Code may also be made available under the following Secondary
    Licenses when the conditions for such availability set forth in the
    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
    version 2 with the GNU Classpath Exception, which is available at
    https://www.gnu.org/software/classpath/license.html.

    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0

-->

<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.glassfish.grizzly</groupId>
        <artifactId>grizzly-project</artifactId>
        <version>3.0.1</version>
        <relativePath>../../pom.xml</relativePath>
    </parent>

    <groupId>org.glassfish.grizzly.osgi</groupId>
    <artifactId>grizzly-httpservice</artifactId>
    <packaging>jar</packaging>

    <name>Grizzly OSGi HttpService</name>

    <properties>
        <osgi-compendium-src-folder>${project.build.directory}/osgi.compendium-src</osgi-compendium-src-folder>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.compendium</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.osgi.foundation</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
        </dependency>
        <dependency>
            <groupId>jakarta.persistence</groupId>
            <artifactId>jakarta.persistence-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.glassfish.grizzly</groupId>
            <artifactId>grizzly-http-servlet</artifactId>
        </dependency>
        <dependency>
            <groupId>org.glassfish.grizzly</groupId>
            <artifactId>grizzly-http</artifactId>
        </dependency>
        <dependency>
            <groupId>org.glassfish.grizzly</groupId>
            <artifactId>grizzly-framework</artifactId>
        </dependency>
        <dependency>
            <groupId>org.glassfish.grizzly</groupId>
            <artifactId>grizzly-portunif</artifactId>
        </dependency>
        <dependency>
            <groupId>org.glassfish.grizzly</groupId>
            <artifactId>grizzly-comet</artifactId>
        </dependency>
        <dependency>
            <groupId>org.glassfish.grizzly</groupId>
            <artifactId>grizzly-websockets</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <configuration>
                    <instructions>
                        <Bundle-Name>Grizzly OSGi HttpService</Bundle-Name>
                        <Bundle-Description>An implementation of the OSGi
                            HttpService using Grizzly.
                        </Bundle-Description>
                        <Bundle-Activator>
                            org.glassfish.grizzly.osgi.httpservice.Activator
                        </Bundle-Activator>
                        <Bundle-Vendor>Grizzly Devs</Bundle-Vendor>
                        <Import-Package>
                            org.glassfish.grizzly*;version=${project.version},
                            *,
                        </Import-Package>
                        <Export-Package>
                            jakarta.servlet;jakarta.servlet.http;version=5.0,
                            org.osgi.service.http,
                            org.glassfish.grizzly.osgi.httpservice.*;version=${project.version}
                        </Export-Package>
                        <Export-Service>
                            org.osgi.service.http.HttpService;version=1.2
                        </Export-Service>
                    </instructions>
                    <unpackBundle>true</unpackBundle>
                </configuration>
                <executions>
                    <execution>
                        <id>osgi-bundle</id>
                        <phase>package</phase>
                        <goals>
                            <goal>bundle</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.ops4j</groupId>
                <artifactId>maven-pax-plugin</artifactId>
                <version>1.6.0</version>
                <configuration>
                    <args>file:src/main/etc/pax.args</args>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.1.2</version>
                <executions>
                    <execution>
                        <id>unpack_osgi_compendium_sources</id>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.osgi</groupId>
                                    <artifactId>org.osgi.compendium</artifactId>
                                    <version>${osgi.compendium.version}</version>
                                    <classifier>sources</classifier>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${osgi-compendium-src-folder}</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.google.code.maven-replacer-plugin</groupId>
                <artifactId>replacer</artifactId>
                <version>1.5.3</version>
                <executions>
                    <execution>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>replace</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <includes>
                        <include>${osgi-compendium-src-folder}/**/*.java</include>
                    </includes>
                    <replacements>
                        <replacement>
                            <token>javax.servlet</token>
                            <value>jakarta.servlet</value>
                        </replacement>
                        <replacement>
                            <token>javax.persistence</token>
                            <value>jakarta.persistence</value>
                        </replacement>
                    </replacements>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-osgi-compendium-src</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${osgi-compendium-src-folder}</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
