forked from dita-ot/docs
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsite.gradle
78 lines (58 loc) · 2.05 KB
/
site.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
plugins {
id 'com.github.eerohele.dita-ot-gradle' version '0.3.1'
id 'com.github.eerohele.saxon-gradle' version '0.1.3'
}
import com.github.eerohele.SaxonXsltTask
defaultTasks 'dita'
// Use the DITA-OT dir defined by the dita.home system property. If undefined,
// assume we're in dita-ot/docsrc and use the parent directory.
def ditaHome = System.getProperty('dita.home', '../')
// Point DITA-OT Gradle Plugin to the DITA-OT directory.
ditaOt.dir ditaHome
def ditaHomeSrc = project.hasProperty("ditaHomeSrc") ? file("${ditaHomeSrc}") : file("${ditaHome}")
def resourceDir = "$ditaHomeSrc/resources"
def toURI(String directory) {
new URI(new File(directory).getAbsolutePath()).toString()
}
task messages(type: SaxonXsltTask) {
input "$resourceDir/messages.xml"
output "user-guide/DITA-messages.xml"
stylesheet "resources/messages.xsl"
}
task params(type: SaxonXsltTask) {
input "$resourceDir/plugins.xml"
output "parameters/all-parameters.dita"
stylesheet "resources/params.xsl"
parameters("output-dir.url": toURI("parameters"))
outputs.dir "${projectDir}/parameters"
}
task extensionPoints(type: SaxonXsltTask) {
input "$resourceDir/plugins.xml"
output "extension-points/all-extension-points.dita"
stylesheet "resources/extension-points.xsl"
parameters("output-dir.url": toURI("extension-points"))
outputs.dir "${projectDir}/extension-points"
}
def commit = new ByteArrayOutputStream()
task gitMetadata {
doLast {
exec {
workingDir = "${projectDir}"
commandLine 'git'
args = ['rev-parse', 'HEAD']
standardOutput = commit
}
}
}
task generateTopics(dependsOn: ['messages', 'params', 'extensionPoints', 'gitMetadata'])
dita {
dependsOn 'generateTopics'
input file('site.ditamap')
output System.getProperty('output.dir', new File(project.buildDir, 'site').getPath())
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}"
}
}