-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild.gradle
154 lines (132 loc) · 4.29 KB
/
build.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
buildscript {
repositories {
mavenCentral()
maven { url "http://maven.restlet.org" }
}
dependencies {
classpath group: 'org.docbook', name: 'docbook-xslt2', version: '2.4.3'
classpath group: 'org.docbook', name: 'docbook-xsl-java-saxon', version: '1.2.1-95'
classpath group: 'org.docbook', name: 'docbook-schemas', version: '5.1-1'
classpath group: 'com.xmlcalabash', name: 'xmlcalabash1-print', version: '1.1.5'
classpath group: 'com.xmlcalabash', name: 'xmlcalabash1-gradle', version: '1.3.5'
classpath group: 'com.xmlcalabash', name: 'xmlcalabash', version: '1.1.29-99'
classpath group: 'org.xmlresolver', name: 'xmlresolver', version: '1.0.1'
}
}
repositories {
mavenLocal()
mavenCentral()
}
defaultTasks 'website'
apply plugin: 'org.docbook.task'
apply plugin: 'com.xmlcalabash.task'
import org.docbook.DocBookTask
import com.xmlcalabash.XMLCalabashTask
/* The default task. It just depends on all the necessary pages */
task website(dependsOn: ["dirpages"]) {
/* Nothing to see here */
}
/* All of the hand-authored pages */
def pages = [
'index',
'whatis',
'meetups',
'tc',
'help',
'sitemap',
'guidelines',
'docs/index',
'minutes/index',
'ns/docbook',
'ns/index',
'rfe/index',
'schemas/4x',
'schemas/4x-custom',
'schemas/5x',
'schemas/5x-custom',
'schemas/archives',
'schemas/index',
'specs/index',
'tdg/errata',
'tdg/index',
'tdg5/index',
'tdg5/publishers/index',
'tdg51/index',
'tools/index',
'docs/howto/index',
'docs/transclusion/index'
]
/* Create a task for each page to update it if necessary */
pages.each { page ->
String taskName = "page_" + page.replace("/", "_")
task "$taskName" (dependsOn: ['menus_home','gitlog'], type: DocBookTask) {
inputs.file "etc/menu.xml"
inputs.file "style/webpage.xsl"
input("source", "${page}.xml")
output("result", "${page}.html")
pipeline "style/webpage.xpl"
}
website.dependsOn(taskName)
}
/* The task that updates all of the page headers */
task menus_home(type: XMLCalabashTask) {
inputs.file "etc/menu.xml"
inputs.file "style/menus.xsl"
inputs.file "style/menus.xpl"
outputs.file "menus/PLACEHOLDER.html"
input("source", "etc/menu.xml")
output("result", "menus/PLACEHOLDER.html")
pipeline "style/menus.xpl"
}
/* Make the summary of the directory listings */
task dirlistings(type: Exec) {
inputs.files fileTree(dir: 'rng')
inputs.files fileTree(dir: 'sgml')
inputs.files fileTree(dir: 'xml')
inputs.files fileTree(dir: 'xsd')
inputs.files fileTree(dir: 'docbook-ng')
inputs.files fileTree(dir: 'release')
outputs.file "etc/dirlistings.xml"
if (System.getProperty('os.name').toLowerCase().contains('windows')) {
commandLine "cmd", "/c", "perl", "bin/find-distrib", "-o", "etc/dirlistings.xml"
} else {
commandLine "bin/find-distrib", "-o", "etc/dirlistings.xml"
}
}
/* Make the directory listings */
task dirpages(dependsOn: ['menus_home', 'dirlistings'], type: XMLCalabashTask) {
inputs.file "etc/dirlistings.xml"
inputs.file "etc/menu.xml"
inputs.file "style/dirlistings.xsl"
inputs.file "style/dirlistings.xpl"
outputs.file "xml/5.0/index.html"
input("source", "etc/dirlistings.xml")
pipeline "style/dirlistings.xpl"
}
/* Get the current git log in XML */
task gitlog(type: Exec) {
if (System.getProperty('os.name').toLowerCase().contains('windows')) {
commandLine "cmd", "/c", "perl", "bin/git-log-summary"
} else {
commandLine "bin/git-log-summary"
}
standardOutput = new FileOutputStream(new File("etc/git-log-summary.xml"))
}
task clean {
}
clean.doFirst {
delete "$buildDir"
delete ".gradle"
delete "menus/PLACEHOLDER.html"
delete "etc/dirlistings.xml"
/* Delete index.html files generated in releases */
[ "docbook-ng", "xsd", "rng", "sgml", "xml", "release" ].each { rel ->
delete "${rel}/index.html"
new File(rel).eachDirRecurse { dir ->
dir.eachFileMatch("index.html") { file ->
delete "$file"
}
}
}
pages.each { page -> delete "${page}.html" }
}