Project

Profile

Help

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

he / test-suites.gradle @ b2ef1409

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
                   "XQ20": "XQuery2.0",
80
                   "XQ30": "XQuery3.0",
81
                   "XQ31": "XQuery3.1"]
82

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

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

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

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

    
142
tasks.findByName("eej_setup_xsd_TestResults").dependsOn "eej_setup_xsd11_TestResults"
143
tasks.findByName("eej_setup_xsd-extra_TestResults").dependsOn "eej_setup_xsd-extra11_TestResults"
144

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

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

    
163
// ============================================================
164
// Tasks to run QT3 test driver with a variety of options
165

    
166
task qt3TestsJava() {
167
  // Just somewhere to hang dependencies
168
}
169

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

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

    
179
  def languages = ["XP20", "XP31", "XQ30", "XQ31"]
180
  if (release == "ee") {
181
    languages = ["XP20", "XP30", "XP31", "XQ10", "XQ30", "XQ31"]
182
  }
183

    
184
  def bytecodes = [""]
185
  if (release == "ee") {
186
    bytecodes = ["off", "on"]
187
  }
188

    
189
  languages.each { language ->
190
    bytecodes.each { bytecode ->
191

    
192
      def unfolded = [""]
193
      if (release == "ee" && (language == "XQ30" || language == "XQ31")) {
194
        unfolded = ["", "yes"]
195
      }
196

    
197
      unfolded.each { uoption ->
198
        def taskname = "${release}_runQT3TestSuite_${language}"
199
        if (bytecode != "") {
200
          taskname = "${taskname}_bc${bytecode}"
201
        }
202
        if (uoption != "") {
203
          taskname = "${taskname}_un"
204
        }
205

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

    
218
            classpath = configurations.testDrivers \
219
            + files("${buildDir}/classes/${release}j") \
220
            + files("${buildDir}/testdriver_classes/${release}j")
221

    
222
            main = "${jpackage}.QT3TestDriver${RELEASE}"
223
            def testargs = [w3cQT3TestSuiteDir,
224
                            "catalog.xml",
225
                            "-o:${resdir}",
226
                            "-lang:${language}"]
227
            if (bytecode != "") {
228
              testargs += [ "-bytecode:${bytecode}" ]
229
            }
230
            if (uoption != "") {
231
              testargs += [ "-unfolded:${uoption}" ]
232
            }
233

    
234
            args testargs
235
          }
236

    
237
          task "${taskname}"(
238
            type: Copy,
239
            dependsOn: "run_${taskname}"
240
          ) {
241
            def bflag = ""
242
            if (bytecode != "") {
243
              bflag = "-${bytecode}"
244
            }
245
            def uflag = ""
246
            if (uoption != "") {
247
              uflag = "-unfolded"
248
            }
249
            into "${resdir}/results"
250
            from resdir
251
            include "results_${langCodeMap[language]}_${saxonVersion}.xml"
252
            rename { filename ->
253
              "saxon-${saxonVersion}-${language}${bflag}${uflag}.xml"
254
            }
255
          }
256
          qt3TestsJava.dependsOn taskname
257
          tasks.findByName("${release}jTestSuitesJava").dependsOn taskname
258
        }
259
      }
260
    }
261
  }
262
}
263

    
264
// ============================================================
265
// Tasks to run QT3 extra test driver with a variety of options
266

    
267
task qt3ExtraTestsJava() {
268
  // Just somewhere to hang dependencies
269
}
270

    
271
// These tests are not run for "he".
272
["pe", "ee"].each { release ->
273
  def RELEASE = release.toUpperCase()
274
  def jpackage = "com.saxonica.testdriver"
275
  if (release == "he") {
276
    jpackage = "net.sf.saxon.testdriver"
277
  }
278

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

    
281
  def languages = ["XP20", "XP31", "XQ30", "XQ31"]
282
  if (release == "ee") {
283
    languages = ["XP20", "XP30", "XP31", "XQ10", "XQ30", "XQ31"]
284
  }
285

    
286
  def bytecodes = [""]
287
  if (release == "ee") {
288
    bytecodes = ["off", "on"]
289
  }
290

    
291
  languages.each { language ->
292
    bytecodes.each { bytecode ->
293
      def taskname = "${release}_runQT3ExtraTestSuite_${language}"
294
      if (bytecode != "") {
295
        taskname = "${taskname}_bc${bytecode}"
296
      }
297

    
298
      task "run_${taskname}"(
299
        type: JavaExec,
300
        dependsOn: ["${release}j_compileTestDrivers", "${release}j_setup_qt3extra_TestResults"],
301
        description: "Run the QT3 extra test suite driver for ${RELEASE}/${language}/${bytecode}"
302
      ) {
303
        inputs.files fileTree(dir: "src")
304
        outputs.file "${resdir}/results_${langCodeMap[language]}_${saxonVersion}.xml"
305

    
306
        classpath = configurations.testDrivers \
307
        + files("${buildDir}/classes/${release}j") \
308
        + files("${buildDir}/testdriver_classes/${release}j")
309

    
310
        main = "${jpackage}.QT3TestDriver${RELEASE}"
311
        def testargs = ["${projectDir}/src/test/extra/qt3",
312
                        "catalog.xml",
313
                        "-o:${resdir}",
314
                        "-lang:${language}"]
315
        if (bytecode != "") {
316
          testargs += [ "-bytecode:${bytecode}" ]
317
        }
318

    
319
        args testargs
320
      }
321

    
322
      task "${taskname}"(
323
        type: Copy,
324
        dependsOn: "run_${taskname}"
325
      ) {
326
        def bflag = ""
327
        if (bytecode != "") {
328
          bflag = "-${bytecode}"
329
        }
330
        into "${resdir}/results"
331
        from resdir
332
        include "results_${langCodeMap[language]}_${saxonVersion}.xml"
333
        rename { filename ->
334
          "saxon-${saxonVersion}-${language}${bflag}.xml"
335
        }
336
      }
337
      qt3ExtraTestsJava.dependsOn taskname
338
      tasks.findByName("${release}jTestSuitesJava").dependsOn taskname
339
    }
340
  }
341
}
342

    
343
// ============================================================
344
// Tasks to run XSLT3.0 test driver with a variety of options
345

    
346
task xslt30TestsJava() {
347
  // Just somewhere to hang dependencies
348
}
349

    
350
["he", "pe", "ee"].each { release ->
351
  def RELEASE = release.toUpperCase()
352
  def jpackage = "com.saxonica.testdriver"
353
  if (release == "he") {
354
    jpackage = "net.sf.saxon.testdriver"
355
  }
356

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

    
359
  def languages = ["XT30"]
360
  def bytecodes = [""]
361
  def exports = [""]
362
  def jits = [""]
363
  if (release == "ee") {
364
    bytecodes = ["off", "on"]
365
    exports = ["", "-export"]
366
    jits = ["", "-jit"]
367
  }
368

    
369
  languages.each { language ->
370
    bytecodes.each { bytecode ->
371
      exports.each { export ->
372
        jits.each { jit ->
373

    
374
          def skipThisCombo = ((export == "-export" && bytecode == "on")
375
                               || (jit == "-jit" && bytecode == "off"))
376

    
377
          if (!skipThisCombo) {
378
            def taskname = "${release}_runXslt30TestSuite_${language}"
379
            if (bytecode != "") {
380
              taskname = "${taskname}_bc${bytecode}"
381
            }
382
            if (export != "") {
383
              taskname = "${taskname}_export"
384
            }
385
            if (jit != "") {
386
              taskname = "${taskname}_jit"
387
            }
388

    
389
            task "run_${taskname}"(
390
              type: JavaExec,
391
              dependsOn: ["${release}j_compileTestDrivers",
392
                          "${release}j_setup_xslt30_TestResults",
393
                          "cloneXslt30TestSuite"],
394
              description: "Run the XSLT 3.0 test suite driver for ${RELEASE}/${language}/${bytecode}/${export}/${jit}"
395
            ) {
396
              inputs.files fileTree(dir: "src")
397
              outputs.file "${resdir}/results_XSLT3.0_${saxonVersion}.xml"
398

    
399
              classpath = configurations.testDrivers \
400
              + files("${buildDir}/classes/${release}j") \
401
              + files("${buildDir}/testdriver_classes/${release}j")
402

    
403
              main = "${jpackage}.Xslt30TestSuiteDriver${RELEASE}"
404
              def testargs = [w3cXslt30TestSuiteDir,
405
                              "catalog.xml",
406
                              "-o:${resdir}",
407
                              "-lang:${language}",
408
                              "-ps:off"]
409
              if (testSuiteDebug != "") {
410
                testargs += [ testSuiteDebug ]
411
              }
412
              if (bytecode != "") {
413
                testargs += [ "-bytecode:${bytecode}" ]
414
              }
415
              if (export != "") {
416
                testargs += [ export ]
417
              }
418
              if (jit != "") {
419
                testargs += [ jit ]
420
              }
421

    
422
              args testargs
423
            }
424

    
425
            task "${taskname}"(
426
              type: Copy,
427
              dependsOn: "run_${taskname}"
428
            ) {
429
              def bflag = ""
430
              if (bytecode != "") {
431
                bflag = "-${bytecode}"
432
              }
433
              into "${resdir}/results"
434
              from resdir
435
              include "results_XSLT3.0_${saxonVersion}.xml"
436
              rename { filename ->
437
                "saxon-${saxonVersion}-${language}${bflag}${export}${jit}.xml"
438
              }
439
            }
440
            xslt30TestsJava.dependsOn taskname
441
            tasks.findByName("${release}jTestSuitesJava").dependsOn taskname
442
          }
443
        }
444
      }
445
    }
446
  }
447
}
448

    
449
// ============================================================
450
// Tasks to run XSLT3.0 extra test driver with a variety of options
451

    
452
task xslt30ExtraTestsJava() {
453
  // Just somewhere to hang dependencies
454
}
455

    
456
["he", "pe", "ee"].each { release ->
457
  def RELEASE = release.toUpperCase()
458
  def jpackage = "com.saxonica.testdriver"
459
  if (release == "he") {
460
    jpackage = "net.sf.saxon.testdriver"
461
  }
462

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

    
465
  def languages = ["XT30"]
466
  def bytecodes = [""]
467
  if (release == "ee") {
468
    bytecodes = ["off", "on"]
469
  }
470

    
471
  languages.each { language ->
472
    bytecodes.each { bytecode ->
473
      def taskname = "${release}_runXslt30ExtraTestSuite_${language}"
474
      if (bytecode != "") {
475
        taskname = "${taskname}_bc${bytecode}"
476
      }
477

    
478
      task "run_${taskname}"(
479
        type: JavaExec,
480
        dependsOn: ["${release}j_compileTestDrivers",
481
                    "${release}j_setup_xslt30extra_TestResults"],
482
        description: "Run the XSLT 3.0 extra test suite driver for ${RELEASE}/${language}/${bytecode}"
483
      ) {
484
        inputs.files fileTree(dir: "src")
485
        outputs.file "${resdir}/results_XSLT3.0_${saxonVersion}.xml"
486

    
487
        classpath = configurations.testDrivers \
488
        + files("${buildDir}/classes/${release}j") \
489
        + files("${buildDir}/testdriver_classes/${release}j")
490

    
491
        main = "${jpackage}.Xslt30TestSuiteDriver${RELEASE}"
492
        def testargs = ["${projectDir}/src/test/extra/xslt30",
493
                        "catalog.xml",
494
                        "-o:${resdir}",
495
                        "-lang:${language}",
496
                        "-ps:off"]
497
        if (testSuiteDebug != "") {
498
          testargs += [ testSuiteDebug ]
499
        }
500
        if (bytecode != "") {
501
          testargs += [ "-bytecode:${bytecode}" ]
502
        }
503

    
504
        args testargs
505
      }
506

    
507
      task "${taskname}"(
508
        type: Copy,
509
        dependsOn: "run_${taskname}"
510
      ) {
511
        def bflag = ""
512
        if (bytecode != "") {
513
          bflag = "-${bytecode}"
514
        }
515
        into "${resdir}/results"
516
        from resdir
517
        include "results_XSLT3.0_${saxonVersion}.xml"
518
        rename { filename ->
519
          "saxon-${saxonVersion}-${language}${bflag}.xml"
520
        }
521
      }
522
      xslt30ExtraTestsJava.dependsOn taskname
523
      tasks.findByName("${release}jTestSuitesJava").dependsOn taskname
524
    }
525
  }
526
}
527

    
528
// ============================================================
529
// Tasks to run XSD test driver with a variety of options
530

    
531
task xsdTestsJava() {
532
  // Just somewhere to hang dependencies
533
}
534

    
535
// Only applies to EE
536
["ee"].each { release ->
537
  def RELEASE = release.toUpperCase()
538
  def jpackage = "com.saxonica.testdriver.ee"
539

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

    
542
  def languages = ["1.0", "1.1"]
543
  def bytecodes = ["off", "on"]
544

    
545
  languages.each { language ->
546
    bytecodes.each { bytecode ->
547
      def taskname = "${release}_runXsdTestSuite_${language}_bc${bytecode}"
548

    
549
      task "run_${taskname}"(
550
        type: JavaExec,
551
        dependsOn: ["${release}j_compileTestDrivers", "${release}j_setup_xsd_TestResults",
552
                    "cloneXsdTestSuite"],
553
        description: "Run the XSD test suite driver for ${RELEASE}/${language}/${bytecode}"
554
      ) {
555
        inputs.files fileTree(dir: "src")
556
        outputs.file "${resdir}/SaxonFailures${saxonVersion}.xml"
557
        outputs.file "${resdir}/SaxonResults${saxonVersion}-${language}.xml"
558

    
559
        classpath = configurations.testDrivers \
560
        + files("${buildDir}/classes/${release}j") \
561
        + files("${buildDir}/testdriver_classes/${release}j")
562

    
563
        main = "${jpackage}.SchemaTestSuiteDriver"
564
        def testargs = [w3cXsdTestSuiteDir,
565
                        "-local:${resdir}",
566
                        "-v:${language}"]
567
        if (bytecode != "") {
568
          testargs += [ "-bytecode:${bytecode}" ]
569
        }
570

    
571
        args testargs
572
      }
573

    
574
      task "${taskname}"(
575
        type: Copy,
576
        dependsOn: "run_${taskname}"
577
      ) {
578
        def bflag = ""
579
        if (bytecode != "off") {
580
          bflag = "-${bytecode}"
581
        }
582
        into "${resdir}/results"
583
        from resdir
584
        include "SaxonResults${saxonVersion}-${language}.xml"
585
        rename { filename ->
586
          "saxon-${saxonVersion}-XSD${language}${bflag}.xml"
587
        }
588
      }
589
      xsdTestsJava.dependsOn taskname
590
      tasks.findByName("${release}jTestSuitesJava").dependsOn taskname
591
    }
592
  }
593
}
594

    
595
// ============================================================
596
// Tasks to run XSD extra test driver with a variety of options
597

    
598
task xsdExtraTestsJava() {
599
  // Just somewhere to hang dependencies
600
}
601

    
602
// Not currently enabled.
603

    
604
// ============================================================
605

    
606
// ============================================================
607

    
608
["h", "p", "e"].each { initial ->
609
  def release = initial + "e"
610
  def RELEASE = release.toUpperCase()
611

    
612
  task "${release}_samples_common"(
613
    type: Copy,
614
    dependsOn: ["${release}_samples", "${release}_samples_cs"]
615
  ) {
616
    into "${buildDir}/output/${release}/resources/use-cases"
617
    from "${projectDir}/src/use-cases"
618
  }
619

    
620
  task "${release}_samples"(
621
    type: Copy
622
  ) {
623
    into "${buildDir}/output/${release}/resources/samples"
624
    from ("${projectDir}/src/samples") {
625
      include "config/config.xml"
626
      include "config/config-HE.xml"
627
      include "config/config.xsd"
628
      include "config/saxon-attributes.xsd"
629
      include "data/books.xml"
630
      include "data/books-invalid.xml"
631
      include "data/more-books.xml"
632
      include "data/othello.xml"
633
      include "data/books.xsd"
634
      include "data/books.dtd"
635
      include "data/play.dtd"
636
      include "query/tour.xq"
637
      include "query/books.xq"
638
      include "query/books-to-html.xq"
639
      include "scm/scmschema.*"
640
      include "schemas/validation-reports.xsd"
641
      include "styles/add-ids.xsl"
642
      include "styles/bible.xsl"
643
      include "styles/books.xsl"
644
      include "styles/books.txt"
645
      include "styles/play.xsl"
646
      include "styles/identity.xsl"
647
      include "styles/books-csv.xsl"
648
      include "styles/books-sql.xsl"
649
      include "styles/rename-to-lowercase.xsl"
650
      include "styles/total.xsl"
651
      include "styles/tour.xsl"
652
      include "styles/summarize.xsl"
653
    }
654
  }
655

    
656
  // TODO reinstate to include CS samples when releasing for .NET
657
  task "${release}_samples_cs"(
658
    type: Copy
659
  ) {
660
    into "${buildDir}/output/${release}/resources/samples/cs"
661
    from "${projectDir}/src/samples/cs"
662
  }
663
}
664

    
665
task config_sample(
666
  type: JavaExec,
667
  dependsOn: ["hej_featureKeys"],
668
  description: "Construct the configuration file XSD"
669
) {
670
  inputs.files fileTree(dir: "${projectDir}/tools/featureKeys")
671
  inputs.files "${projectDir}/src/samples/config/config-raw.xsd"
672
  outputs.file "${buildDir}/output/he/resources/samples/config/config.xsd"
673
  classpath = configurations.preprocessor
674
  main = "net.sf.saxon.Transform"
675
  args "-xsl:${projectDir}/tools/featureKeys/FeatureKeysToSchema.xsl",
676
    "-o:${buildDir}/output/he/resources/samples/config/config.xsd",
677
    "-it:main",
678
    "FeatureKeys=FeatureKeys.xml",
679
    "AdditionalFeatures=AdditionalFeatures.xml",
680
    "ConfigSchema=${projectDir}/src/samples/config/config-raw.xsd"
681
}
682

    
683
task hej_setup_samples(
684
  type: Copy,
685
  dependsOn: ["config_sample", "he_samples_common"]
686
) {
687
  into "${buildDir}/output/he/resources/samples/java/he"
688
  from ("${projectDir}/src/samples/java/he") {
689
    include "ApplyXPathJAXP.java"
690
    include "ExampleContentHandler.java"
691
    include "QueryAPIExamples.java"
692
    include "S9APIExamples.java"
693
    include "S9APIExamplesOM.java"
694
    include "SaxonServlet.java"
695
    include "JAXPExamples.java"
696
    include "XPathExample.java"
697
    include "XPathExampleDOM.java"
698
    include "XPathExampleServlet.java"
699
  }
700
}
701

    
702
task hej_samples(
703
  type: JavaCompile,
704
  dependsOn: ["hej_setup_samples", "hejCompile"]
705
) {
706
  classpath = configurations.samples + files("${buildDir}/classes/hej")
707
  source = "${buildDir}/output/he/resources/samples/java/he"
708
  destinationDirectory = new File("${buildDir}/output/he/resources/samples/java/classes")
709
  doFirst {
710
    mkdir "${buildDir}/output/he/resources/samples/java/classes"
711
  }
712
}
713

    
714
task eej_setup_samples(
715
  type: Copy,
716
  dependsOn: ["config_sample", "ee_samples_common"]
717
) {
718
  into "${buildDir}/output/he/resources/samples/java/ee"
719
  from ("${projectDir}/src/samples/java/ee") {
720
    include "JDOM2Example.java"
721
    include "PullExamples.java"
722
    include "QuickValidator.java"
723
    include "SaxonSAServlet.java"
724
    include "SchemaValidatorExample.java"
725
    include "SchemaValidatorHandlerExample.java"
726
    include "XMarkBenchmark.java"
727
    include "XPathExampleSA.java"
728
    include "XQJExamples.java"
729
  }
730
}
731

    
732
task eej_samples(
733
  type: JavaCompile,
734
  dependsOn: ["eej_setup_samples", "eejCompile", "hej_samples"]
735
) {
736
  classpath = configurations.samples + (files("${buildDir}/classes/eej")
737
              + files("${buildDir}/output/he/resources/samples/java/classes"))
738
  source = "${buildDir}/output/he/resources/samples/java/ee"
739
  destinationDirectory = new File("${buildDir}/output/ee/resources/samples/java/classes")
740
  doFirst {
741
    mkdir "${buildDir}/output/ee/resources/samples/java/classes"
742
  }
743
}
744

    
745
// ============================================================
746

    
747
task he_samples_JAXPExamples(
748
  type: Exec,
749
  dependsOn: ["hej_samples", "hejJar"],
750
  description: "Run test of JAXPExamples for he"
751
) {
752
  inputs.files fileTree(dir: "${buildDir}/output/he/resources/samples/java/classes/he")
753
  inputs.files "${projectDir}/src/samples/java/he"
754
  workingDir = "${buildDir}/output/he/resources/samples"
755

    
756
  def args = ["java",
757
              "-cp",
758
              "${buildDir}/libs/saxon-he-${saxonVersion}.jar:${buildDir}/output/he/resources/samples/java/classes",
759
              "he/JAXPExamples", "all"]
760

    
761
  commandLine args
762
}
763

    
764
/*
765

    
766
    <macrodef name="samples-JAXPExamples"
767
              description="Run test of JAXPExamples samples">
768
        <attribute name="version"/>
769
        <attribute name="target"/>
770
        <sequential>
771
            <exec executable="java"
772
                  dir="${build-resources.dir}/samples"
773
                  failonerror="true">
774
                <arg line="-cp ${basedir}/${build-resources.dir}/samples/java/classes${Z}${basedir}/${build-@{version}j.dir}/saxon-@{version}-${major.version}.jar${Z}${license.dir}"/>
775
                <arg line="he/JAXPExamples"/>
776
                <arg line="@{target}"/>
777
            </exec>
778
        </sequential>
779
    </macrodef>
780

    
781
    <target name="test-samples-JAXPExamples-j" depends="samples-j">
782
        <samples-JAXPExamples version="he" target="all"/>
783
        <samples-JAXPExamples version="pe" target="all"/>
784
        <samples-JAXPExamples version="ee" target="all"/>
785
    </target>
786

    
787

    
788
/*
789
}
790

    
791
    <!-- S9APIExamples sample tests -->
792
    <macrodef name="samples-s9api"
793
        description="Run test of s9api samples">
794
        <attribute name="version"
795
        <attribute name="target"
796
        <sequential>
797
            <exec executable="java"
798
                dir="${build-resources.dir}/samples"
799
                failonerror="true">
800
                <arg line="-cp ${basedir}/${build-resources.dir}/samples/java/classes${Z}${basedir}/${build-@{version}j.dir}/saxon-@{version}-${major.version}.jar${Z}${license.dir}"
801
                <arg line="he/S9APIExamples"
802
                <arg line="@{target}"
803
            </exec>
804
        </sequential>
805
    </macrodef>
806

    
807
        <samples-s9api version="he" target="QueryA"
808
*/
(14-14/14)