Skip to content

Commit

Permalink
Working with Ant, FOP 2.0+; making binary release zip.
Browse files Browse the repository at this point in the history
  • Loading branch information
tgraham-antenna committed Mar 22, 2018
1 parent 66c9697 commit 7dc76aa
Show file tree
Hide file tree
Showing 6 changed files with 381 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*~
*.zip
build
dist
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ The extension is available for Java and DotNet and uses either the Apache FOP XS

The single Java jar file covers four combinations of XSLT processor and XSL-FO formatter:

- Saxon 9.5 (and later) and FOP
- Saxon 9.5 (and later) and FOP 2.0
- Saxon 9.5 (and later) and AH Formatter
- Xalan and FOP
- Xalan and AH Formatter
- Xalan and FOP (possibly out-of-date)
- Xalan and AH Formatter (possibly out-of-date)

The DotNet version supports:

Expand Down
27 changes: 22 additions & 5 deletions build-nonb.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
<project name="FOPRunXSLTExt-nonb" default="default" basedir=".">
<description>Builds, tests, and runs the project FOPRunXSLTExt.</description>

<property name="zip.version" value="0.0.3" />

<import file="build.xml"/>

<target name="-pre-init">
<property file="properties.local.xml"/>
<property file="properties.xml"/>

<property name="xslt.extensions.version" value="0.1.0" />
<property name="zip.version" value="${xslt.extensions.version}" />

<condition property="prebuilt.lib"
value="${prebuilt.lib.windows}">
<and>
Expand Down Expand Up @@ -121,11 +122,27 @@
<chmod file="examples/runxalan_ahf61.sh" perm="ugo+rx"/>
</target>

<target name="zip.windows">
<zip destfile="FOPRunXSLTExt-windows-${zip.version}.zip">
<target name="zip" depends="-pre-init">
<zip destfile="XSLTExtensions-${zip.version}.zip">
<zipfileset dir="."
includes="README.md LICENSE.md properties.xml build-xslt-extensions.xml dist/*.jar bin/**"
prefix="XSLTExtensions-${zip.version}" />
</zip>
<zip destfile="XSLTExtensions-doc-${zip.version}.zip">
<zipfileset dir="."
includes="README.md LICENSE.md"
prefix="XSLTExtensions-${zip.version}" />
<zipfileset dir="dist"
includes="javadoc/**"
prefix="XSLTExtensions-doc-${zip.version}" />
</zip>
</target>

<target name="zip.windows" depends="-pre-init">
<zip destfile="XSLTExtensions-windows-${zip.version}.zip">
<zipfileset dir="examples"
includes="runsaxon9he_fop10.bat FOPRunXSLTExt.jar README example*.xml example*.xsl out"
prefix="FOPRunXSLTExt-windows-${zip.version}" />
prefix="XSLTExtensions-windows-${zip.version}" />
</zip>
</target>
</project>
259 changes: 259 additions & 0 deletions build-xslt-extensions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="xslt.extensions" basedir="."
xmlns:if="ant:if"
xmlns:unless="ant:unless">
<description>Run PPLCG XSLT extensions.</description>

<dirname property="xslt.extensions.basedir"
file="${ant.file.xslt.extensions}" />

<pathconvert property="xslt.extensions.basedir.converted" dirsep="/">
<path location="${xslt.extensions.basedir}" />
<!-- Ant under cygwin uses a lowercase drive letter, which some
Java programs don't recognise as a drive letter, so
translate. -->
<map from="c:" to="C:" />
<map from="d:" to="D:" />
<map from="e:" to="E:" />
</pathconvert>

<pathconvert property="basedir.converted" dirsep="/">
<path location="${basedir}" />
<!-- Ant under cygwin uses a lowercase drive letter, which some
Java programs don't recognise as a drive letter, so
translate. -->
<map from="c:" to="C:" />
<map from="d:" to="D:" />
<map from="e:" to="E:" />
</pathconvert>

<tstamp>
<format property="timestamp" pattern="yyyyMMdd" />
</tstamp>

<!-- XML file of properties determining or describing local
system configuration. -->
<property
name="xslt.extensions.system.local.properties.xml"
location="${xslt.extensions.basedir}/properties.local.xml"/>
<property file="${xslt.extensions.system.local.properties.xml}" />
<!-- Local file of properties determining or describing system
configuration. -->
<property
name="xslt.extensions.system.local.properties"
location="${xslt.extensions.basedir}/system.local.properties" />
<property file="${xslt.extensions.system.local.properties}" />

<!-- XML file of properties determining or describing system
configuration. -->
<property
name="xslt.extensions.system.properties.xml"
location="${xslt.extensions.basedir}/properties.xml"/>
<property file="${xslt.extensions.system.properties.xml}" />
<!-- File of properties determining or describing system
configuration. -->
<property
name="xslt.extensions.system.properties"
location="${xslt.extensions.basedir}/system.properties" />
<property file="${xslt.extensions.system.properties}" />

<!-- Environment variables as properties prefixed with 'env.'. -->
<property environment="env" />

<property name="force" value="false" />
<property name="tagged" value="false" />
<property name="verbose" value="false" />

<!-- Directory containing PPLCG XSLT Extensions jar file. -->
<property name="xslt.extensions.dist.dir"
value="${xslt.extensions.basedir.converted}/dist" />

<property name="saxon.basename" value="saxon9he" />
<!-- saxon.jar location depends on OS. -->
<property name="saxon.jar.windows"
value="${saxon.lib.windows}/${saxon.basename}.jar" />
<condition property="saxon.jar" value="${saxon.jar.windows}">
<and>
<os family="windows" />
<available file="${saxon.jar.windows}"/>
</and>
</condition>
<property name="saxon.jar.mac"
value="${saxon.lib.mac}/${saxon.basename}.jar" />
<condition property="saxon.jar" value="${saxon.jar.mac}">
<and>
<os family="mac" />
<available file="${saxon.jar.mac}"/>
</and>
</condition>
<property name="saxon.jar.unix"
value="${saxon.lib.unix}/${saxon.basename}.jar" />
<condition property="saxon.jar" value="${saxon.jar.unix}">
<and>
<os family="unix" />
<available file="${saxon.jar.unix}"/>
</and>
</condition>
<property name="saxon.jar" value="${saxon.jar.unix}" />
<!-- Fallback to something that almost certainly won't work. -->
<property name="saxon.jar" value="saxon.jar" />

<property name="fop.basename" value="fop" />
<!-- fop.jar location depends on OS. -->
<property name="fop.jar.windows"
value="${fop.dir.windows}/build/${fop.basename}.jar" />
<condition property="fop.jar" value="${fop.jar.windows}">
<and>
<os family="windows" />
<available file="${fop.jar.windows}"/>
</and>
</condition>
<property name="fop.jar.mac"
value="${fop.dir.mac}/build/${fop.basename}.jar" />
<condition property="fop.jar" value="${fop.jar.mac}">
<and>
<os family="mac" />
<available file="${fop.jar.mac}"/>
</and>
</condition>
<property name="fop.jar.unix"
value="${fop.dir.unix}/build/${fop.basename}.jar" />
<condition property="fop.jar" value="${fop.jar.unix}">
<and>
<os family="unix" />
<available file="${fop.jar.unix}"/>
</and>
</condition>
<property name="fop.jar" value="${fop.jar.unix}" />
<!-- Fallback to something that almost certainly won't work. -->
<property name="fop.jar" value="fop.jar" />

<!-- Prebuilt lib location depends on OS. -->
<condition property="prebuilt.lib" value="${prebuilt.lib.windows}">
<and>
<os family="windows" />
<available file="${prebuilt.lib.windows}"/>
</and>
</condition>
<condition property="prebuilt.lib" value="${prebuilt.lib.mac}">
<and>
<os family="mac" />
<available file="${prebuilt.lib.mac}"/>
</and>
</condition>
<condition property="prebuilt.lib" value="${prebuilt.lib.unix}">
<and>
<os family="unix" />
<available file="${prebuilt.lib.unix}"/>
</and>
</condition>

<property name="xslt.extensions.basename" value="FOPRunXSLTExt" />
<property
name="xslt.extensions.jar"
value="${xslt.extensions.dist.dir}/${xslt.extensions.basename}.jar" />
<!-- XSL Formatter to use: 'ahf' or 'fop' -->
<property name="xslt.extensions.formatter" value="ahf" />

<!-- AH Formatter location, for when using AH Formatter. -->
<condition property="ahf.dir" value="${env.AHF65_64_HOME}">
<available file="${env.AHF65_64_HOME}" type="dir" />
</condition>
<condition property="ahf.dir" value="${env.AHF64_64_HOME}">
<available file="${env.AHF64_64_HOME}" type="dir" />
</condition>
<condition property="ahf.dir" value="${env.AHF63_64_HOME}">
<available file="${env.AHF63_64_HOME}" type="dir" />
</condition>

<!-- AH Formatter 'lib' directory -->
<property name="ahf.lib.dir" value="${ahf.dir}/lib" />
<!-- Basename of AH Formatter Java interface jar -->
<property name="xfojavactl.basename" value="XfoJavaCtl" />
<!-- Location of AH Formatter jar file -->
<property name="xfojavactl.jar"
value="${ahf.lib.dir}/${xfojavactl.basename}.jar" />

<macrodef name="xslt.extensions.saxon"
description="Run Saxon with PPLCG XSLT extensions">
<attribute name="formatter" default="${xslt.extensions.formatter}"
description="XSL Formatter: 'ahf' or 'fop'" />
<attribute name="in"
description="Single XML document to be styled" />
<attribute name="xsl"
description="Location of XSLT stylesheet" />
<attribute name="out"
description="Output name for the styled result" />
<attribute name="fop.jar" default="${fop.jar}"
description="Location of FOP jar file" />
<attribute name="prebuilt.lib" default="${prebuilt.lib}"
description="Location of library jar files" />
<attribute name="saxon.jar" default="${saxon.jar}"
description="Location of Saxon jar file" />
<attribute name="xslt.extensions.jar" default="${xslt.extensions.jar}"
description="Location of PPLCG XSLT Extensions jar file" />
<attribute name="xfojavactl.jar" default="${xfojavactl.jar}"
description="Location of AH Formatter jar file" />
<attribute name="verbose" default="${verbose}"
description="Whether to be verbose" />
<element name="args" implicit="yes" optional="yes"
description="Arguments" />
<sequential>
<local name="isfop" />
<condition property="isfop">
<equals
arg1="${xslt.extensions.formatter}"
arg2="fop" />
</condition>
<java classname="net.sf.saxon.Transform"
fork="yes">
<classpath>
<pathelement location="@{fop.jar}" if:set="isfop" />
<pathelement
location="@{prebuilt.lib}/xmlgraphics-commons-2.0.1.jar"
if:set="isfop" />
<pathelement
location="@{prebuilt.lib}/commons-logging-1.0.4.jar"
if:set="isfop" />
<pathelement
location="@{prebuilt.lib}/commons-io-1.3.1.jar"
if:set="isfop" />
<pathelement
location="@{prebuilt.lib}/avalon-framework-4.2.0.jar"
if:set="isfop" />
<pathelement
location="@{prebuilt.lib}/batik-all-1.8.jar"
if:set="isfop" />
<pathelement
location="@{prebuilt.lib}/serializer-2.7.0.jar"
if:set="isfop" />
<pathelement
location="@{prebuilt.lib}/xalan-2.7.0.jar"
if:set="isfop" />
<pathelement
location="@{prebuilt.lib}/xercesImpl-2.7.1.jar"
if:set="isfop" />
<pathelement
location="@{saxon.jar}" />
<pathelement location="@{xslt.extensions.jar}" />
<pathelement
location="@{xfojavactl.jar}" unless:set="isfop" />
</classpath>
<arg value="-init:org.w3c.ppl.xslt.ext.fop.saxon.RunFOPExtInitializer" if:set="isfop" />
<arg value="-init:org.w3c.ppl.xslt.ext.ahf.saxon.RunAHFExtInitializer" unless:set="isfop" />
<arg value="-s:@{in}" />
<arg value="-xsl:@{xsl}" />
<arg value="-o:@{out}" />
<arg value="ppl-formatter=@{formatter}" />
<args />
</java>
</sequential>
</macrodef>

<!-- Utility targets. -->

<target name="echoproperties">
<echoproperties />
</target>

</project>
Loading

0 comments on commit 7dc76aa

Please sign in to comment.