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

    Copyright (c) 1997, 2018 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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.eclipse.ee4j</groupId>
        <artifactId>project</artifactId>
        <version>1.0.5</version>
        <relativePath />
    </parent>

    <groupId>org.glassfish.external</groupId>
    <artifactId>antlr</artifactId>
    <version>2.7.8</version>

    <name>Antlr, repackaged as an OSGI bundle</name>

    <properties>
        <antlr.version>2.7.7</antlr.version>
        <antlr.source.url>http://www.antlr2.org/download/antlr-${antlr.version}.tar.gz</antlr.source.url>
        <antlr.source.artifact>antlr-${antlr.version}</antlr.source.artifact>
        <release.arguments />
    </properties>

    <licenses>
        <license>
            <name>EPL 2.0</name>
            <url>http://www.eclipse.org/legal/epl-2.0</url>
            <distribution>repo</distribution>
        </license>
        <license>
            <name>GPL2 w/ CPE</name>
            <url>https://www.gnu.org/software/classpath/license.html</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/eclipse-ee4j/glassfish-repackaged/issues</url>
    </issueManagement>

    <mailingLists>
      <mailingList>
          <name>GlassFish mailing list</name>
          <post>glassfish-dev@eclipse.org</post>
          <subscribe>https://dev.eclipse.org/mailman/listinfo/glassfish-dev</subscribe>
          <unsubscribe>https://dev.eclipse.org/mailman/listinfo/glassfish-dev</unsubscribe>
          <archive>https://dev.eclipse.org/mhonarc/lists/glassfish-dev</archive>
        </mailingList>
    </mailingLists>

    <scm>
        <connection>scm:git:git@github.com:eclipse-ee4j/glassfish-repackaged.git</connection>
        <developerConnection>scm:git:git@github.com:eclipse-ee4j/glassfish-repackaged.git</developerConnection>
        <url>https://github.com/eclipse-ee4j/glassfish-repackaged.git</url>
        <tag>HEAD</tag>
    </scm>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.felix</groupId>
                    <artifactId>maven-bundle-plugin</artifactId>
                    <version>2.3.4</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>2.8</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.0.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>2.9.1</version>
                    <configuration>
                        <additionalparam>${javadoc.options}</additionalparam>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>1.8</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>1.4</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>1.3.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>2.4</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <configuration>
                    <instructions>
                        <Embed-Dependency>
                            antlr;inline=true
                        </Embed-Dependency>
                        <!-- we are not using _exportcontents, because that
                             does not generate version in Export-Package.
                             Sahoo to investigate further.
                        -->
                        <!-- We set a mandatory attribute for these packages, because we don't
                             want them to be visible to just anyone. An importer must specify
                             the mandatory attribute for it to be able to import. See
                             section #3.6.5 of OSGi R4 spec.
                             Why is this required?
                             See https://glassfish.dev.java.net/issues/show_bug.cgi?id=5385
                             By doing this, we allow user have any version of apache-commons lib
                             in their application class loader hierarchy. They don't even have to
                             set delegation=false in sun-web.xml! This is the true advantage of
                             using OSGi. Sahoo.
                        -->
                        <Export-Package>antlr.*;version=${antlr.version}; password="GlassFish"; mandatory:=password</Export-Package>
                        <Private-Package>!*</Private-Package>
                    </instructions>
                    <!-- Maven uses the output directory (target/classes)
                    rather than the final bundle, when compiling against
                    projects in the same reactor (ie. the same build).
                    Since this jar comprises of classes that come from
                    some other jar and other modules depend on this
                    artifact, we need to unpack.
                    -->
                    <unpackBundle>true</unpackBundle>
                </configuration>
                <executions>
                    <execution>
                        <id>osgi-bundle</id>
                        <phase>package</phase>
                        <goals>
                            <goal>bundle</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!--
                Download the source distribution.
            -->
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.8</version>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <configuration>
                            <target>
                                <get src="${antlr.source.url}" dest="${project.build.directory}" />
                                <untar src="${project.build.directory}/${antlr.source.artifact}.tar.gz" dest="${project.build.directory}/sources" compression="gzip">
                                    <patternset>
                                        <include name="*/antlr/**" />
                                    </patternset>
                                </untar>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-source-step2</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${project.build.directory}/sources/${antlr.source.artifact}</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!--
                We unpack and attach source before compile happens</plugins>
                We disable default-compile, to make sure we don't recompile sources
            -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-compile</id>
                        <configuration>
                            <skipMain>true</skipMain>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-jar</id>
                        <configuration>
                            <skipIfEmpty>true</skipIfEmpty>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.2</version>
                <configuration>
                    <mavenExecutorId>forked-path</mavenExecutorId>
                    <useReleaseProfile>false</useReleaseProfile>
                    <arguments>${release.arguments}</arguments>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.scm</groupId>
                        <artifactId>maven-scm-provider-gitexe</artifactId>
                        <version>1.9.4</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>antlr</groupId>
            <artifactId>antlr</artifactId>
            <version>${antlr.version}</version>
            <optional>true</optional>
        </dependency>
    </dependencies>
    <profiles>
        <profile>
            <id>javadoc-jdk8+</id>
            <activation>
                <jdk>[1.8,)</jdk>
                <activeByDefault>false</activeByDefault>
            </activation>
            <properties>
                <javadoc.options>-Xdoclint:none</javadoc.options>
            </properties>
        </profile>
    </profiles>
</project>
