<?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.modules</groupId>
    <artifactId>modules-parent</artifactId>
    <version>1.0</version>
    <relativePath />
  </parent>
  <artifactId>asciimath-utils</artifactId>
  <version>1.0.0</version>
  <packaging>bundle</packaging>
  <name>DAISY Pipeline 2 module :: ASCIIMath Utils</name>
  <dependencies>
    <dependency>
      <groupId>org.daisy.libs</groupId>
      <artifactId>com.xmlcalabash</artifactId>
      <version>1.0.3</version>
    </dependency>
    <dependency>
      <groupId>net.sf.saxon</groupId>
      <artifactId>Saxon-HE</artifactId>
      <version>9.4.0.7</version>
    </dependency>
    <dependency>
      <groupId>org.daisy.pipeline</groupId>
      <artifactId>calabash-adapter</artifactId>
      <version>1.0.0</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
        <version>1.6.4</version>
    </dependency>
  </dependencies>
  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
      <resource>
        <targetPath>javascript</targetPath>
        <directory>${basedir}/target/generated-resources/javascript</directory>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>download-javascript</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <tasks>
                <mkdir dir="target/generated-resources/javascript" />
                <!-- FIXME: what if this version changes? -->
                <get src="http://mathcs.chapman.edu/~jipsen/mathml/ASCIIMathML.js" dest="target/generated-resources/javascript" />
                <delete file="target/optimization-files/patches-applied.txt" />
              </tasks>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-patch-plugin</artifactId>
        <version>1.1.1</version>
        <configuration>
          <patchDirectory>src/main/patches</patchDirectory>
          <targetDirectory>target/generated-resources/javascript</targetDirectory>
          <patches>
            <patch>rhino.patch</patch>
          </patches>
        </configuration>
        <executions>
          <execution>
            <id>patch-javascript</id>
            <phase>process-resources</phase>
            <goals>
              <goal>apply</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <configuration>
          <instructions>
            <Service-Component>OSGI-INF/asciimathml.xml</Service-Component>
          </instructions>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <scm>
    <tag>v1.7</tag>
  </scm>
</project>
