Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
import org.gradle.api.tasks.Exec
task initDOT {
String projectDir = "."
doLast {
if(! new File("${projectDir}/dita-ot/oxygen-publishing-engine-3.x/").exists()){
//https://www.oxygenxml.com/InstData/PublishingEngine/oxygen-publishing-engine-3.x.zip
ant.get(src: 'https://www.oxygenxml.com/InstData/PublishingEngine/oxygen-publishing-engine-3.x.zip', dest: "${projectDir}/dita-ot.zip", skipexisting: 'true')
ant.unzip(src: "${projectDir}/dita-ot.zip", dest: 'dita-ot')
new File("${projectDir}/dita-ot/oxygen-publishing-engine-3.x/licensekey.txt").write(System.getenv( 'LICENSE_KEY' ).replaceAll(" ", "\n"))
}
}
}
task runTransformation(type:Exec, dependsOn: [initDOT]) {
workingDir "${projectDir}/dita-ot/oxygen-publishing-engine-3.x/bin"
commandLine "sh", "${projectDir}/dita-ot/oxygen-publishing-engine-3.x/bin/dita", "--output=.", "--project", "${projectDir}/../blog-project.xml"
}
task copySite(type: Copy, dependsOn: [runTransformation]) {
from "${projectDir}/dita-ot/oxygen-publishing-engine-3.x/bin/site"
into "${projectDir}/../site"
}
task copyResources(type: Copy) {
from "${projectDir}/../resources/"
into "${projectDir}/../site/resources"
}
task initValidation {
String projectDir = "."
doLast {
if(! new File("${projectDir}/extracted/oxygen/").exists()){
ant.get(src: 'https://www.oxygenxml.com/InstData/Editor/All/oxygen.tar.gz', dest: "${projectDir}/oxygen.tar.gz", skipexisting: 'true')
ant.untar(src: "${projectDir}/oxygen.tar.gz", dest: "${projectDir}/extracted", compression: 'gzip')
new File("${projectDir}/extracted/oxygen/scriptinglicensekey.txt").write(System.getenv( 'SCRIPTING_LICENSE_KEY' ).replaceAll(" ", "\n"))
}
}
}
task runValidation(type:Exec, dependsOn: [initValidation]) {
workingDir "${projectDir}/extracted/oxygen"
commandLine "sh", "${projectDir}/extracted/oxygen/scripts/validateCheckDITA.sh", "-i", "${projectDir}/../blog-project.xml", "-r", "${projectDir}/extracted/oxygen/validationReport.xml"
ignoreExitValue true
doLast {
if(execResult.getExitValue() != 0) {
println new File("${projectDir}/extracted/oxygen/validationReport.xml").text
throw new TaskExecutionException( it,
new Exception( "Validation failed; "
+ "see task output for details." )
)
}
}
}
task postProcessValidation(dependsOn: [runValidation]) {
String projectDir = "."
doLast {
ant.replace(
file: '${projectDir}/../../site/validationReport.xml',
token: '<?xml version="1.0" encoding="UTF-8"?>',
value: '<?xml-stylesheet type="text/css" href="report.css"?>'
)
}
}
task dist(dependsOn: [copySite, copyResources])
defaultTasks 'dist'