forked from xproc/3.0-grammar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
208 lines (173 loc) · 5.25 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
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://maven.restlet.org" }
}
// 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_schemas"], type: Copy) {
from "build/"
into "build/dist/"
include "*.rn?"
doFirst {
mkdir("build/dist")
}
}
// ======================================================================
def stepList = [ "step-file", "step-os", "step-paged-media",
"step-run", "step-text", "step-validation", "steps" ]
// ======================================================================
task xproc_library(type: XMLCalabashTask) {
// N.B. Because Travis jobs cannot see the filesystem, we have
// to list the dependencies twice. :-(
String steps = ""
stepList.each { s ->
steps = steps + " ../../build/" + s + "/library.xml"
}
inputs.files(fileTree(dir: 'build').include("**/library.xml"))
inputs.file "tools/xpl/make-library.xpl"
inputs.file "tools/xsl/make-library.xsl"
input("source", "build/steps/library.xml")
output("result", "build/dist/library.xpl")
param("libraries", steps)
pipeline "tools/xpl/make-library.xpl"
doFirst {
mkdir("build/dist")
}
}
// ======================================================================
// Make sure that xproc_library depends on each of the schemas
stepList.each { spec ->
[ "library.xml", "steps.rnc", "steps.rng" ].each { fn ->
Task t = task "download_${spec}_${fn}"(type: Copy) {
from "steps/$spec/$fn"
into "$buildDir/$spec/"
doFirst { mkdir "$buildDir/$spec" }
}
xproc_library.dependsOn t
}
}
// ======================================================================
// XProc schemas
task core_rng(type: JavaExec) {
classpath = configurations.tools
main = 'com.thaiopensource.relaxng.translate.Driver'
args = ["src/main/schema/core30.rnc", "build/core30.rng"]
doFirst {
mkdir("build")
}
}
task xproc30_rng(type: XMLCalabashTask,
dependsOn: [ "core_rng", "xproc_library" ]) {
// N.B. Because Travis jobs cannot see the filesystem, we have
// to list the dependencies twice. :-(
String files = ""
stepList.each { s->
files = files + " ../../build/" + s + "/steps.rng"
}
inputs.file "build/core30.rng"
inputs.file "tools/xpl/make-rng.xpl"
inputs.file "tools/xsl/make-rng.xsl"
outputs.file "build/xproc30.rng"
input("source", "build/core30.rng")
output("result", "build/xproc30.rng")
param("libraries", files)
pipeline "tools/xpl/make-rng.xpl"
}
task xproc30_rnc(dependsOn: [ "xproc30_rng" ], type: JavaExec) {
inputs.file "build/xproc30.rng"
outputs.file "build/xproc30.rnc"
classpath = configurations.tools
main = 'com.thaiopensource.relaxng.translate.Driver'
args = ["build/xproc30.rng", "build/xproc30.rnc"]
doFirst {
mkdir("build")
}
}
task xproc10_rnc(type: Copy) {
from "src/main/schema/"
into "build/"
include "xproc10.rnc"
doFirst {
mkdir("build")
}
}
task xproc_rnc(type: Copy) {
from "src/main/schema/"
into "build/"
include "xproc.rnc"
doFirst {
mkdir("build")
}
}
task xproc10_rng(dependsOn: [ "xproc10_rnc" ], type: JavaExec) {
inputs.file "build/xproc10.rnc"
outputs.file "build/xproc10.rng"
classpath = configurations.tools
main = 'com.thaiopensource.relaxng.translate.Driver'
args = ["build/xproc10.rnc", "build/xproc10.rng"]
}
task xproc_rng(dependsOn: [ "xproc_rnc" ], type: JavaExec) {
inputs.file "build/xproc.rnc"
outputs.file "build/xproc.rng"
classpath = configurations.tools
main = 'com.thaiopensource.relaxng.translate.Driver'
args = ["build/xproc.rnc", "build/xproc.rng"]
}
task xproc_schemas(dependsOn: [ "xproc30_rnc", "xproc30_rng", "xproc10_rng", "xproc_rng" ],
type: JavaExec) {
inputs.file "tools/xpl/smoke-test.xpl"
classpath = configurations.tools
main = 'com.thaiopensource.relaxng.util.Driver'
args = ["-i", "-c", "build/xproc.rnc", "tools/xpl/smoke-test.xpl" ]
}
// ======================================================================
// Clean up
clean {
doFirst {
delete("build")
}
}