<?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>org.daisy.pipeline</groupId>
    <artifactId>framework-parent</artifactId>
    <version>1.14.4</version>
    <relativePath>../parent</relativePath>
  </parent>
  
  <artifactId>saxon-adapter</artifactId>
  <version>2.2.0</version>
  <packaging>bundle</packaging>
  
  <name>DAISY Pipeline 2 :: Adapter for Saxon</name>
  
  <dependencies>
    <dependency>
      <groupId>org.daisy.pipeline</groupId>
      <artifactId>common-utils</artifactId>
    </dependency>
    <dependency>
      <groupId>org.daisy.libs</groupId>
      <artifactId>saxon-he</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.compendium</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.daisy.pipeline</groupId>
      <artifactId>ds-to-spi-runtime</artifactId>
      <scope>provided</scope>
    </dependency>
    <!--
        runtime dependencies (for javax.xml.transform.URIResolver)
    -->
    <dependency>
      <groupId>org.daisy.pipeline</groupId>
      <artifactId>modules-registry</artifactId>
      <scope>runtime</scope>
    </dependency>
  </dependencies>
  
  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <excludes>
          <exclude>META-INF/services/*</exclude>
        </excludes>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <groupId>org.daisy.maven</groupId>
        <artifactId>xspec-maven-plugin</artifactId>
        <version>1.0.1</version>
        <dependencies>
          <dependency>
            <groupId>org.daisy.maven</groupId>
            <artifactId>xspec-runner</artifactId>
            <version>1.0.5</version>
          </dependency>
          <dependency>
            <groupId>org.daisy.pipeline</groupId>
            <artifactId>ds-to-spi-runtime</artifactId>
            <version>1.1.1</version>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <phase>test</phase>
            <goals>
              <goal>test</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <configuration>
          <instructions>
            <!-- must match version from framework-bom -->
            <Import-Package>
              net.sf.saxon.*;version="${saxon.versionRange}",
              !org.daisy.common.spi,
              *
            </Import-Package>
            <_dsannotations>
              org.daisy.common.saxon.SaxonConfigurator,
              org.daisy.common.saxon.impl.ProcessorImpl,
              org.daisy.common.saxon.impl.TransformerFactoryImpl,
              org.daisy.common.xpath.saxon.impl.XPathFactoryImpl,
              org.daisy.common.xpath.saxon.XPathFunctionRegistry
            </_dsannotations>
            <SPI-Provider>
              javax.xml.transform.TransformerFactory,
              javax.xml.xpath.XPathFactory
            </SPI-Provider>
          </instructions>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.daisy.pipeline.build</groupId>
        <artifactId>ds-to-spi-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>generate-spi-classes</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>generate-spi-classes</goal>
            </goals>
            <configuration>
              <includes>
                org.daisy.common.saxon.SaxonConfigurator,
                org.daisy.common.saxon.impl.ProcessorImpl,
                org.daisy.common.saxon.impl.TransformerFactoryImpl,
                org.daisy.common.xpath.saxon.impl.XPathFactoryImpl,
                org.daisy.common.xpath.saxon.XPathFunctionRegistry
              </includes>
            </configuration>
          </execution>
          <execution>
            <id>generate-spi-test-classes</id>
            <phase>process-test-sources</phase>
            <goals>
              <goal>generate-spi-test-classes</goal>
            </goals>
            <configuration>
              <includes>
                MyClass$Provider
              </includes>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>javadoc</id>
      <activation>
        <property>
          <name>documentation</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.daisy.pipeline.build</groupId>
            <artifactId>modules-build-helper</artifactId>
            <executions>
              <execution>
                <id>package-list</id>
                <phase>prepare-package</phase>
                <goals>
                  <goal>dependencies-package-list</goal>
                </goals>
                <configuration>
                  <outputDirectory>${project.build.directory}/dependencies-package-list/</outputDirectory>
                  <includes>
                    org.daisy.pipeline.*,
                    org.daisy.common.*
                  </includes>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
                <configuration>
                  <offlineLinks>
                    <offlineLink>
                      <url>http://daisy.github.io/pipeline/api/</url>
                      <location>${project.build.directory}/dependencies-package-list/</location>
                    </offlineLink>
                  </offlineLinks>
                  <links>
                    <link>https://google.github.io/guava/releases/15.0/api/docs</link>
                  </links>
                  <excludePackageNames>*.impl:*.impl.*</excludePackageNames>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>module-with-documentation-only</id>
      <activation>
        <property>
          <name>documentation-only</name>
        </property>
      </activation>
      <properties>
        <maven.main.skip>true</maven.main.skip>
        <maven.resources.skip>true</maven.resources.skip>
        <maven.test.skip>true</maven.test.skip>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <executions>
              <execution>
                <id>default-bundle</id>
                <phase>none</phase>
              </execution>
              <execution>
                <id>default-install</id>
                <phase>none</phase>
              </execution>
              <execution>
                <id>bundle-before-test</id>
                <phase>none</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>