@@ -11,14 +11,17 @@ buildscript {
11
11
configurations. all {
12
12
resolutionStrategy {
13
13
force ' xml-apis:xml-apis:1.4.01' ,
14
- " ${ saxonGroup} :${ saxonEdition} :${ saxonVersion} "
14
+ " ${ saxonGroup} :${ saxonEdition} :${ saxonVersion} " ,
15
+ " org.xmlresolver:xmlresolver:${ xmlresolverVersion} "
15
16
}
16
17
}
17
18
18
19
dependencies {
19
20
classpath group : saxonGroup, name : saxonEdition, version : saxonVersion
20
21
classpath group : ' com.drewnoakes' , name : ' metadata-extractor' , version : metadataExtractorVersion
21
22
classpath group : ' com.nwalsh' , name : ' sinclude' , version : sincludeVersion
23
+ classpath group : ' org.docbook' , name : ' schemas-docbook' , version : ' 5.2b10-SNAPSHOT'
24
+ classpath group : ' org.docbook' , name : ' schemas-publishers' , version : ' 5.2b10-SNAPSHOT'
22
25
}
23
26
}
24
27
@@ -29,6 +32,8 @@ plugins {
29
32
id " signing"
30
33
// id 'com.github.eerohele.saxon-gradle' version '0.9.0-beta3'
31
34
id ' com.nwalsh.saxon-gradle' version ' 0.9.1-beta4'
35
+ id ' com.nwalsh.gradle.relaxng.validate' version ' 0.0.6'
36
+ id ' com.nwalsh.gradle.relaxng.translate' version ' 0.0.6'
32
37
id " de.undercouch.download" version " 4.0.4"
33
38
}
34
39
@@ -42,6 +47,8 @@ sourceSets {
42
47
43
48
// import com.github.eerohele.SaxonXsltTask
44
49
import com.nwalsh.SaxonXsltTask
50
+ import com.nwalsh.gradle.relaxng.validate.RelaxNGValidateTask
51
+ import com.nwalsh.gradle.relaxng.translate.RelaxNGTranslateTask
45
52
46
53
import de.undercouch.gradle.tasks.download.Download
47
54
@@ -57,7 +64,8 @@ apply from: 'properties.gradle'
57
64
configurations. all {
58
65
resolutionStrategy {
59
66
force ' xml-apis:xml-apis:1.4.01' ,
60
- " ${ saxonGroup} :${ saxonEdition} :${ saxonVersion} "
67
+ " ${ saxonGroup} :${ saxonEdition} :${ saxonVersion} " ,
68
+ " org.xmlresolver:xmlresolver:${ xmlresolverVersion} "
61
69
}
62
70
}
63
71
@@ -260,45 +268,6 @@ task setupXSpec(type: Download) {
260
268
onlyIf { ! file(" ${ buildDir} /xspec-${ xspecVersion} /README.md" ). exists() }
261
269
}
262
270
263
- task setupDocBook (type : Download ) {
264
- src " ${ docbookBaseURI} /${ docbookVersion} /docbook-${ docbookVersion} .zip"
265
- dest file(" ${ buildDir} /docbook-${ docbookVersion} .zip" )
266
- doFirst {
267
- mkdir(buildDir)
268
- }
269
- doLast {
270
- copy {
271
- from zipTree(" ${ buildDir} /docbook-${ docbookVersion} .zip" )
272
- into buildDir
273
- }
274
- }
275
- onlyIf { ! file(" ${ buildDir} /docbook-${ docbookVersion} /catalog.xml" ). exists() }
276
- }
277
-
278
- task setup_docbook (dependsOn : " setupDocBook" ) {
279
- // just an alias for computed reference
280
- }
281
-
282
- task setupPublishers (type : Download ) {
283
- src " ${ docbookBaseURI} /${ publishersVersion} /publishers-${ publishersVersion} .zip"
284
- dest file(" ${ buildDir} /publishers-${ publishersVersion} .zip" )
285
- doFirst {
286
- mkdir(buildDir)
287
- }
288
- doLast {
289
- copy {
290
- from zipTree(" ${ buildDir} /publishers-${ publishersVersion} .zip" )
291
- into buildDir
292
- }
293
- }
294
-
295
- onlyIf { ! file(" ${ buildDir} /publishers-${ publishersVersion} /catalog.xml" ). exists() }
296
- }
297
-
298
- task setup_publishers (dependsOn : " setupPublishers" ) {
299
- // just an alias for computed reference
300
- }
301
-
302
271
task setupXsltExplorer (type : Download ) {
303
272
outputs. file " ${ buildDir} /xsltexplorer-${ xsltExplorerVersion} /xslt/explorer.xsl"
304
273
@@ -317,27 +286,6 @@ task setupXsltExplorer(type: Download) {
317
286
onlyIf { ! file(" ${ buildDir} /xsltexplorer-${ xsltExplorerVersion} /README.org" ). exists() }
318
287
}
319
288
320
- task setup_transclusion (type : JavaExec , dependsOn : [" setup_docbook" ]) {
321
- inputs. file " ${ projectDir} /src/test/resources/transclude.rnc"
322
- outputs. file " ${ buildDir} /transclude.rng"
323
-
324
- doFirst {
325
- copy {
326
- into buildDir
327
- from (" ${ projectDir} /src/test/resources" ) {
328
- include " transclude.rnc"
329
- }
330
- filter { String line ->
331
- line = line. replace(" @@DOCBOOK-VERSION@@" , docbookVersion)
332
- }
333
- }
334
- }
335
-
336
- classpath = configurations. validateRuntime
337
- main = " com.thaiopensource.relaxng.translate.Driver"
338
- args " ${ buildDir} /transclude.rnc" , " ${ buildDir} /transclude.rng"
339
- }
340
-
341
289
task copyResources (type : Copy ,
342
290
dependsOn : [' copyTestMedia' , ' makePrintCSS' , ' zipStageResources' ,
343
291
' zipStageMisc' ]) {
@@ -630,7 +578,7 @@ fileTree(dir: "${projectDir}/src/test/generators").each { xsl ->
630
578
631
579
Task g = task " ${ generator} " (type : SaxonXsltTask , dependsOn : [' makeXslt' ]) {
632
580
input xsl
633
- stylesheet xsl. toString()
581
+ stylesheet xsl
634
582
output " ${ buildDir} /xspec/${ base} .xspec"
635
583
}
636
584
@@ -705,55 +653,32 @@ fileTree(dir: "${projectDir}/src/test/resources/xml",
705
653
stylesheetParams[' olink-databases' ] = dirs. join(" ," )
706
654
}
707
655
708
- def schemaPath = " docbook"
709
- def schemaVersion = docbookVersion
710
- def schema = " ${ schemaPath} -${ schemaVersion} /rng/docbook.rng"
711
-
656
+ def schemaFn = " ${ projectDir} /src/test/resources/docbook.rng"
712
657
if (base. contains(" xinclude" ) || base == " fit.001" ) {
713
- schema = " ${ schemaPath } - ${ schemaVersion } /rng /docbookxi.rng"
658
+ schemaFn = " ${ projectDir } /src/test/resources /docbookxi.rng"
714
659
}
715
660
716
661
if (base. contains(' transclusion' )) {
717
- schema = " transclude.rng" ;
662
+ schemaFn = " ${ projectDir } /src/test/resources/ transclude.rng"
718
663
stylesheetParams[' docbook-transclusion' ] = ' true'
719
664
}
720
665
721
666
if (publishersDocuments. contains(base)) {
722
- schemaPath = " publishers"
723
- schemaVersion = publishersVersion
724
- schema = " ${ schemaPath} -${ schemaVersion} /rng/publishers.rng"
667
+ schemaFn = " ${ projectDir} /src/test/resources/publishers.rng"
725
668
}
726
-
669
+
727
670
Task t = null
728
671
def htmlDependsOn = []
729
672
if (base. startsWith(" local." )) {
730
673
// This won't pass validation...
731
674
htmlDependsOn = [' makeXslt' ]
732
675
} else {
733
- t = task " validate_${ base} " () {
734
- inputs. file xml
735
- inputs. file " ${ buildDir} /${ schema} "
736
- outputs. file " ${ buildDir} /validated/${ base} "
737
-
738
- if (base. contains(" transclusion" )) {
739
- dependsOn setup_transclusion
740
- }
741
-
742
- doLast {
743
- javaexec {
744
- classpath = configurations. validateRuntime
745
- main = " com.thaiopensource.relaxng.util.Driver"
746
- args " -i" , " ${ buildDir} /${ schema} " , xml. toString()
747
- }
748
- }
749
-
750
- doLast {
751
- new File (" ${ buildDir} /validated/${ base} " ). withWriter(" utf-8" ) { writer ->
752
- writer. writeLine(" validated" )
753
- }
754
- }
676
+ t = task " validate_${ base} " (type : RelaxNGValidateTask ) {
677
+ input xml
678
+ output " ${ buildDir} /validated/${ base} "
679
+ schema schemaFn
680
+ idref ! invalidIdrefDocuments. contains(base)
755
681
}
756
- t. dependsOn tasks. findByName(" setup_${ schemaPath} " )
757
682
validateAll. dependsOn t
758
683
htmlDependsOn = [' makeXslt' , " validate_${ base} " ]
759
684
}
@@ -1433,24 +1358,10 @@ task copyGuide(type: SaxonXsltTask, dependsOn: ['xincludeGuide']) {
1433
1358
output " ${ buildDir} /guide/guide.xml"
1434
1359
}
1435
1360
1436
- task validateGuide (dependsOn : [' copyGuide' , ' setupDocBook' ]) {
1437
- inputs. file " ${ buildDir} /guide/guide.xml"
1438
- outputs. file " ${ buildDir} /guide/validated"
1439
-
1440
- doLast {
1441
- javaexec {
1442
- classpath = configurations. validateRuntime
1443
- main = " com.thaiopensource.relaxng.util.Driver"
1444
- args " -i" , " ${ buildDir} /docbook-${ docbookVersion} /rng/docbook.rng" ,
1445
- " ${ buildDir} /guide/guide.xml"
1446
- }
1447
- }
1448
-
1449
- doLast {
1450
- new File (" ${ buildDir} /guide/validated" ). withWriter(" utf-8" ) { writer ->
1451
- writer. writeLine(" validated" )
1452
- }
1453
- }
1361
+ task validateGuide (type : RelaxNGValidateTask , dependsOn : [' copyGuide' ]) {
1362
+ input " ${ buildDir} /guide/guide.xml"
1363
+ schema " ${ projectDir} /src/test/resources/docbook.rng"
1364
+ output " ${ buildDir} /guide/validated.xml"
1454
1365
}
1455
1366
1456
1367
task guide (type : SaxonXsltTask , dependsOn : [' makeXslt' , ' validateGuide' , ' explorer' ]) {
@@ -1779,11 +1690,10 @@ task dbtransform(type: SaxonXsltTask, dependsOn: ['makeXslt']) {
1779
1690
task helloWorld () {
1780
1691
doLast {
1781
1692
println (' Hello, world: ' + xslTNGversion)
1693
+ /*
1782
1694
configurations.validateRuntime.each { path ->
1783
1695
println("CP: ${path}")
1784
1696
}
1785
-
1786
- /*
1787
1697
configurations.projectRuntimeClasspath.each { path ->
1788
1698
println("R: ${path}")
1789
1699
}
@@ -1793,7 +1703,7 @@ task helloWorld() {
1793
1703
configurations.compileClasspath.each { cp ->
1794
1704
println("CCP: ${cp}")
1795
1705
}
1796
- println("${EXCP}")
1797
1706
*/
1707
+ println (" ${ EXCP} " )
1798
1708
}
1799
1709
}
0 commit comments