Project

Profile

Help

How to connect?
Download (27 KB) Statistics
| Branch: | Revision:

he / test-suites.gradle @ saxon10

1
// ============================================================
2
// Run the whole shebang!
3
task testSuitesJava(
4
  dependsOn: ["hejTestSuitesJava", "pejTestSuitesJava", "eejTestSuitesJava"]
5
) {
6
  // Just somewhere to hang dependencies
7
}
8

    
9
task hejTestSuitesJava() {
10
  // Just somewhere to hang dependencies
11
}
12

    
13
task pejTestSuitesJava() {
14
  // Just somewhere to hang dependencies
15
}
16

    
17
task eejTestSuitesJava() {
18
  // Just somewhere to hang dependencies
19
}
20

    
21
// This task will generate the test suite report from
22
// whatever results are lying around
23
task testSuiteReportsJava(
24
  type: JavaExec
25
) {
26
  def rundate = project.findProperty('rundate')
27

    
28
  inputs.files fileTree(dir: "${buildDir}/test-results")
29
  inputs.file "${projectDir}/tools/test-suites/report.xsl"
30
  outputs.file "${buildDir}/report.xml"
31
  outputs.file "${buildDir}/report.html"
32
  classpath = configurations.preprocessor
33
  workingDir = buildDir
34
  main = "net.sf.saxon.Transform"
35

    
36
  def arglist = ["-it:main",
37
                 "-xsl:${projectDir}/tools/test-suites/report.xsl",
38
                 "-ns:##any"]
39

    
40
  if (rundate != null) {
41
    arglist += ["rundate=${rundate}"]
42
  }
43
  
44
  args arglist
45
}
46

    
47
// This task *runs all the tests* and then generates the
48
// test suite report from the results
49
task runTestSuiteReportsJava(
50
  type: JavaExec,
51
  dependsOn: ["testSuitesJava"]
52
) {
53
  def rundate = project.findProperty('rundate')
54

    
55
  inputs.files fileTree(dir: "${buildDir}/test-results")
56
  inputs.file "${projectDir}/tools/test-suites/report.xsl"
57
  outputs.file "${buildDir}/report.xml"
58
  outputs.file "${buildDir}/report.html"
59
  classpath = configurations.preprocessor
60
  workingDir = buildDir
61
  main = "net.sf.saxon.Transform"
62

    
63
  def arglist = ["-it:main",
64
                 "-xsl:${projectDir}/tools/test-suites/report.xsl",
65
                 "-ns:##any"]
66

    
67
  if (rundate != null) {
68
    arglist += ["rundate=${rundate}"]
69
  }
70
  
71
  args arglist
72
}
73

    
74
// ============================================================
75

    
76
def langCodeMap = ["XP20": "XPath2.0",
77
                   "XP30": "XPath3.0",
78
                   "XP31": "XPath3.1",
79
                   "XT30": "XSLT3.0",
80
                   "XT40": "XSLT4.0",
81
                   "XP31": "XPath3.1",
82
                   "XQ20": "XQuery2.0",
83
                   "XQ30": "XQuery3.0",
84
                   "XQ31": "XQuery3.1"]
85

    
86
// N.B. These tasks cannot be run in parallel because the
87
// test suite drivers write to filenames that are not distinct
88
// based on the options used to run them (e.g, whether or not
89
// the bytecode option is enabled doesn't change the output
90
// filename).
91
//
92
// ============================================================
93
// Tasks to build the test drivers and setup the test suite results directories
94

    
95
["he", "pe", "ee"].each { release ->
96
  def RELEASE = release.toUpperCase()
97
  fileTree(dir: "src/test/exceptions").each { fn ->
98
    def pos = fn.toString().lastIndexOf(pathSeparator)
99
    def base = fn.toString().substring(pos+1)
100
    base = base.substring(0, base.length() - 4)
101

    
102
    def schema11 = (base == "xsd11" || base == "xsd-extra11")
103
    def schema = schema11 || (base == "xsd" || base == "xsd-extra")
104
    if (schema11 && release == "ee") {
105
      // These are a special case, they need to be renamed 'exceptions11.xml'
106
      // in the corresponding base directory. See "dependsOn" below this loop.
107
      def bdir = "xsd"
108
      if (base == "xsd-extra11") {
109
        bdir = "xsd-extra"
110
      }
111
      task "${release}j_setup_${base}_TestResults"(
112
        type: Copy,
113
        description: "Sets up the test results directory the ${base} tests for ${RELEASE}"
114
      ) {
115
        into "${buildDir}/test-results/${release}j/${bdir}/${DSTAMP}"
116
        from "src/test/exceptions/${base}.xml"
117
        rename { "exceptions11.xml" }
118
      }
119
    } else {
120
      // The schema tests only run on EE
121
      if (!schema || release == "ee") {
122
        task "${release}j_setup_${base}_TestResults"(
123
          type: Copy,
124
          description: "Sets up the test results directory the ${base} tests for ${RELEASE}"
125
        ) {
126
          into "${buildDir}/test-results/${release}j/${base}/${DSTAMP}"
127
          from "src/test/exceptions/${base}.xml"
128
          rename { "exceptions.xml" }
129
        }
130
      }
131
    }
132
  }
133

    
134
  task "${release}j_compileTestDrivers"(
135
    type: JavaCompile,
136
    dependsOn: ["${release}j_copyTestDrivers", "${release}jCompile"],
137
    description: "Compile the test classes for ${RELEASE}"
138
  ) {
139
    classpath = configurations.testDrivers + files("${buildDir}/classes/${release}j")
140
    source = "${buildDir}/src/testdrivers/${release}j"
141
    destinationDirectory = new File("${buildDir}/testdriver_classes/${release}j")
142
  }
143
}
144

    
145
tasks.findByName("eej_setup_xsd_TestResults").dependsOn "eej_setup_xsd11_TestResults"
146
tasks.findByName("eej_setup_xsd-extra_TestResults").dependsOn "eej_setup_xsd-extra11_TestResults"
147

    
148
task eej_setup_xsd_transformations(
149
  type: Copy,
150
  description: "Copy the transformations used by the XSD test driver"
151
) {
152
  into "${buildDir}/test-results/eej/xsd/${DSTAMP}"
153
  from "src/test/extra/tools"
154
}
155
tasks.findByName("eej_setup_xsd_TestResults").dependsOn "eej_setup_xsd_transformations"
156

    
157
task eej_setup_xsd_extra_transformations(
158
  type: Copy,
159
  description: "Copy the transformations used by the XSD test driver"
160
) {
161
  into "${buildDir}/test-results/eej/xsd-extra/${DSTAMP}"
162
  from "src/test/extra/tools"
163
}
164
tasks.findByName("eej_setup_xsd-extra_TestResults").dependsOn "eej_setup_xsd_extra_transformations"
165

    
166
// ============================================================
167
// Tasks to run QT3 test driver with a variety of options
168

    
169
task qt3TestsJava() {
170
  // Just somewhere to hang dependencies
171
}
172

    
173
["he", "pe", "ee"].each { release ->
174
  def RELEASE = release.toUpperCase()
175
  def jpackage = "com.saxonica.testdriver"
176
  if (release == "he") {
177
    jpackage = "net.sf.saxon.testdriver"
178
  }
179

    
180
  def resdir = "${buildDir}/test-results/${release}j/qt3/${DSTAMP}"
181

    
182
  def languages = ["XP20", "XP31", "XQ30", "XQ31"]
183
  if (release == "ee") {
184
    languages = ["XP20", "XP30", "XP31", "XQ10", "XQ30", "XQ31"]
185
  }
186

    
187
  def bytecodes = [""]
188
  if (release == "ee") {
189
    bytecodes = ["off", "on"]
190
  }
191

    
192
  languages.each { language ->
193
    bytecodes.each { bytecode ->
194

    
195
      def unfolded = [""]
196
      if (release == "ee" && (language == "XQ30" || language == "XQ31")) {
197
        unfolded = ["", "yes"]
198
      }
199

    
200
      unfolded.each { uoption ->
201
        def reportFilename = "report_${langCodeMap[language]}_${saxonVersion}"
202
        def taskname = "${release}_runQT3TestSuite_${language}"
203
        if (bytecode != "") {
204
          taskname = "${taskname}_bc${bytecode}"
205
          reportFilename = reportFilename + "_bc${bytecode}"
206
        }
207
        if (uoption != "") {
208
          taskname = "${taskname}_un"
209
          reportFilename = reportFilename + "_un"
210
        }
211

    
212
        if (bytecode == "off" && uoption != "") {
213
          // ignore this combination
214
        } else {
215
          task "run_${taskname}"(
216
            type: JavaExec,
217
            dependsOn: ["${release}jCompile", "${release}j_compileTestDrivers", "cloneQT3TestSuite"],
218
            description: "Run the QT3 test suite driver for ${RELEASE}/${language}/${bytecode}/${uoption}"
219
          ) {
220
            inputs.files fileTree(dir: "src")
221
            outputs.file "${resdir}/results_${langCodeMap[language]}_${saxonVersion}.xml"
222

    
223
            classpath = configurations.testDrivers \
224
            + files("${buildDir}/classes/${release}j") \
225
            + files("${buildDir}/testdriver_classes/${release}j")
226

    
227
            main = "${jpackage}.QT3TestDriver${RELEASE}"
228
            def testargs = [w3cQT3TestSuiteDir,
229
                            "catalog.xml",
230
                            "-exceptions:${projectDir}/src/test/exceptions/qt3.xml",
231
                            "-reportfilename:${reportFilename}.xml",
232
                            "-o:${resdir}",
233
                            "-lang:${language}"]
234
            if (bytecode != "") {
235
              testargs += [ "-bytecode:${bytecode}" ]
236
            }
237
            if (uoption != "") {
238
              testargs += [ "-unfolded:${uoption}" ]
239
            }
240

    
241
            args testargs
242
          }
243

    
244
          task "${taskname}"(
245
            type: Copy,
246
            dependsOn: "run_${taskname}"
247
          ) {
248
            def bflag = ""
249
            if (bytecode != "") {
250
              bflag = "-${bytecode}"
251
            }
252
            def uflag = ""
253
            if (uoption != "") {
254
              uflag = "-unfolded"
255
            }
256
            into "${resdir}/results"
257
            from resdir
258
            include "${reportFilename}.xml"
259
            rename { filename ->
260
              "saxon-${saxonVersion}-${language}${bflag}${uflag}.xml"
261
            }
262
          }
263
          qt3TestsJava.dependsOn taskname
264
          tasks.findByName("${release}jTestSuitesJava").dependsOn taskname
265
        }
266
      }
267
    }
268
  }
269
}
270

    
271
// ============================================================
272
// Tasks to run QT3 extra test driver with a variety of options
273

    
274
task qt3ExtraTestsJava() {
275
  // Just somewhere to hang dependencies
276
}
277

    
278
// These tests are not run for "he".
279
["pe", "ee"].each { release ->
280
  def RELEASE = release.toUpperCase()
281
  def jpackage = "com.saxonica.testdriver"
282
  if (release == "he") {
283
    jpackage = "net.sf.saxon.testdriver"
284
  }
285

    
286
  def resdir = "${buildDir}/test-results/${release}j/qt3extra/${DSTAMP}"
287

    
288
  def languages = ["XP20", "XP31", "XQ30", "XQ31"]
289
  if (release == "ee") {
290
    languages = ["XP20", "XP30", "XP31", "XQ10", "XQ30", "XQ31"]
291
  }
292

    
293
  def bytecodes = [""]
294
  if (release == "ee") {
295
    bytecodes = ["off", "on"]
296
  }
297

    
298
  languages.each { language ->
299
    bytecodes.each { bytecode ->
300
      def taskname = "${release}_runQT3ExtraTestSuite_${language}"
301
      def reportFilename = "results_${langCodeMap[language]}_${saxonVersion}"
302

    
303
      if (bytecode != "") {
304
        taskname = "${taskname}_bc${bytecode}"
305
        reportFilename = "${reportFilename}_bc${bytecode}"
306
      }
307

    
308
      task "run_${taskname}"(
309
        type: JavaExec,
310
        dependsOn: ["${release}jCompile",
311
                    "${release}j_compileTestDrivers"],
312
        description: "Run the QT3 extra test suite driver for ${RELEASE}/${language}/${bytecode}"
313
      ) {
314
        inputs.files fileTree(dir: "src")
315
        outputs.file "${resdir}/results_${langCodeMap[language]}_${saxonVersion}.xml"
316

    
317
        classpath = configurations.testDrivers \
318
        + files("${buildDir}/classes/${release}j") \
319
        + files("${buildDir}/testdriver_classes/${release}j")
320

    
321
        main = "${jpackage}.QT3TestDriver${RELEASE}"
322
        def testargs = ["${projectDir}/src/test/extra/qt3",
323
                        "catalog.xml",
324
                        "-exceptions:${projectDir}/src/test/exceptions/qt3extra.xml",
325
                        "-reportfilename:${reportFilename}.xml",
326
                        "-o:${resdir}",
327
                        "-lang:${language}"]
328
        if (bytecode != "") {
329
          testargs += [ "-bytecode:${bytecode}" ]
330
        }
331

    
332
        args testargs
333
      }
334

    
335
      task "${taskname}"(
336
        type: Copy,
337
        dependsOn: "run_${taskname}"
338
      ) {
339
        def bflag = ""
340
        if (bytecode != "") {
341
          bflag = "-${bytecode}"
342
        }
343
        into "${resdir}/results"
344
        from resdir
345
        include "${reportFilename}.xml"
346
        rename { filename ->
347
          "saxon-${saxonVersion}-${language}${bflag}.xml"
348
        }
349
      }
350
      qt3ExtraTestsJava.dependsOn taskname
351
      tasks.findByName("${release}jTestSuitesJava").dependsOn taskname
352
    }
353
  }
354
}
355

    
356
// ============================================================
357
// Tasks to run XSLT3.0 test driver with a variety of options
358

    
359
task xslt30TestsJava() {
360
  // Just somewhere to hang dependencies
361
}
362

    
363
["he", "pe", "ee"].each { release ->
364
  def RELEASE = release.toUpperCase()
365
  def jpackage = "com.saxonica.testdriver"
366
  if (release == "he") {
367
    jpackage = "net.sf.saxon.testdriver"
368
  }
369

    
370
  def resdir = "${buildDir}/test-results/${release}j/xslt30/${DSTAMP}"
371

    
372
  def languages = ["XT30"]
373
  def bytecodes = [""]
374
  def exports = [""]
375
  def jits = [""]
376
  if (release == "ee") {
377
    bytecodes = ["off", "on"]
378
    exports = ["", "-export"]
379
    jits = ["", "-jit"]
380
  }
381

    
382
  languages.each { language ->
383
    bytecodes.each { bytecode ->
384
      exports.each { export ->
385
        jits.each { jit ->
386

    
387
          def skipThisCombo = ((export == "-export" && bytecode == "on")
388
                               || (jit == "-jit" && bytecode == "off"))
389

    
390
          if (!skipThisCombo) {
391
            def taskname = "${release}_runXslt30TestSuite_${language}"
392
            def reportFilename = "results_${langCodeMap[language]}_${saxonVersion}"
393

    
394
            if (bytecode != "") {
395
              taskname = "${taskname}_bc${bytecode}"
396
              reportFilename = "${reportFilename}_bc${bytecode}"
397
            }
398
            if (export != "") {
399
              taskname = "${taskname}_export"
400
              reportFilename = "${reportFilename}_export"
401
            }
402
            if (jit != "") {
403
              taskname = "${taskname}_jit"
404
              reportFilename = "${reportFilename}_jit"
405
            }
406

    
407
            task "run_${taskname}"(
408
              type: JavaExec,
409
              dependsOn: ["${release}jCompile",
410
                          "${release}j_compileTestDrivers",
411
                          "cloneXslt30TestSuite"],
412
              description: "Run the XSLT 3.0 test suite driver for ${RELEASE}/${language}/${bytecode}/${export}/${jit}"
413
            ) {
414
              inputs.files fileTree(dir: "src")
415
              outputs.file "${resdir}/results_XSLT3.0_${saxonVersion}.xml"
416

    
417
              classpath = configurations.testDrivers \
418
              + files("${buildDir}/classes/${release}j") \
419
              + files("${buildDir}/testdriver_classes/${release}j")
420

    
421
              main = "${jpackage}.Xslt30TestSuiteDriver${RELEASE}"
422
              def testargs = [w3cXslt30TestSuiteDir,
423
                              "catalog.xml",
424
                              "-exceptions:${projectDir}/src/test/exceptions/xslt30.xml",
425
                              "-reportfilename:${reportFilename}.xml",
426
                              "-o:${resdir}",
427
                              "-lang:${language}",
428
                              "-ps:off"]
429
              if (testSuiteDebug != "") {
430
                testargs += [ testSuiteDebug ]
431
              }
432
              if (bytecode != "") {
433
                testargs += [ "-bytecode:${bytecode}" ]
434
              }
435
              if (export != "") {
436
                testargs += [ export ]
437
              }
438
              if (jit != "") {
439
                testargs += [ jit ]
440
              }
441

    
442
              args testargs
443
            }
444

    
445
            task "${taskname}"(
446
              type: Copy,
447
              dependsOn: "run_${taskname}"
448
            ) {
449
              def bflag = ""
450
              if (bytecode != "") {
451
                bflag = "-${bytecode}"
452
              }
453
              into "${resdir}/results"
454
              from resdir
455
              include "${reportFilename}.xml"
456
              rename { filename ->
457
                "saxon-${saxonVersion}-${language}${bflag}${export}${jit}.xml"
458
              }
459
            }
460
            xslt30TestsJava.dependsOn taskname
461
            tasks.findByName("${release}jTestSuitesJava").dependsOn taskname
462
          }
463
        }
464
      }
465
    }
466
  }
467
}
468

    
469
// ============================================================
470
// Tasks to run XSLT3.0 extra test driver with a variety of options
471

    
472
task xslt30ExtraTestsJava() {
473
  // Just somewhere to hang dependencies
474
}
475

    
476
["he", "pe", "ee"].each { release ->
477
  def RELEASE = release.toUpperCase()
478
  def jpackage = "com.saxonica.testdriver"
479
  if (release == "he") {
480
    jpackage = "net.sf.saxon.testdriver"
481
  }
482

    
483
  def resdir = "${buildDir}/test-results/${release}j/xslt30extra/${DSTAMP}"
484

    
485
  def languages = ["XT30"]
486
  def bytecodes = [""]
487
  if (release == "ee") {
488
    bytecodes = ["off", "on"]
489
  }
490

    
491
  languages.each { language ->
492
    bytecodes.each { bytecode ->
493
      def taskname = "${release}_runXslt30ExtraTestSuite_${language}"
494
      def reportFilename = "results_${langCodeMap[language]}_${saxonVersion}"
495

    
496
      if (bytecode != "") {
497
        taskname = "${taskname}_bc${bytecode}"
498
        reportFilename = "${reportFilename}_bc${bytecode}"
499
      }
500

    
501
      task "run_${taskname}"(
502
        type: JavaExec,
503
        dependsOn: ["${release}jCompile",
504
                    "${release}j_compileTestDrivers"],
505
        description: "Run the XSLT 3.0 extra test suite driver for ${RELEASE}/${language}/${bytecode}"
506
      ) {
507
        inputs.files fileTree(dir: "src")
508
        outputs.file "${resdir}/results_XSLT3.0_${saxonVersion}.xml"
509

    
510
        classpath = configurations.testDrivers \
511
        + files("${buildDir}/classes/${release}j") \
512
        + files("${buildDir}/testdriver_classes/${release}j")
513

    
514
        main = "${jpackage}.Xslt30TestSuiteDriver${RELEASE}"
515
        def testargs = ["${projectDir}/src/test/extra/xslt30",
516
                        "catalog.xml",
517
                        "-exceptions:${projectDir}/src/test/exceptions/xslt30extra.xml",
518
                        "-reportfilename:${reportFilename}.xml",
519
                        "-o:${resdir}",
520
                        "-lang:${language}",
521
                        "-ps:off"]
522
        if (testSuiteDebug != "") {
523
          testargs += [ testSuiteDebug ]
524
        }
525
        if (bytecode != "") {
526
          testargs += [ "-bytecode:${bytecode}" ]
527
        }
528

    
529
        args testargs
530
      }
531

    
532
      task "${taskname}"(
533
        type: Copy,
534
        dependsOn: "run_${taskname}"
535
      ) {
536
        def bflag = ""
537
        if (bytecode != "") {
538
          bflag = "-${bytecode}"
539
        }
540
        into "${resdir}/results"
541
        from resdir
542
        include "${reportFilename}.xml"
543
        rename { filename ->
544
          "saxon-${saxonVersion}-${language}${bflag}.xml"
545
        }
546
      }
547
      xslt30ExtraTestsJava.dependsOn taskname
548
      tasks.findByName("${release}jTestSuitesJava").dependsOn taskname
549
    }
550
  }
551
}
552

    
553
// ============================================================
554
// Tasks to run XSD test driver with a variety of options
555

    
556
task xsdTestsJava() {
557
  // Just somewhere to hang dependencies
558
}
559

    
560
// Only applies to EE
561
["ee"].each { release ->
562
  def RELEASE = release.toUpperCase()
563
  def jpackage = "com.saxonica.testdriver.ee"
564

    
565
  def resdir = "${buildDir}/test-results/${release}j/xsd/${DSTAMP}"
566

    
567
  def languages = ["1.0", "1.1"]
568
  def bytecodes = ["off", "on"]
569

    
570
  languages.each { language ->
571
    bytecodes.each { bytecode ->
572
      def taskname = "${release}_runXsdTestSuite_${language}_bc${bytecode}"
573
      def reportFilename = "SaxonResults${saxonVersion}-${language}_bc${bytecode}"
574
      def errorFilename = "SaxonFailures${saxonVersion}-${language}_bc${bytecode}"
575
      def exceptions = "${projectDir}/src/test/exceptions/xsd.xml"
576
      if (language == "1.1") {
577
        exceptions = "${projectDir}/src/test/exceptions/xsd11.xml"
578
      }
579

    
580
      task "run_${taskname}"(
581
        type: JavaExec,
582
        dependsOn: ["${release}jCompile",
583
                    "${release}j_compileTestDrivers",
584
                    "cloneXsdTestSuite"],
585
        description: "Run the XSD test suite driver for ${RELEASE}/${language}/${bytecode}"
586
      ) {
587
        inputs.files fileTree(dir: "src")
588
        outputs.file "${resdir}/SaxonFailures${saxonVersion}.xml"
589
        outputs.file "${resdir}/SaxonResults${saxonVersion}-${language}.xml"
590

    
591
        classpath = configurations.testDrivers \
592
        + files("${buildDir}/classes/${release}j") \
593
        + files("${buildDir}/testdriver_classes/${release}j")
594

    
595
        main = "${jpackage}.SchemaTestSuiteDriver"
596
        def testargs = [w3cXsdTestSuiteDir,
597
                        "-exceptions:${exceptions}",
598
                        "-reportfilename:${reportFilename}.xml",
599
                        "-errorfilename:${errorFilename}.xml",
600
                        "-summarizeresults:${projectDir}/src/test/extra/tools/summarize-results.xsl",
601
                        "-local:${resdir}",
602
                        "-v:${language}"]
603
        if (bytecode != "") {
604
          testargs += [ "-bytecode:${bytecode}" ]
605
        }
606

    
607
        args testargs
608
      }
609

    
610
      task "${taskname}"(
611
        type: Copy,
612
        dependsOn: "run_${taskname}"
613
      ) {
614
        def bflag = ""
615
        if (bytecode != "off") {
616
          bflag = "-${bytecode}"
617
        }
618
        into "${resdir}/results"
619
        from resdir
620
        include "${reportFilename}.xml"
621
        rename { filename ->
622
          "saxon-${saxonVersion}-XSD${language}${bflag}.xml"
623
        }
624
      }
625
      xsdTestsJava.dependsOn taskname
626
      tasks.findByName("${release}jTestSuitesJava").dependsOn taskname
627
    }
628
  }
629
}
630

    
631
// ============================================================
632
// Tasks to run XSD extra test driver with a variety of options
633

    
634
task xsdExtraTestsJava() {
635
  // Just somewhere to hang dependencies
636
}
637

    
638
// Not currently enabled.
639

    
640
// ============================================================
641

    
642
// ============================================================
643

    
644
["h", "p", "e"].each { initial ->
645
  def release = initial + "e"
646
  def RELEASE = release.toUpperCase()
647

    
648
  task "${release}_samples_common"(
649
    type: Copy,
650
    dependsOn: ["${release}_samples", "${release}_samples_cs"]
651
  ) {
652
    into "${buildDir}/output/${release}/resources/use-cases"
653
    from "${projectDir}/src/use-cases"
654
  }
655

    
656
  task "${release}_samples"(
657
    type: Copy
658
  ) {
659
    into "${buildDir}/output/${release}/resources/samples"
660
    from ("${projectDir}/src/samples") {
661
      include "config/config.xml"
662
      include "config/config-HE.xml"
663
      include "config/config.xsd"
664
      include "config/saxon-attributes.xsd"
665
      include "data/books.xml"
666
      include "data/books-invalid.xml"
667
      include "data/more-books.xml"
668
      include "data/othello.xml"
669
      include "data/books.xsd"
670
      include "data/books.dtd"
671
      include "data/play.dtd"
672
      include "query/tour.xq"
673
      include "query/books.xq"
674
      include "query/books-to-html.xq"
675
      include "scm/scmschema.*"
676
      include "schemas/validation-reports.xsd"
677
      include "styles/add-ids.xsl"
678
      include "styles/bible.xsl"
679
      include "styles/books.xsl"
680
      include "styles/books.txt"
681
      include "styles/play.xsl"
682
      include "styles/identity.xsl"
683
      include "styles/books-csv.xsl"
684
      include "styles/books-sql.xsl"
685
      include "styles/rename-to-lowercase.xsl"
686
      include "styles/total.xsl"
687
      include "styles/tour.xsl"
688
      include "styles/summarize.xsl"
689
    }
690
  }
691

    
692
  // TODO reinstate to include CS samples when releasing for .NET
693
  task "${release}_samples_cs"(
694
    type: Copy
695
  ) {
696
    into "${buildDir}/output/${release}/resources/samples/cs"
697
    from "${projectDir}/src/samples/cs"
698
  }
699
}
700

    
701
task config_sample(
702
  type: JavaExec,
703
  dependsOn: ["hej_featureKeys"],
704
  description: "Construct the configuration file XSD"
705
) {
706
  inputs.files fileTree(dir: "${projectDir}/tools/featureKeys")
707
  inputs.files "${projectDir}/src/samples/config/config-raw.xsd"
708
  outputs.file "${buildDir}/output/he/resources/samples/config/config.xsd"
709
  classpath = configurations.preprocessor
710
  main = "net.sf.saxon.Transform"
711
  args "-xsl:${projectDir}/tools/featureKeys/FeatureKeysToSchema.xsl",
712
    "-o:${buildDir}/output/he/resources/samples/config/config.xsd",
713
    "-it:main",
714
    "FeatureKeys=FeatureKeys.xml",
715
    "AdditionalFeatures=AdditionalFeatures.xml",
716
    "ConfigSchema=${projectDir}/src/samples/config/config-raw.xsd"
717
}
718

    
719
task hej_setup_samples(
720
  type: Copy,
721
  dependsOn: ["config_sample", "he_samples_common"]
722
) {
723
  into "${buildDir}/output/he/resources/samples/java/he"
724
  from ("${projectDir}/src/samples/java/he") {
725
    include "ApplyXPathJAXP.java"
726
    include "ExampleContentHandler.java"
727
    include "QueryAPIExamples.java"
728
    include "S9APIExamples.java"
729
    include "S9APIExamplesOM.java"
730
    include "SaxonServlet.java"
731
    include "JAXPExamples.java"
732
    include "XPathExample.java"
733
    include "XPathExampleDOM.java"
734
    include "XPathExampleServlet.java"
735
  }
736
}
737

    
738
task hej_samples(
739
  type: JavaCompile,
740
  dependsOn: ["hej_setup_samples", "hejCompile"]
741
) {
742
  classpath = configurations.samples + files("${buildDir}/classes/hej")
743
  source = "${buildDir}/output/he/resources/samples/java/he"
744
  destinationDirectory = new File("${buildDir}/output/he/resources/samples/java/classes")
745
  doFirst {
746
    mkdir "${buildDir}/output/he/resources/samples/java/classes"
747
  }
748
}
749

    
750
task eej_setup_samples(
751
  type: Copy,
752
  dependsOn: ["config_sample", "ee_samples_common"]
753
) {
754
  into "${buildDir}/output/he/resources/samples/java/ee"
755
  from ("${projectDir}/src/samples/java/ee") {
756
    include "JDOM2Example.java"
757
    include "PullExamples.java"
758
    include "QuickValidator.java"
759
    include "SaxonSAServlet.java"
760
    include "SchemaValidatorExample.java"
761
    include "SchemaValidatorHandlerExample.java"
762
    include "XMarkBenchmark.java"
763
    include "XPathExampleSA.java"
764
    include "XQJExamples.java"
765
  }
766
}
767

    
768
task eej_samples(
769
  type: JavaCompile,
770
  dependsOn: ["eej_setup_samples", "eejCompile", "hej_samples"]
771
) {
772
  classpath = configurations.samples + (files("${buildDir}/classes/eej")
773
              + files("${buildDir}/output/he/resources/samples/java/classes"))
774
  source = "${buildDir}/output/he/resources/samples/java/ee"
775
  destinationDirectory = new File("${buildDir}/output/ee/resources/samples/java/classes")
776
  doFirst {
777
    mkdir "${buildDir}/output/ee/resources/samples/java/classes"
778
  }
779
}
780

    
781
// ============================================================
782

    
783
task he_samples_JAXPExamples(
784
  type: Exec,
785
  dependsOn: ["hej_samples", "hejJar"],
786
  description: "Run test of JAXPExamples for he"
787
) {
788
  inputs.files fileTree(dir: "${buildDir}/output/he/resources/samples/java/classes/he")
789
  inputs.files "${projectDir}/src/samples/java/he"
790
  workingDir = "${buildDir}/output/he/resources/samples"
791

    
792
  def args = ["java",
793
              "-cp",
794
              "${buildDir}/libs/saxon-he-${saxonVersion}.jar:${buildDir}/output/he/resources/samples/java/classes",
795
              "he/JAXPExamples", "all"]
796

    
797
  commandLine args
798
}
799

    
800
/*
801

    
802
    <macrodef name="samples-JAXPExamples"
803
              description="Run test of JAXPExamples samples">
804
        <attribute name="version"/>
805
        <attribute name="target"/>
806
        <sequential>
807
            <exec executable="java"
808
                  dir="${build-resources.dir}/samples"
809
                  failonerror="true">
810
                <arg line="-cp ${basedir}/${build-resources.dir}/samples/java/classes${Z}${basedir}/${build-@{version}j.dir}/saxon-@{version}-${major.version}.jar${Z}${license.dir}"/>
811
                <arg line="he/JAXPExamples"/>
812
                <arg line="@{target}"/>
813
            </exec>
814
        </sequential>
815
    </macrodef>
816

    
817
    <target name="test-samples-JAXPExamples-j" depends="samples-j">
818
        <samples-JAXPExamples version="he" target="all"/>
819
        <samples-JAXPExamples version="pe" target="all"/>
820
        <samples-JAXPExamples version="ee" target="all"/>
821
    </target>
822

    
823

    
824
/*
825
}
826

    
827
    <!-- S9APIExamples sample tests -->
828
    <macrodef name="samples-s9api"
829
        description="Run test of s9api samples">
830
        <attribute name="version"
831
        <attribute name="target"
832
        <sequential>
833
            <exec executable="java"
834
                dir="${build-resources.dir}/samples"
835
                failonerror="true">
836
                <arg line="-cp ${basedir}/${build-resources.dir}/samples/java/classes${Z}${basedir}/${build-@{version}j.dir}/saxon-@{version}-${major.version}.jar${Z}${license.dir}"
837
                <arg line="he/S9APIExamples"
838
                <arg line="@{target}"
839
            </exec>
840
        </sequential>
841
    </macrodef>
842

    
843
        <samples-s9api version="he" target="QueryA"
844
*/
(14-14/14)