-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.gradle
More file actions
63 lines (53 loc) · 1.96 KB
/
Copy pathbuild.gradle
File metadata and controls
63 lines (53 loc) · 1.96 KB
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
plugins {
id 'com.nwalsh.gradle.saxon.saxon-gradle' version '0.9.3'
id 'com.nwalsh.gradle.relaxng.validate' version '0.0.6'
}
defaultTasks 'dist'
import com.nwalsh.gradle.saxon.SaxonXsltTask
import com.nwalsh.gradle.relaxng.validate.RelaxNGValidateTask
def FS = System.getProperty("file.separator");
task copy_data(type: Copy) {
into "${buildDir}/xmlresolverdata-${version}"
from ("${projectDir}/src/data") {
exclude "manifest.xml"
}
}
task make_data_catalog(type: SaxonXsltTask, dependsOn: ["copy_data"]) {
input "${projectDir}/src/data/manifest.xml"
output "${buildDir}/xmlresolverdata-${version}/catalog.xml"
outputs.file "${buildDir}/xmlresolverdata-${version}/cat-entities.xml"
outputs.file "${buildDir}/xmlresolverdata-${version}/cat-mathml2.xml"
outputs.file "${buildDir}/xmlresolverdata-${version}/cat-mathml3.xml"
outputs.file "${buildDir}/xmlresolverdata-${version}/cat-rddl.xml"
outputs.file "${buildDir}/xmlresolverdata-${version}/cat-svg.xml"
outputs.file "${buildDir}/xmlresolverdata-${version}/cat-xhtml.xml"
stylesheet "${projectDir}/tools/make-catalog.xsl"
}
task validate(dependsOn: ["make_data_catalog"]) {
// just some place to hang dependencies
}
make_data_catalog.outputs.files.each { xml ->
def fn = xml.toString()
def pos = fn.lastIndexOf(FS)
fn = fn.substring(pos+1)
Task t = project.task("validate_${fn}", type: RelaxNGValidateTask) {
dependsOn "make_data_catalog"
input xml
output "${buildDir}/validated/${fn}"
schema "${projectDir}/src/data/xmlcatalogs.org/schema/1.1/catalog.rng"
}
validate.dependsOn(t)
}
task copyNotices(type: Copy) {
from "${projectDir}/src/notices"
into "${buildDir}/xmlresolverdata-${version}/notices"
}
task dist(type: Zip, dependsOn: ["make_data_catalog", "validate", "copyNotices"]) {
from("$buildDir")
exclude(["dist", "validated"])
destinationDirectory = file("${buildDir}/dist")
archiveFileName = "xmlresolverdata-${relVersion}.zip"
}
task clean() {
delete buildDir
}