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

    Copyright (c) 2013, 2023 Oracle and/or its affiliates. All rights reserved.

    This program and the accompanying materials are made available under the
    terms of the Eclipse Distribution License v. 1.0, which is available at
    http://www.eclipse.org/org/documents/edl-v10.php.

    SPDX-License-Identifier: BSD-3-Clause

-->

<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>com.sun.xml.bind.mvn</groupId>
        <artifactId>jaxb-runtime-parent</artifactId>
        <version>4.0.3</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <groupId>org.glassfish.jaxb</groupId>
    <artifactId>jaxb-runtime</artifactId>

    <packaging>jar</packaging>
    <name>JAXB Runtime</name>
    <description>JAXB (JSR 222) Reference Implementation</description>
    <url>https://eclipse-ee4j.github.io/jaxb-ri/</url>

    <properties>
        <spotbugs.exclude>${project.basedir}/exclude-runtime.xml</spotbugs.exclude>
        <argLine>
            --add-opens org.glassfish.jaxb.runtime/org.glassfish.jaxb.runtime.unmarshaller=jakarta.xml.bind
            --add-opens org.glassfish.jaxb.runtime/org.glassfish.jaxb.runtime.v2=jakarta.xml.bind
            --add-opens org.glassfish.jaxb.runtime/org.glassfish.jaxb.runtime.v2.runtime=jakarta.xml.bind
            --add-opens org.glassfish.jaxb.runtime/org.glassfish.jaxb.runtime.v2=org.glassfish.jaxb.core
            --add-opens org.glassfish.jaxb.runtime/org.glassfish.jaxb.runtime.v2.schemagen=org.glassfish.jaxb.core
            --add-opens java.base/java.lang=org.glassfish.jaxb.runtime
            --add-opens java.base/java.lang.reflect=org.glassfish.jaxb.runtime
            --add-opens org.glassfish.jaxb.runtime/org.glassfish.jaxb.runtime.v2.runtime.reflect.opt=org.glassfish.jaxb.core
        </argLine>
        <txwc2.sources>${project.build.directory}/generated-sources/txwc2</txwc2.sources>
    </properties>

    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>jaxb-core</artifactId>
        </dependency>

        <dependency>
            <groupId>org.jvnet.staxex</groupId>
            <artifactId>stax-ex</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.fastinfoset</groupId>
            <artifactId>FastInfoset</artifactId>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>com.sun.istack</groupId>
                <artifactId>istack-commons-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>quick-gen</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>quick-gen</goal>
                        </goals>
                        <configuration>
                            <packageName>org.glassfish.jaxb.runtime.v2.model.annotation</packageName>
                            <classes>
                                <class>jakarta.xml.bind.annotation.*</class>
                                <class>jakarta.xml.bind.annotation.adapters.*</class>
<!--                                <class>jakarta.xml.bind.annotation.XmlAttribute</class>-->
<!--                                <class>jakarta.xml.bind.annotation.XmlElement</class>-->
<!--                                <class>jakarta.xml.bind.annotation.XmlElementDecl</class>-->
<!--                                <class>jakarta.xml.bind.annotation.XmlElementRef</class>-->
<!--                                <class>jakarta.xml.bind.annotation.XmlElementRefs</class>-->
<!--                                <class>jakarta.xml.bind.annotation.XmlEnum</class>-->
<!--                                <class>jakarta.xml.bind.annotation.XmlRootElement</class>-->
<!--                                <class>jakarta.xml.bind.annotation.XmlSchema</class>-->
<!--                                <class>jakarta.xml.bind.annotation.XmlSchemaType</class>-->
<!--                                <class>jakarta.xml.bind.annotation.XmlTransient</class>-->
<!--                                <class>jakarta.xml.bind.annotation.XmlType</class>-->
<!--                                <class>jakarta.xml.bind.annotation.XmlValue</class>-->
                            </classes>
                            <license>${copyright.template}</license>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <dependencies>
                    <dependency>
                        <groupId>org.glassfish.jaxb</groupId>
                        <artifactId>txwc2</artifactId>
                        <version>${project.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>com.github.relaxng</groupId>
                        <artifactId>relaxngDatatype</artifactId>
                        <version>2011.1</version>
                        <scope>runtime</scope>
                    </dependency>
                    <dependency>
                        <groupId>net.java.dev.msv</groupId>
                        <artifactId>xsdlib</artifactId>
                        <version>2022.7</version>
                        <scope>runtime</scope>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <taskdef name="txwc" classname="com.sun.tools.txw2.TxwTask">
                                    <classpath refid="maven.plugin.classpath"/>
                                </taskdef>
                                <property name="gen.out" value="${txwc2.sources}"/>
                                <property name="runtime.src" value="${project.build.sourceDirectory}/../resources"/>
                                <mkdir dir="${gen.out}"/>
                                <txwc schema="${runtime.src}/org/glassfish/jaxb/runtime/v2/schemagen/xmlschema/xmlschema-for-jaxb.rng"
                                      destdir="${gen.out}"
                                      package="org.glassfish.jaxb.runtime.v2.schemagen.xmlschema"
                                      methodChaining="true"
                                      license="${copyright.template}"
                                />
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-sources</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${txwc2.sources}</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <configuration>
                    <instructions>
                        <Implementation-Vendor>${vendor.name}</Implementation-Vendor>
                        <Implementation-Vendor-Id>${project.groupId}</Implementation-Vendor-Id>
                        <Implementation-Build-Id>${project.version} - ${buildNumber}</Implementation-Build-Id>
                        <Import-Package>
                            sun.misc;resolution:=optional,
                            jdk.internal.misc;resolution:=optional,
                            *
                        </Import-Package>
                        <DynamicImport-Package>*</DynamicImport-Package>
                    </instructions>
                </configuration>
                <executions>
                    <execution>
                        <id>bundle-manifest</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>manifest</goal>
                        </goals>
                    </execution>
                </executions>
            </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>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <workingDirectory>target/test-out</workingDirectory>
                    <forkCount>1</forkCount>
                    <reuseForks>true</reuseForks>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
