-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.gradle
302 lines (255 loc) · 8.52 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://maven.restlet.talend.com" }
}
// Get rid of that [expletive deleted] warning about xml-apis 2.0.2/1.0.b2
configurations.all {
resolutionStrategy {
force 'xml-apis:xml-apis:1.4.01'
}
}
dependencies {
classpath group: 'com.xmlcalabash', name: 'xmlcalabash1-gradle', version: '1.4.0'
classpath group: 'com.xmlcalabash', name: 'xmlcalabash', version: '1.1.30-99'
classpath group: 'org.xmlresolver', name: 'xmlresolver', version: '1.0.6'
}
}
plugins {
id "de.undercouch.download" version "3.4.3"
id "groovy"
}
repositories {
mavenLocal()
mavenCentral()
}
// Get rid of that [expletive deleted] warning about xml-apis 2.0.2/1.0.b2
configurations.all {
resolutionStrategy {
force 'xml-apis:xml-apis:1.4.01'
force 'org.xmlresolver:xmlresolver:1.0.1'
}
}
configurations {
tools {
description = "Run tools"
transitive = true
}
}
dependencies {
tools (
[group: 'org.relaxng', name: 'jing', version: '20181222'],
[group: 'org.relaxng', name: 'trang', version: '20181222']
)
}
defaultTasks 'schemas'
apply plugin: 'com.xmlcalabash.task'
import com.xmlcalabash.XMLCalabashTask
import de.undercouch.gradle.tasks.download.Download
// ======================================================================
task schemas(dependsOn: ["xproc_schemas31", "xproc_schemas30"]) {
}
// ======================================================================
def stepList30 = [ "step-file", "step-os", "step-paged-media",
"step-text", "step-validation", "steps" ]
def stepList31 = [ "step-file", "step-ixml", "step-mail", "step-os", "step-paged-media",
"step-text", "step-validation", "steps" ]
// ======================================================================
task xproc_library31(
type: XMLCalabashTask,
dependsOn: [ "xproc10_rnc", "xproc_rnc" ]
) {
// N.B. Because Travis jobs cannot see the filesystem, we have
// to list the dependencies twice. :-(
String steps = ""
stepList31.each { s ->
steps = steps + " ../../build/3.1/" + s + "/library.xml"
}
inputs.files(fileTree(dir: 'build/3.1').include("**/library.xml"))
inputs.file "tools/xpl/make-library.xpl"
inputs.file "tools/xsl/make-library.xsl"
input("source", "build/3.1/steps/library.xml")
output("result", "build/dist/3.1/library.xpl")
param("libraries", steps)
pipeline "tools/xpl/make-library.xpl"
}
task xproc_library30(
type: XMLCalabashTask,
dependsOn: [ "xproc10_rnc", "xproc_rnc" ]
) {
// N.B. Because Travis jobs cannot see the filesystem, we have
// to list the dependencies twice. :-(
String steps = ""
stepList30.each { s ->
steps = steps + " ../../build/3.0/" + s + "/library.xml"
}
inputs.files(fileTree(dir: 'build/3.0').include("**/library.xml"))
inputs.file "tools/xpl/make-library.xpl"
inputs.file "tools/xsl/make-library.xsl"
input("source", "build/3.0/steps/library.xml")
output("result", "build/dist/3.0/library.xpl")
param("libraries", steps)
pipeline "tools/xpl/make-library.xpl"
}
// ======================================================================
// Make sure that xproc_library depends on each of the schemas
stepList30.each { spec ->
[ "library.xml", "steps.rnc", "steps.rng" ].each { fn ->
Task t = task "download_30_${spec}_${fn}"(type: Copy) {
from "steps/3.0/$spec/$fn"
into "$buildDir/3.0/$spec/"
doFirst { mkdir "$buildDir/3.0/$spec" }
}
xproc_library30.dependsOn t
}
}
stepList31.each { spec ->
[ "library.xml", "steps.rnc", "steps.rng" ].each { fn ->
Task t = task "download_31_${spec}_${fn}"(type: Copy) {
from "steps/3.1/$spec/$fn"
into "$buildDir/3.1/$spec/"
doFirst { mkdir "$buildDir/3.1/$spec" }
}
xproc_library31.dependsOn t
}
}
// ======================================================================
// XProc schemas
task core31_rng(type: JavaExec) {
classpath = configurations.tools
mainClass = 'com.thaiopensource.relaxng.translate.Driver'
args = ["src/main/schema/core31.rnc", "build/3.1/core31.rng"]
doFirst {
mkdir("build/3.1")
}
}
task xproc31_rng(type: XMLCalabashTask,
dependsOn: [ "core31_rng", "xproc_library31" ]) {
// N.B. Because Travis jobs cannot see the filesystem, we have
// to list the dependencies twice. :-(
String files = ""
stepList30.each { s ->
files = files + " ../../build/3.1/" + s + "/steps.rng"
}
inputs.file "build/3.1/core31.rng"
inputs.file "tools/xpl/make-rng.xpl"
inputs.file "tools/xsl/make-rng.xsl"
outputs.file "build/3.1/xproc31.rng"
input("source", "build/3.1/core31.rng")
output("result", "build/3.1/xproc31.rng")
param("libraries", files)
pipeline "tools/xpl/make-rng.xpl"
}
task xproc31_rnc(dependsOn: [ "xproc31_rng" ], type: JavaExec) {
inputs.file "build/3.1/xproc31.rng"
outputs.file "build/3.1/xproc31.rnc"
classpath = configurations.tools
mainClass = 'com.thaiopensource.relaxng.translate.Driver'
args = ["build/3.1/xproc31.rng", "build/3.1/xproc31.rnc"]
doLast {
copy {
from "build/3.1"
into "build/lib"
include "core*"
}
}
}
task core30_rng(type: JavaExec) {
classpath = configurations.tools
mainClass = 'com.thaiopensource.relaxng.translate.Driver'
args = ["src/main/schema/core30.rnc", "build/3.0/core30.rng"]
doFirst {
mkdir("build/3.0")
}
}
task xproc30_rng(type: XMLCalabashTask,
dependsOn: [ "core30_rng", "xproc_library30" ]) {
// N.B. Because Travis jobs cannot see the filesystem, we have
// to list the dependencies twice. :-(
String files = ""
stepList30.each { s->
files = files + " ../../build/3.0/" + s + "/steps.rng"
}
inputs.file "build/3.0/core30.rng"
inputs.file "tools/xpl/make-rng.xpl"
inputs.file "tools/xsl/make-rng.xsl"
outputs.file "build/3.0/xproc30.rng"
input("source", "build/3.0/core30.rng")
output("result", "build/3.0/xproc30.rng")
param("libraries", files)
pipeline "tools/xpl/make-rng.xpl"
}
task xproc30_rnc(dependsOn: [ "xproc30_rng" ], type: JavaExec) {
inputs.file "build/3.0/xproc30.rng"
outputs.file "build/3.0/xproc30.rnc"
classpath = configurations.tools
mainClass = 'com.thaiopensource.relaxng.translate.Driver'
args = ["build/3.0/xproc30.rng", "build/3.0/xproc30.rnc"]
doLast {
copy {
from "build/3.0"
into "build/lib"
include "core*"
}
}
}
task xproc10_rnc(type: Copy) {
from "src/main/schema/"
into "build/1.0/"
include "xproc10.rnc"
doFirst {
mkdir("build/1.0")
}
}
task xproc_rnc(type: Copy) {
from "src/main/schema/"
into "build/relax-ng"
include "xproc.rnc"
doFirst {
mkdir("build")
}
}
task xproc10_rng(dependsOn: [ "xproc10_rnc", "xproc_rnc" ], type: JavaExec) {
inputs.file "build/1.0/xproc10.rnc"
outputs.file "build/1.0/xproc10.rng"
classpath = configurations.tools
mainClass = 'com.thaiopensource.relaxng.translate.Driver'
args = ["build/1.0/xproc10.rnc", "build/1.0/xproc10.rng"]
}
task xproc_rnc_to_rng(dependsOn: [ "xproc31_rnc", "xproc30_rnc", "xproc10_rnc", "xproc_rnc" ], type: JavaExec) {
inputs.file "build/relax-ng/xproc.rnc"
outputs.file "build/relax-ng/xproc.rng"
classpath = configurations.tools
mainClass = 'com.thaiopensource.relaxng.translate.Driver'
args = ["build/relax-ng/xproc.rnc", "build/relax-ng/xproc.rng"]
}
// Convert *back* to rnc from rng to remove relative paths
task xproc_rng(dependsOn: [ "xproc_rnc_to_rng" ], type: JavaExec) {
inputs.file "build/relax-ng/xproc.rng"
outputs.file "build/relax-ng/xproc.rnc"
classpath = configurations.tools
mainClass = 'com.thaiopensource.relaxng.translate.Driver'
args = ["build/relax-ng/xproc.rng", "build/relax-ng/xproc.rnc"]
}
task xproc_schemas31(dependsOn: [ "xproc31_rnc", "xproc31_rng", "xproc10_rng", "xproc_rng" ],
type: JavaExec) {
inputs.file "tools/xpl/smoke-test.xpl"
classpath = configurations.tools
mainClass = 'com.thaiopensource.relaxng.util.Driver'
args = ["-i", "-c", "build/3.1/xproc31.rnc", "tools/xpl/smoke-test.xpl" ]
}
task xproc_schemas30(dependsOn: [ "xproc30_rnc", "xproc30_rng", "xproc10_rng", "xproc_rng" ],
type: JavaExec) {
inputs.file "tools/xpl/smoke-test.xpl"
classpath = configurations.tools
mainClass = 'com.thaiopensource.relaxng.util.Driver'
args = ["-i", "-c", "build/3.0/xproc30.rnc", "tools/xpl/smoke-test-31.xpl" ]
}
// ======================================================================
// Clean up
clean {
doFirst {
delete("build")
}
}