<?xml version="1.0" encoding="UTF-8"?>
<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>com.fasterxml</groupId>
    <artifactId>oss-parent</artifactId>
    <version>35</version>
  </parent>

  <artifactId>aalto-xml</artifactId>
  <version>1.2.0</version>
  <packaging>bundle</packaging>
  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <name>aalto-xml</name>
  <description>Ultra-high performance non-blocking XML processor (Stax/Stax2, SAX/SAX2)
  </description>

  <scm>
    <connection>scm:git:git@github.com:FasterXML/aalto-xml.git</connection>
    <developerConnection>scm:git:git@github.com:FasterXML/aalto-xml.git</developerConnection>
    <url>http://github.com/FasterXML/aalto-xml</url>
    <tag>aalto-xml-1.2.0</tag>
  </scm>

  <properties>
    <!-- 05-Mar-2019, tatu: We can still produce JDK 1.6 compatible jar, but must
          build with JDK 8. This for Aalto 1.2.
          Will probably raise minimum JDK to JDK 8 relatively soon.
      -->
    <java.version>1.6</java.version>
    
    <javac.src.version>${java.version}</javac.src.version>
    <javac.target.version>${java.version}</javac.target.version>

    <maven.compiler.source>${java.version}</maven.compiler.source>
    <maven.compiler.target>${java.version}</maven.compiler.target>

    <!--  05-Mar-2019, tatu: looks like 3.2.0 ain't enough any more -->
    <version.plugin.bundle>4.1.0</version.plugin.bundle>

    <!--
     | Configuration properties for the OSGi maven-bundle-plugin
    -->
    <osgi.export>${project.groupId}.aalto.*;version=${project.version}</osgi.export>
    <osgi.import>javax.xml, javax.xml.namespace, javax.xml.parsers,
javax.xml.stream, javax.xml.stream.util,
javax.xml.transform, javax.xml.transform.dom, javax.xml.transform.sax, javax.xml.transform.stream,
org.codehaus.stax2, org.codehaus.stax2.io, org.codehaus.stax2.ri, org.codehaus.stax2.typed,
org.codehaus.stax2.validation,
org.codehaus.stax2.ri.dom, org.codehaus.stax2.ri.evt, org.codehaus.stax2.ri.typed,
org.w3c.dom,
org.xml.sax, org.xml.sax.ext, org.xml.sax.helpers</osgi.import>
  </properties>

  <dependencies>
    <!--
     | Not much; just APIs we implement
     | note: we do need Stax2 api (javax.xml.stream); but
     | it comes with JDK 1.6, which is baseline for Aalto
    -->
    <dependency>
      <groupId>org.codehaus.woodstox</groupId>
      <artifactId>stax2-api</artifactId>
      <version>4.1</version>
    </dependency>
    <!--
     | Test dependencies
    -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${version.junit}</version>
      <scope>test</scope>
    </dependency>

    <!-- since 1.1, may start test validation; need Woodstox for that -->
    <dependency>
      <groupId>com.fasterxml.woodstox</groupId>
      <artifactId>woodstox-core</artifactId>
      <version>5.2.0</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <!--  base definitions work for OSGi; no more Automatic Module name for 1.2.0 -->

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.13</version>
        <configuration>
          <includes>
            <include>**/Test*.java</include>
            <include>**/*Test.java</include>
          </includes>
          <excludes>
            <exclude>**/Base*</exclude>
            <exclude>**/*$*</exclude>
	        <exclude>failing/*.java</exclude>
          </excludes>
          <reportFormat>${surefire.format}</reportFormat>
          <useFile>${surefire.usefile}</useFile>
          <forkMode>${surefire.fork.mode}</forkMode>
          <childDelegation>false</childDelegation>
          <argLine>${surefire.fork.vmargs}</argLine>
          <systemProperties>
            <property>
              <name>java.awt.headless</name>
              <value>${java.awt.headless}</value>
            </property>
            <property>
              <name>surefire.fork.vmargs</name>
              <value>${surefire.fork.vmargs}</value>
            </property>
          </systemProperties>
        </configuration>
      </plugin>

      <!--  04-Mar-2019, tatu: Add rudimentary JDK9+ module info. To build with JDK 8
             will have to use `moduleInfoFile` which is crappy but anything else requires
             JDK 9+. With Jackson 3.0 will upgrade.
        -->
      <plugin>
        <groupId>org.moditect</groupId>
        <artifactId>moditect-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>add-module-infos</id>
            <phase>package</phase>
            <goals>
              <goal>add-module-info</goal>
            </goals>
            <configuration>
              <overwriteExistingFiles>true</overwriteExistingFiles>
              <module>
                <moduleInfoFile>src/moditect/module-info.java</moduleInfoFile>
              </module>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>moditect</id>
      <properties>
        <!-- Not only do we need JDK 9+, must target later JDK too -->
        <java.version>1.9</java.version>
      </properties>
      <build>
	   <plugins>
	      <plugin>
	        <groupId>org.moditect</groupId>
	        <artifactId>moditect-maven-plugin</artifactId>
	        <executions>
	          <execution>
	            <id>generate-module-info</id>
	            <phase>generate-sources</phase>
	            <goals>
	                <goal>generate-module-info</goal>
	            </goals>
	            <configuration>
	                <modules>
	                    <module>
	                        <artifact>
	                            <groupId>${project.groupId}</groupId>
	                            <artifactId>${project.artifactId}</artifactId>
<!-- 08-Mar-2019, tatu: Alas, due to JDK bug
       https://bugs.openjdk.java.net/browse/JDK-8207162
     this won't work...

	                            <version>${project.version}</version>
  -->
	                            <version>1.1.1</version>
	                        </artifact>
	                    </module>
	                </modules>
	            </configuration>
	          </execution>
	
	        </executions>
	      </plugin>
	   </plugins>
      </build>
    </profile>
  </profiles>
</project>
