Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export SITE_DIR=$PWD/dita-ot.github.io
# Remove target output directory before generating new output
rm -rf "$SITE_DIR/dev"
# Re-create /dev folder & generate site output there
./gradlew -b site.gradle -Ddita.home=$DITA_HOME -Doutput.dir=$SITE_DIR/dev -PditaHomeSrc=$DITA_OT_DEV --info --stacktrace --no-daemon
./gradlew site -PditaHome=$DITA_HOME -PoutputDir=$SITE_DIR/dev -PditaHomeSrc=$DITA_OT_DEV --info --stacktrace --no-daemon
#else
# ./gradlew -Ddita.home=$DITA_HOME html --info --stacktrace --no-daemon
# ./gradlew -PditaHome=$DITA_HOME html --info --stacktrace --no-daemon
#fi
148 changes: 126 additions & 22 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,46 +1,150 @@
plugins {
id 'com.github.eerohele.dita-ot-gradle' version '0.4.2'
id 'com.github.eerohele.dita-ot-gradle' version '0.4.3'
id 'com.github.eerohele.saxon-gradle' version '0.3.0'
}

ditaOt.dir System.getProperty('dita.home', '../')
import com.github.eerohele.DitaOtTask
import com.github.eerohele.SaxonXsltTask

import com.github.eerohele.AntBuilderAssistant
def antBuilder = AntBuilderAssistant.getAntBuilder(project)
def getPropertyOrDefault(String name, def defaultValue) {
hasProperty(name) ? findProperty(name) : defaultValue
}

task pdf {
doLast {
antBuilder.execute {
ant(antfile: 'build.xml', target: 'pdf')
String ditaHome = getPropertyOrDefault('ditaHome', projectDir.getParent())
String ditaHomeSrc = getPropertyOrDefault('ditaHomeSrc', ditaHome)
String configDir = "${ditaHomeSrc}/config"
String ditavalFile = "${projectDir}/platform.ditaval"
Boolean toolkitBuild = file("${projectDir}/../lib/dost.jar").exists()
String samplesDir = toolkitBuild ? "${ditaHome}/docsrc/samples" : "${projectDir}/samples"
String outputDir = getPropertyOrDefault('outputDir', toolkitBuild ? "${ditaHome}/doc" : "${projectDir}/out")

String toURI(String path) {
file(path).toURI().toString()
}

ditaOt.dir ditaHome

task messages(type: SaxonXsltTask) {
input "${configDir}/messages.xml"
output "${projectDir}/user-guide/DITA-messages.xml"
stylesheet "${projectDir}/resources/messages.xsl"
}

task params(type: SaxonXsltTask) {
input "${configDir}/plugins.xml"
output "${projectDir}/parameters/all-parameters.dita"
stylesheet "${projectDir}/resources/params.xsl"
parameters('output-dir.url': toURI('parameters'))
outputs.dir "${projectDir}/parameters"
}

task extensionPoints(type: SaxonXsltTask) {
input "${configDir}/plugins.xml"
output "${projectDir}/extension-points/all-extension-points.dita"
stylesheet "${projectDir}/resources/extension-points.xsl"
parameters('output-dir.url': toURI('extension-points'))
outputs.dir "${projectDir}/extension-points"
}

task generatePlatformFilter {
ant.condition(property: 'platform', value: 'windows') {
os(family: 'windows')
}

ant.condition(property: 'platform', value: 'osx' ) {
os(family: 'mac')
}

ant.condition(property: 'platform', value: 'unix' ) {
os(family: 'unix')
}

ant.echoxml(file: ditavalFile) {
val {
prop(action: 'include', att: 'platform', val: platform)
prop(action: 'exclude', att: 'platform')
}
}
}
}

task html {
doLast {
antBuilder.execute {
ant(antfile: 'build.xml', target: 'html')
task autoGenerate(dependsOn: [messages, params, extensionPoints, generatePlatformFilter]) {
description 'Run tasks that generate content from resource files and the build environment.'
}

task pdf(type: DitaOtTask, dependsOn: autoGenerate) {
input "${projectDir}/userguide-book.ditamap"
output outputDir
transtype 'pdf'

properties {
property(file: "${projectDir}/samples/properties/docs-build-pdf.properties")
}
}
}

task htmlhelp {
doLast {
antBuilder.execute {
ant(antfile: 'build.xml', target: 'htmlhelp')
task html(type: DitaOtTask, dependsOn: autoGenerate) {
input "${projectDir}/userguide.ditamap"
output outputDir
transtype 'html5'

properties {
property(file: "${projectDir}/samples/properties/docs-build-html5.properties")
}
}

task htmlhelp(type: DitaOtTask, dependsOn: autoGenerate) {
input "${projectDir}/userguide.ditamap"
output outputDir
transtype 'htmlhelp'
filter ditavalFile

properties {
property(file: "${projectDir}/samples/properties/docs-build-htmlhelp.properties")
}

doLast {
ant.move(todir: outputDir, failonerror: 'no') {
fileset(dir: "${outputDir}/htmlhelp", includes: '*.chm')
}

ant.delete(dir: "${outputDir}/htmlhelp")
}
}
}

task cleanUp {
doLast {
ant.delete(dir: outputDir)
}
}

def commit = new ByteArrayOutputStream()

task gitMetadata {
doLast {
antBuilder.execute {
ant(antfile: 'build.xml', target: 'clean')
exec {
workingDir = projectDir
commandLine 'git'
args = ['rev-parse', 'HEAD']
standardOutput = commit
}
}
}

task all(dependsOn: [pdf, html, htmlhelp])
task site(type: DitaOtTask) {
dependsOn 'messages', 'params', 'extensionPoints', 'gitMetadata'

input file("${projectDir}/site.ditamap")
output getPropertyOrDefault('outputDir', "${buildDir}/site")

transtype 'org.dita-ot.html'

properties {
property(name: 'args.gen.task.lbl', value: 'YES')
property(name: 'args.rellinks', value: 'noparent')
property(name: 'commit', value: commit)
}
}

task all(dependsOn: [pdf, html, htmlhelp])
task dist(dependsOn: [pdf, html])

defaultTasks 'dist'
183 changes: 0 additions & 183 deletions build.xml

This file was deleted.

Loading