Skip to content

Instantly share code, notes, and snippets.

@eerohele
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eerohele/0cb870824b51eb501cc5 to your computer and use it in GitHub Desktop.
Save eerohele/0cb870824b51eb501cc5 to your computer and use it in GitHub Desktop.
A minimal Gradle buildfile for running a DITA-OT transformation
defaultTasks 'ditaOt'
def ditaHome = System.env.DITA_HOME
def antHome = System.env.ANT_HOME
task ditaOt << {
ant.java(classname: "org.apache.tools.ant.launch.Launcher", fork: "true", failonerror: "true") {
ant.jvmarg(value: "-Dant.library.dir=${antHome}/lib")
ant.classpath {
ant.pathelement(location: "${antHome}/lib/ant-launcher.jar")
}
ant.arg(line: "-lib ${ditaHome}")
ant.arg(line: "-lib ${ditaHome}/lib")
// For DITA-OT < 2.0
ant.arg(line: "-lib ${ditaHome}/lib/saxon")
// For DITA-OT < 1.6
ant.arg(line: "-lib ${ditaHome}/demo/fo/fop/lib")
ant.arg(line: "-buildfile ${ditaHome}/build.xml")
// Properties passed to DITA-OT transformation
ant.sysproperty(key: "transtype", value: "xhtml")
ant.sysproperty(key: "args.input", value: "${inputFile}")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment