1
|
plugins {
|
2
|
id "java"
|
3
|
id "maven-publish"
|
4
|
id "signing"
|
5
|
// id "com.cdsap.talaiot" version "1.3.5"
|
6
|
}
|
7
|
|
8
|
import org.gradle.internal.os.OperatingSystem;
|
9
|
|
10
|
apply plugin: 'java'
|
11
|
|
12
|
repositories {
|
13
|
mavenLocal()
|
14
|
mavenCentral()
|
15
|
maven { url = "https://maven.apache.org" }
|
16
|
maven { url "https://dev.saxonica.com/maven" }
|
17
|
}
|
18
|
|
19
|
configurations.all {
|
20
|
resolutionStrategy {
|
21
|
force 'xml-apis:xml-apis:1.4.01'
|
22
|
}
|
23
|
}
|
24
|
|
25
|
configurations {
|
26
|
preprocessor.extendsFrom(runtimeOnly)
|
27
|
jarjarAsm.extendsFrom(implementation)
|
28
|
testDrivers.extendsFrom(testImplementation)
|
29
|
productTests.extendsFrom(testImplementation)
|
30
|
ikvm.extendsFrom(implementation)
|
31
|
compileDotNet.extendsFrom(implementation)
|
32
|
asmDotNet.extendsFrom(implementation)
|
33
|
documentation.extendsFrom(implementation)
|
34
|
jeldoclet.extendsFrom(implementation)
|
35
|
samples.extendsFrom(implementation)
|
36
|
}
|
37
|
|
38
|
// Set saxonLicenseDir in gradle.properties, or from the
|
39
|
// command line if you have a license in some other place.
|
40
|
if (!hasProperty("saxonLicenseDir")) {
|
41
|
if (System.getenv("SAXON_LICENSE_DIR") != null) {
|
42
|
ext.saxonLicenseDir=System.getenv('SAXON_LICENSE_DIR')
|
43
|
} else {
|
44
|
ext.saxonLicenseDir=System.getenv('HOME') + "/java"
|
45
|
}
|
46
|
}
|
47
|
|
48
|
// Set the locations of the W3C test suites
|
49
|
if (!hasProperty("w3cQT3TestSuiteDir")) {
|
50
|
ext.w3cQT3TestSuiteDir = System.getenv("W3C_QT3_TEST_SUITE_DIR")
|
51
|
}
|
52
|
if (!hasProperty("w3cXslt30TestSuiteDir")) {
|
53
|
ext.w3cXslt30TestSuiteDir = System.getenv("W3C_XSLT30_TEST_SUITE_DIR")
|
54
|
}
|
55
|
if (!hasProperty("w3cXsdTestSuiteDir")) {
|
56
|
ext.w3cXsdTestSuiteDir = System.getenv("W3C_XSD_TEST_SUITE_DIR")
|
57
|
}
|
58
|
|
59
|
dependencies {
|
60
|
preprocessor (
|
61
|
[group: 'com.igormaznitsa', name: 'jcp', version: '7.0.4'],
|
62
|
[group: 'com.tonicsystems', name: 'jarjar', version: '0.6' ],
|
63
|
[group: 'net.sf.saxon', name: 'Saxon-HE', version: '10.3' ],
|
64
|
files(saxonLicenseDir)
|
65
|
)
|
66
|
implementation (
|
67
|
[group: 'org.apache.ws.commons.axiom', name: 'axiom', version: '1.2.15'],
|
68
|
[group: 'org.apache.ws.commons.axiom', name: 'axiom-dom', version: '1.2.15'],
|
69
|
[group: 'xom', name: 'xom', version: '1.3.5'],
|
70
|
[group: 'org.jdom', name: 'jdom', version: '1.1.3'],
|
71
|
[group: 'org.jdom', name: 'jdom2', version: '2.0.6'],
|
72
|
[group: 'org.lucee', name: 'dom4j', version: '1.6.1'],
|
73
|
[group: 'xml-resolver', name: 'xml-resolver', version: '1.2' ],
|
74
|
[group: 'com.ibm.icu', name: 'icu4j', version: icu4jVersion ],
|
75
|
[group: 'jline', name: 'jline', version: '2.14.6' ],
|
76
|
[group: 'org.jetbrains', name: 'annotations', version: '20.1.0' ],
|
77
|
// PE and EE
|
78
|
[group: 'javax.mail', name: 'javax.mail-api', version: mailVersion ],
|
79
|
[group: 'com.sun.mail', name: 'javax.mail', version: mailVersion ],
|
80
|
[group: 'org.ccil.cowan.tagsoup', name: 'tagsoup', version: tagsoupVersion],
|
81
|
fileTree(dir: "extra/MyDotNet/classpath"),
|
82
|
fileTree(dir: "extra/MyDotNet/stubs"),
|
83
|
fileTree(dir: "lib/asm-${asmVersion}"),
|
84
|
files("lib/Tidy.jar"),
|
85
|
)
|
86
|
jarjarAsm (
|
87
|
fileTree(dir: "${buildDir}/lib/asm")
|
88
|
)
|
89
|
ikvm (
|
90
|
fileTree(dir: "${ikvmDir}/stubs")
|
91
|
)
|
92
|
compileDotNet (
|
93
|
fileTree(dir: "${ikvmDir}/stubs"),
|
94
|
fileTree(dir: "${ikvmDir}/classpath")
|
95
|
)
|
96
|
asmDotNet (
|
97
|
fileTree(dir: "${ikvmDir}/stubs"),
|
98
|
fileTree(dir: "${ikvmDir}/classpath"),
|
99
|
fileTree(dir: "lib/asm-${asmVersion}")
|
100
|
)
|
101
|
testImplementation (
|
102
|
[group: 'junit', name: 'junit', version: '4.12'],
|
103
|
[group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.4.2'],
|
104
|
[group: 'org.junit.platform', name: 'junit-platform-console-standalone', version: '1.7.1'],
|
105
|
[group: 'org.apache.ant', name: 'ant', version: '1.10.9' ],
|
106
|
files("src/main/resources"),
|
107
|
files("lib/Tidy.jar"),
|
108
|
files(saxonLicenseDir),
|
109
|
fileTree("${buildDir}/lib/asm")
|
110
|
)
|
111
|
testRuntimeOnly (
|
112
|
[group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.4.2'],
|
113
|
[group: 'org.junit.vintage', name: 'junit-vintage-engine', version: '5.4.2'],
|
114
|
[group: 'org.apache.ant', name: 'ant', version: '1.10.9' ],
|
115
|
files("${buildDir}/classes/${saxonEdition}j")
|
116
|
)
|
117
|
documentation (
|
118
|
[group: "com.saxonica", name: "Saxon-EE", version: "10.3"],
|
119
|
[group: "org.ccil.cowan.tagsoup", name: "tagsoup", version: "1.2.1"],
|
120
|
files("lib/jeldoc.jar"),
|
121
|
files(saxonLicenseDir)
|
122
|
)
|
123
|
jeldoclet (
|
124
|
files("lib/jeldoc.jar"),
|
125
|
// I don't really understand why this has to be done explicitly...
|
126
|
files("${System.getProperty('java.home')}/../lib/tools.jar")
|
127
|
)
|
128
|
samples (
|
129
|
[group: 'javax.servlet', name: 'servlet-api', version: '2.5']
|
130
|
)
|
131
|
}
|
132
|
|
133
|
javadoc {
|
134
|
classpath = configurations.implementation
|
135
|
}
|
136
|
|
137
|
test {
|
138
|
useJUnitPlatform {
|
139
|
excludeTags 'bytecode'
|
140
|
}
|
141
|
}
|
142
|
|
143
|
/*
|
144
|
talaiot {
|
145
|
metrics {
|
146
|
performanceMetrics = false
|
147
|
}
|
148
|
publishers {
|
149
|
taskDependencyGraphPublisher {
|
150
|
gexf = false
|
151
|
dot = true
|
152
|
html = false
|
153
|
}
|
154
|
}
|
155
|
}
|
156
|
*/
|
157
|
|
158
|
ext {
|
159
|
systemOs = OperatingSystem.current()
|
160
|
icu4jJar = null
|
161
|
tagsoupJar = null
|
162
|
mailJar = null
|
163
|
resolverJar = null
|
164
|
version_h = saxonVersion.replace(".", "-")
|
165
|
pathSeparator = System.getProperty("file.separator")
|
166
|
DSTAMP=new Date().format("yyyyMMdd")
|
167
|
}
|
168
|
|
169
|
public class DeleteFilesRecursively {
|
170
|
static void delete(File file){
|
171
|
for (File fspec : file.listFiles()) {
|
172
|
if (fspec.isDirectory()) {
|
173
|
delete(fspec);
|
174
|
} else {
|
175
|
fspec.delete();
|
176
|
}
|
177
|
}
|
178
|
file.delete();
|
179
|
}
|
180
|
}
|
181
|
|
182
|
// ============================================================
|
183
|
// Have you switched branches?
|
184
|
def branch = new ByteArrayOutputStream()
|
185
|
def result = exec {
|
186
|
commandLine "git", "rev-parse", "--abbrev-ref", "HEAD"
|
187
|
standardOutput = branch;
|
188
|
}
|
189
|
def currentBranch = branch.toString().trim()
|
190
|
|
191
|
def builtBranch = "none";
|
192
|
try {
|
193
|
def xbranch = new BufferedReader(new FileReader(new File("build/built-branch")))
|
194
|
builtBranch = "${xbranch.readLine().trim()}"
|
195
|
} catch (FileNotFoundException foe) {
|
196
|
// nop
|
197
|
}
|
198
|
|
199
|
if (currentBranch != builtBranch
|
200
|
&& (file("${buildDir}/src").exists()
|
201
|
|| file("${buildDir}/preprocess").exists()
|
202
|
|| file("${buildDir}/filtered").exists()
|
203
|
|| file("${buildDir}/classes").exists())) {
|
204
|
println("You appear to have switched to the '${currentBranch}' branch.")
|
205
|
println("Deleting stale build sources...")
|
206
|
DeleteFilesRecursively.delete(new File("${buildDir}/src"))
|
207
|
DeleteFilesRecursively.delete(new File("${buildDir}/preprocess"))
|
208
|
DeleteFilesRecursively.delete(new File("${buildDir}/filtered"))
|
209
|
DeleteFilesRecursively.delete(new File("${buildDir}/classes"))
|
210
|
}
|
211
|
|
212
|
// ============================================================
|
213
|
// Private options required for signing jars. (Can't be
|
214
|
// checked into the repository because they're sekrit.)
|
215
|
def eToken = "THIS-IS-NOT-THE-ETOKEN"
|
216
|
["${System.getenv("SAXON_SIGN_ETOKEN")}",
|
217
|
"${projectDir}/../../private/eToken/macos/eToken.cfg",
|
218
|
"z:/some/other/token/path"].each { path ->
|
219
|
if (eToken == "THIS-IS-NOT-THE-ETOKEN"
|
220
|
&& new File(path).exists()) {
|
221
|
eToken = path
|
222
|
}
|
223
|
}
|
224
|
|
225
|
def signkeyNewAlias = "THIS-IS-NOT-THE-ALIAS"
|
226
|
if (System.getenv("SAXON_SIGN_ALIAS") != null) {
|
227
|
signkeyNewAlias = System.getenv("SAXON_SIGN_ALIAS")
|
228
|
}
|
229
|
|
230
|
def signkeyPassword = "THIS-IS-NOT-THE-PASSWORD"
|
231
|
if (System.getenv("SAXON_SIGN_PASSWORD") != null) {
|
232
|
signkeyPassword = System.getenv("SAXON_SIGN_PASSWORD")
|
233
|
}
|
234
|
|
235
|
def canSignJars = (!eToken.startsWith("THIS-IS-NOT")
|
236
|
&& !signkeyNewAlias.startsWith("THIS-IS-NOT")
|
237
|
&& !signkeyPassword.startsWith("THIS-IS-NOT"))
|
238
|
|
239
|
def signjarArgs = null
|
240
|
if (OperatingSystem.current().isWindows()) {
|
241
|
signjarArgs = ["jarsigner",
|
242
|
"-keystore", "NONE",
|
243
|
"-storetype", "PKCS11",
|
244
|
"-tsa", "http://rfc3161timestamp.globalsign.com/advanced",
|
245
|
"-providerClass", "sun.security.pkcs11.SunPKCS11",
|
246
|
"-providerArg", eToken]
|
247
|
} else {
|
248
|
signjarArgs = ["jarsigner",
|
249
|
"-tsa", "http://rfc3161timestamp.globalsign.com/advanced",
|
250
|
"-storetype", "PKCS11",
|
251
|
"-providerClass", "sun.security.pkcs11.SunPKCS11",
|
252
|
"-providerArg", eToken]
|
253
|
}
|
254
|
|
255
|
// ============================================================
|
256
|
// Find jar files that need to be part of the build or release
|
257
|
//
|
258
|
def filesep = System.getProperty("file.separator")
|
259
|
icu4jJar = "${filesep}icu4j-${icu4jVersion}.jar"
|
260
|
tagsoupJar = "${filesep}tagsoup-${tagsoupVersion}.jar"
|
261
|
mailJar = "${filesep}javax.mail-${mailVersion}.jar"
|
262
|
resolverJar = "${filesep}xml-resolver-1.2.jar"
|
263
|
configurations.compileClasspath.each { cp ->
|
264
|
if (cp.toString().endsWith(icu4jJar)) {
|
265
|
icu4jJar = cp.toString()
|
266
|
}
|
267
|
if (cp.toString().endsWith(tagsoupJar)) {
|
268
|
tagsoupJar = cp.toString()
|
269
|
}
|
270
|
if (cp.toString().endsWith(mailJar)) {
|
271
|
mailJar = cp.toString()
|
272
|
}
|
273
|
if (cp.toString().endsWith(resolverJar)) {
|
274
|
resolverJar = cp.toString()
|
275
|
}
|
276
|
}
|
277
|
|
278
|
apply from: "build-n.gradle"
|
279
|
apply from: "build-c.gradle"
|
280
|
apply from: "build-doc.gradle"
|
281
|
apply from: "test-suites.gradle"
|
282
|
|
283
|
def pathExists(pathname) {
|
284
|
// Returns true iff pathame is an existing file or directory
|
285
|
try {
|
286
|
// This may throw an error for a Windows pathname, c:/path/to/thing
|
287
|
if (file(pathname).exists()) {
|
288
|
return true;
|
289
|
}
|
290
|
} catch (GradleException e) {
|
291
|
// I don't care
|
292
|
}
|
293
|
|
294
|
if (OperatingSystem.current().isWindows()) {
|
295
|
try {
|
296
|
// If we're on Windows, try to make c:/path/to/thing work
|
297
|
if (file("file:///${pathname}").exists()) {
|
298
|
return true;
|
299
|
}
|
300
|
} catch (GradleException e) {
|
301
|
// I don't care
|
302
|
}
|
303
|
}
|
304
|
|
305
|
return false
|
306
|
}
|
307
|
|
308
|
// ============================================================
|
309
|
// One of the features of Gradle is that you can construct tasks
|
310
|
// dynamically during the "configure" phase. This is a feature because
|
311
|
// it avoids a lot of tedious repetition of nearly identical tasks. It
|
312
|
// has the unfortunate consequence that understanding the tasks
|
313
|
// involved becomes harder. I've tried to use this feature sparingly.
|
314
|
|
315
|
["h", "p", "e"].each { initial ->
|
316
|
def release = initial + "e"
|
317
|
def Release = initial.toUpperCase() + "e"
|
318
|
def RELEASE = release.toUpperCase()
|
319
|
|
320
|
if (release != "he") {
|
321
|
Task libs = task "${release}j_libs"(
|
322
|
description: "Dependency to make sure library files are copie for ${RELEASE}"
|
323
|
) {
|
324
|
// Just a container to hang dependencies on
|
325
|
}
|
326
|
|
327
|
Task icu4j = task "${release}j_icu4j"(
|
328
|
type: Copy,
|
329
|
description: "Copy the ICU4J jar into the ${RELEASE} release directory"
|
330
|
) {
|
331
|
from "${icu4jJar}"
|
332
|
into "${buildDir}/releases/${release}j"
|
333
|
}
|
334
|
libs.dependsOn icu4j
|
335
|
}
|
336
|
|
337
|
task "${release}j_notices"(
|
338
|
type: Copy,
|
339
|
description: "Copy the notices into the ${RELEASE} release directory"
|
340
|
) {
|
341
|
into "${buildDir}/releases/${release}j"
|
342
|
from ("src/docs") {
|
343
|
exclude "saxon9"
|
344
|
exclude "tools"
|
345
|
exclude "saxonc-doc"
|
346
|
exclude "welcome"
|
347
|
exclude "notices/APACHE-ANT.txt"
|
348
|
exclude "notices/APACHE-RESOLVER.txt"
|
349
|
exclude "notices/APACHE-TAGSOUP.txt"
|
350
|
exclude "notices/APACHE-XERCES.txt"
|
351
|
exclude "notices/ASM.txt"
|
352
|
exclude "notices/FRIJTERS.txt"
|
353
|
exclude "notices/GPL+CLASSPATH.txt"
|
354
|
exclude "notices/ICU-J.txt"
|
355
|
exclude "notices/LEGAL.txt"
|
356
|
}
|
357
|
}
|
358
|
|
359
|
task "${release}j_copyTestDrivers"(
|
360
|
dependsOn: ["${release}j_copyTestDriverSources",
|
361
|
"${release}j_copyTestDriverResources"],
|
362
|
description: "Copy test driver sources and resources for ${RELEASE}"
|
363
|
) {
|
364
|
// Just a container to hang dependencies on
|
365
|
}
|
366
|
}
|
367
|
|
368
|
// ============================================================
|
369
|
// In an ideal world, I'd make the build process more standalone
|
370
|
// by automatically cloning the repositories if they weren't
|
371
|
// available. But the QT3 test suite in particular is huge and
|
372
|
// takes a long time to clone. So for now, just force users to
|
373
|
// tell us where they've cloned them.
|
374
|
|
375
|
task cloneQT3TestSuite() {
|
376
|
doLast {
|
377
|
if (w3cQT3TestSuiteDir == null) {
|
378
|
throw new GradleException("The location of the QT3 test suite is unknown.")
|
379
|
}
|
380
|
}
|
381
|
}
|
382
|
|
383
|
task cloneXslt30TestSuite() {
|
384
|
doLast {
|
385
|
if (w3cXslt30TestSuiteDir == null) {
|
386
|
throw new GradleException("The location of the XSLT 3.0 test suite is unknown.")
|
387
|
}
|
388
|
}
|
389
|
}
|
390
|
|
391
|
task cloneXsdTestSuite() {
|
392
|
doLast {
|
393
|
if (w3cXsdTestSuiteDir == null) {
|
394
|
throw new GradleException("The location of the XSD test suite is unknown.")
|
395
|
}
|
396
|
}
|
397
|
}
|
398
|
|
399
|
// ============================================================
|
400
|
|
401
|
task hejJarTests(
|
402
|
type: Jar,
|
403
|
dependsOn: ["hejCompile", "hej_compileTestDrivers"],
|
404
|
description: "Create the tests jar file for HE"
|
405
|
) {
|
406
|
archiveBaseName = "saxon-he-test-${saxonVersion}"
|
407
|
manifest {
|
408
|
attributes "Project-Name": "Saxon-HE-TestDriver"
|
409
|
attributes "Main-Class": "com.saxonica.testdriver.gui.TestDriverGui"
|
410
|
}
|
411
|
from ("${buildDir}/testdriver_classes/hej") {
|
412
|
include "net/sf/saxon/testdriver/**"
|
413
|
}
|
414
|
}
|
415
|
|
416
|
task pejJarTests(
|
417
|
type: Jar,
|
418
|
dependsOn: ["pejCompile", "pej_compileTestDrivers"],
|
419
|
description: "Create the tests jar file for PE"
|
420
|
) {
|
421
|
archiveBaseName = "saxon-pe-test-${saxonVersion}"
|
422
|
manifest {
|
423
|
attributes "Project-Name": "Saxon-PE-TestDriver"
|
424
|
attributes "Main-Class": "com.saxonica.testdriver.gui.TestDriverGui"
|
425
|
}
|
426
|
from ("${buildDir}/testdriver_classes/pej") {
|
427
|
include "net/sf/saxon/testdriver/**"
|
428
|
include "com/saxonica/testdriver/**"
|
429
|
exclude "com/saxonica/testdriver/ee/**"
|
430
|
}
|
431
|
}
|
432
|
|
433
|
task eejJarTests(
|
434
|
type: Jar,
|
435
|
dependsOn: ["eejCompile", "eej_compileTestDrivers"],
|
436
|
description: "Create the tests jar file for EE"
|
437
|
) {
|
438
|
archiveBaseName = "saxon-ee-test-${saxonVersion}"
|
439
|
manifest {
|
440
|
attributes "Project-Name": "Saxon-EE-TestDriver"
|
441
|
attributes "Main-Class": "com.saxonica.testdriver.gui.TestDriverGui"
|
442
|
}
|
443
|
from ("${buildDir}/testdriver_classes/eej") {
|
444
|
include "net/sf/saxon/testdriver/**"
|
445
|
include "com/saxonica/testdriver/**"
|
446
|
include "com/saxonica/js/**"
|
447
|
}
|
448
|
}
|
449
|
|
450
|
// ============================================================
|
451
|
|
452
|
task hej_featureKeys(
|
453
|
type: JavaExec,
|
454
|
description: "Construct the feature keys for HE"
|
455
|
) {
|
456
|
inputs.files fileTree(dir: "${projectDir}/tools/featureKeys")
|
457
|
outputs.file "${projectDir}/src/main/java/net/sf/saxon/lib/Feature.java"
|
458
|
outputs.file "${projectDir}/src/main/java/net/sf/saxon/lib/FeatureCode.java"
|
459
|
outputs.file "${projectDir}/src/main/java/net/sf/saxon/lib/FeatureKeys.java"
|
460
|
classpath = configurations.preprocessor
|
461
|
main = "net.sf.saxon.Transform"
|
462
|
args "${projectDir}/tools/featureKeys/FeatureKeys.xml",
|
463
|
"-xsl:${projectDir}/tools/featureKeys/FeatureKeysToJava.xsl",
|
464
|
"-o:${projectDir}/src/main/java/net/sf/saxon/lib/establish-an-output-base-uri"
|
465
|
}
|
466
|
|
467
|
// Make sure we create feature keys before compiling Java
|
468
|
compileJava.dependsOn hej_featureKeys
|
469
|
|
470
|
task hej_setupPreprocess(
|
471
|
type: Copy,
|
472
|
dependsOn: ["hej_featureKeys", "record_branch"],
|
473
|
description: "Copy HE sources for preprocessing HE"
|
474
|
) {
|
475
|
from "${projectDir}/src/main/java"
|
476
|
into "${buildDir}/filtered/hej"
|
477
|
include "net/sf/saxon/**/*.java"
|
478
|
include "net/sf/saxon/**/package.html"
|
479
|
//include "net/sf/saxon/data/**"
|
480
|
exclude "javax/xml/xquery/*.java"
|
481
|
exclude "**/dotnet/**"
|
482
|
exclude "net/sf/saxon/testdriver/**"
|
483
|
exclude "net/sf/saxon/option/sql/**"
|
484
|
exclude "net/sf/saxon/option/cpp/**"
|
485
|
exclude "net/sf/saxon/jetonnet/**"
|
486
|
}
|
487
|
|
488
|
task hej_setupPreprocessForPej(
|
489
|
type: Copy,
|
490
|
dependsOn: ["hej_featureKeys"],
|
491
|
description: "Copy HE sources for preprocessing PE"
|
492
|
) {
|
493
|
from "${projectDir}/src/main/java"
|
494
|
into "${buildDir}/filtered/pej"
|
495
|
include "net/sf/saxon/**/*.java"
|
496
|
include "javax/xml/xquery/*.java"
|
497
|
exclude "**/dotnet/**"
|
498
|
include "net/sf/saxon/**/package.html"
|
499
|
exclude "net/sf/saxon/testdriver/**"
|
500
|
exclude "net/sf/saxon/option/cpp/**"
|
501
|
exclude "net/sf/saxon/jetonnet/**"
|
502
|
//include "net/sf/saxon/data/**"
|
503
|
}
|
504
|
|
505
|
task eej_setupPreprocessForPej(
|
506
|
type: Copy,
|
507
|
description: "Copy EE sources for preprocessing PE"
|
508
|
) {
|
509
|
from "${projectDir}/src/main/java"
|
510
|
into "${buildDir}/filtered/pej"
|
511
|
include "com/saxonica/**/*.java"
|
512
|
exclude "com/saxonica/functions/extfn/cpp/*.java"
|
513
|
exclude "com/saxonica/testdriver/**"
|
514
|
exclude "com/saxonica/testdriver/ee/**/*.java"
|
515
|
exclude "com/saxonica/testdriver/old/**/*.java"
|
516
|
exclude "com/saxonica/ee/**"
|
517
|
exclude "com/saxonica/config/EnterpriseConfiguration.java"
|
518
|
exclude "com/saxonica/expr/CastToUnion.java"
|
519
|
exclude "com/saxonica/expr/CastableToUnion.java"
|
520
|
exclude "com/saxonica/expr/DotNetExtensionFunctionCall.java"
|
521
|
exclude "com/saxonica/config/ee/**"
|
522
|
exclude "com/saxonica/js/**"
|
523
|
exclude "com/saxonica/config/DotNetExtensionLibrary.java"
|
524
|
exclude "com/saxonica/config/DotNetExtensionFunctionFactory.java"
|
525
|
exclude "com/saxonica/config/DotNetPlatformPE.java"
|
526
|
exclude "com/saxonica/config/JavaPlatformEE.java"
|
527
|
exclude "com/saxonica/config/NativePlatformPE.java"
|
528
|
exclude "com/saxonica/Validate.java"
|
529
|
exclude "com/saxonica/config/EnterpriseTransformerFactory.java"
|
530
|
exclude "com/saxonica/config/StreamingTransformerFactory.java"
|
531
|
exclude "com/saxonica/config/EnterpriseXPathFactory.java"
|
532
|
exclude "com/saxonica/config/DynamicLoaderEE.java"
|
533
|
exclude "com/saxonica/config/StandardSchemaResolver.java"
|
534
|
exclude "com/saxonica/jaxp/SchemaFactoryImpl11.java"
|
535
|
exclude "com/saxonica/functions/extfn/NativeCall.java"
|
536
|
}
|
537
|
|
538
|
task pej_setupPreprocess(
|
539
|
dependsOn: ["hej_setupPreprocessForPej", "eej_setupPreprocessForPej", "record_branch"],
|
540
|
description: "Copy sources for preprocessing PE"
|
541
|
) {
|
542
|
// Just a container to hang dependencies on
|
543
|
}
|
544
|
|
545
|
task hej_setupPreprocessForEej(
|
546
|
type: Copy,
|
547
|
dependsOn: ["hej_featureKeys", "record_branch"],
|
548
|
description: "Copy HE sources for EE build"
|
549
|
) {
|
550
|
from "${projectDir}/src/main/java"
|
551
|
into "${buildDir}/filtered/eej"
|
552
|
include "net/sf/saxon/**/*.java"
|
553
|
include "javax/xml/xquery/*.java"
|
554
|
exclude "**/dotnet/**"
|
555
|
include "net/sf/saxon/**/package.html"
|
556
|
exclude "net/sf/saxon/testdriver/**"
|
557
|
exclude "net/sf/saxon/option/cpp/**"
|
558
|
exclude "net/sf/saxon/jetonnet/**"
|
559
|
exclude "net/sf/saxon/jetonnet/**"
|
560
|
//include "net/sf/saxon/data/**"
|
561
|
}
|
562
|
|
563
|
// Rename org.objectweb to com.saxonica.objectweb in the bytecode sources
|
564
|
task eej_setupPreprocessBytecode(
|
565
|
type: Copy,
|
566
|
description: "Copy bytecode sources and fix imports"
|
567
|
) {
|
568
|
from "${projectDir}/src/main/java"
|
569
|
into "${buildDir}/filtered/eej"
|
570
|
include "com/saxonica/ee/bytecode/**/*.java"
|
571
|
filter { line ->
|
572
|
line.contains("org.objectweb")
|
573
|
? line.replaceAll("org.objectweb", "com.saxonica.objectweb")
|
574
|
: line
|
575
|
}
|
576
|
}
|
577
|
|
578
|
// N.B. bytecode is explicitly excluded, see eej_setupPreprocessBytecode
|
579
|
task eej_setupPreprocess(
|
580
|
type: Copy,
|
581
|
dependsOn: ["hej_setupPreprocessForEej", "eej_setupPreprocessBytecode", "record_branch"],
|
582
|
description: "Copy sources for preprocessing EE"
|
583
|
) {
|
584
|
from "${projectDir}/src/main/java"
|
585
|
into "${buildDir}/filtered/eej"
|
586
|
include "com/saxonica/**/*.java"
|
587
|
exclude "com/saxonica/ee/bytecode/**/*.java"
|
588
|
exclude "com/saxonica/functions/extfn/cpp/*.java"
|
589
|
exclude "com/saxonica/testdriver/**/*.java"
|
590
|
exclude "com/saxonica/config/DotNetExtensionFunctionFactory.java"
|
591
|
exclude "com/saxonica/config/DotNetExtensionLibrary.java"
|
592
|
exclude "com/saxonica/config/DotNetPlatformPE.java"
|
593
|
exclude "com/saxonica/config/NativePlatformPE.java"
|
594
|
exclude "com/saxonica/expr/DotNetExtensionFunctionCall.java"
|
595
|
exclude "com/saxonica/functions/extfn/NativeCall.java"
|
596
|
include "com/saxonica/**/package.html"
|
597
|
exclude "com/saxonica/js/**"
|
598
|
}
|
599
|
|
600
|
// ============================================================
|
601
|
|
602
|
task hej_preprocess(
|
603
|
type: JavaExec,
|
604
|
dependsOn: ["hej_setupPreprocess"],
|
605
|
description: "Preprocess HE sources"
|
606
|
) {
|
607
|
inputs.files fileTree(dir: "${buildDir}/filtered/hej")
|
608
|
outputs.files fileTree(dir: "${buildDir}/preprocess/hej")
|
609
|
classpath = configurations.preprocessor
|
610
|
main = "com.igormaznitsa.jcp.JcpPreprocessor"
|
611
|
args "/c",
|
612
|
"/i:${buildDir}/filtered/hej", "/o:${buildDir}/preprocess/hej",
|
613
|
"/p:EE=false", "/p:PE=false", "/p:DOTNET=false",
|
614
|
"/p:OPT=false", "/p:SAXONC=false", "/p:BYTECODE=false"
|
615
|
doFirst {
|
616
|
mkdir "${buildDir}/preprocess/hej"
|
617
|
}
|
618
|
}
|
619
|
|
620
|
task pej_preprocess(
|
621
|
type: JavaExec,
|
622
|
dependsOn: ["pej_setupPreprocess"],
|
623
|
description: "Preprocess HE sources"
|
624
|
) {
|
625
|
inputs.files fileTree(dir: "${buildDir}/filtered/pej")
|
626
|
outputs.files fileTree(dir: "${buildDir}/preprocess/pej")
|
627
|
classpath = configurations.preprocessor
|
628
|
main = "com.igormaznitsa.jcp.JcpPreprocessor"
|
629
|
args "/c",
|
630
|
"/i:${buildDir}/filtered/pej", "/o:${buildDir}/preprocess/pej",
|
631
|
"/p:EE=false", "/p:PE=true", "/p:DOTNET=false", "/p:HOF=true",
|
632
|
"/p:OPT=false", "/p:SAXONC=false", "/p:BYTECODE=false"
|
633
|
doFirst {
|
634
|
mkdir "${buildDir}/preprocess/pej"
|
635
|
}
|
636
|
}
|
637
|
|
638
|
task eej_preprocess(
|
639
|
type: JavaExec,
|
640
|
dependsOn: ["eej_setupPreprocess", "asm_jarjar"],
|
641
|
description: "Preprocess EE sources"
|
642
|
) {
|
643
|
inputs.files fileTree(dir: "${buildDir}/filtered/eej")
|
644
|
outputs.files fileTree(dir: "${buildDir}/preprocess/eej")
|
645
|
classpath = configurations.preprocessor
|
646
|
main = "com.igormaznitsa.jcp.JcpPreprocessor"
|
647
|
args "/c",
|
648
|
"/i:${buildDir}/filtered/eej", "/o:${buildDir}/preprocess/eej",
|
649
|
"/p:EE=true", "/p:PE=false", "/p:DOTNET=false", "/p:HOF=true",
|
650
|
"/p:OPT=false", "/p:SAXONC=false", "/p:BYTECODE=true",
|
651
|
"/p:STREAM=true", "/p:PACKAGES=true", "/p:SCHEMA=true"
|
652
|
doFirst {
|
653
|
mkdir "${buildDir}/preprocess/eej"
|
654
|
}
|
655
|
}
|
656
|
|
657
|
// ============================================================
|
658
|
|
659
|
task hej_sources(
|
660
|
type: Copy,
|
661
|
dependsOn: ["hej_preprocess"],
|
662
|
description: "Collect the preprocessed HE sources for compilation"
|
663
|
) {
|
664
|
from "${buildDir}/preprocess/hej"
|
665
|
into "${buildDir}/src/hej"
|
666
|
filter { line ->
|
667
|
line.contains("import com.saxonica") ? null : line.replaceFirst("\\s++\$", "")
|
668
|
}
|
669
|
}
|
670
|
|
671
|
task pej_sources(
|
672
|
type: Copy,
|
673
|
dependsOn: ["pej_preprocess"],
|
674
|
description: "Collect the preprocessed PE sources for compilation"
|
675
|
) {
|
676
|
from "${buildDir}/preprocess/pej"
|
677
|
into "${buildDir}/src/pej"
|
678
|
filter { line ->
|
679
|
if (line.contains("import com.saxonica.ee")
|
680
|
|| line.contains("import com.saxonica.config.ee")) {
|
681
|
null
|
682
|
} else {
|
683
|
line.replaceFirst("\\s++\$", "")
|
684
|
}
|
685
|
}
|
686
|
}
|
687
|
|
688
|
task eej_sources(
|
689
|
type: Copy,
|
690
|
dependsOn: ["eej_preprocess"],
|
691
|
description: "Collect the preprocessed EE sources for compilation"
|
692
|
) {
|
693
|
from "${buildDir}/preprocess/eej"
|
694
|
into "${buildDir}/src/eej"
|
695
|
}
|
696
|
|
697
|
// ============================================================
|
698
|
|
699
|
task record_branch(
|
700
|
type: Exec,
|
701
|
description: "Records the branch so we can detect switches."
|
702
|
) {
|
703
|
def recordBranch = new ByteArrayOutputStream();
|
704
|
commandLine "git", "rev-parse", "--abbrev-ref", "HEAD"
|
705
|
standardOutput = recordBranch
|
706
|
doLast {
|
707
|
def output = new FileWriter(new File("${buildDir}/built-branch"))
|
708
|
output.write(recordBranch.toString("utf-8"))
|
709
|
output.close()
|
710
|
}
|
711
|
doFirst {
|
712
|
mkdir(buildDir)
|
713
|
}
|
714
|
}
|
715
|
|
716
|
task hejCompile(
|
717
|
type: JavaCompile,
|
718
|
dependsOn: ["hej_sources"],
|
719
|
description: "Compile HE for Saxon/Java"
|
720
|
) {
|
721
|
classpath = configurations.compileClasspath
|
722
|
source "${buildDir}/src/hej"
|
723
|
destinationDirectory = new File("${buildDir}/classes/hej")
|
724
|
}
|
725
|
|
726
|
task pejCompile(
|
727
|
type: JavaCompile,
|
728
|
dependsOn: ["pej_sources"],
|
729
|
description: "Compile PE for Saxon/Java"
|
730
|
) {
|
731
|
classpath = configurations.compileClasspath
|
732
|
source "${buildDir}/src/pej"
|
733
|
destinationDirectory = new File("${buildDir}/classes/pej")
|
734
|
}
|
735
|
|
736
|
task eejCompile(
|
737
|
type: JavaCompile,
|
738
|
dependsOn: ["eej_sources"],
|
739
|
description: "Compile EE for Saxon/Java"
|
740
|
) {
|
741
|
classpath = configurations.compileClasspath + configurations.jarjarAsm
|
742
|
source "${buildDir}/src/eej"
|
743
|
destinationDirectory = new File("${buildDir}/classes/eej")
|
744
|
}
|
745
|
|
746
|
// ============================================================
|
747
|
|
748
|
task hej_copyTestDriverSources(
|
749
|
type: Copy,
|
750
|
description: "Copy test drivers sources for HE"
|
751
|
) {
|
752
|
from "src/main/java"
|
753
|
into "${buildDir}/src/testdrivers/hej"
|
754
|
include "net/sf/saxon/testdriver/*.java"
|
755
|
}
|
756
|
|
757
|
task pej_copyTestDriverSources(
|
758
|
type: Copy,
|
759
|
description: "Copy test drivers sources for PE"
|
760
|
) {
|
761
|
from "src/main/java"
|
762
|
into "${buildDir}/src/testdrivers/pej"
|
763
|
include "com/saxonica/testdriver/QT3TestDriverPE.java"
|
764
|
include "com/saxonica/testdriver/Xslt30TestSuiteDriverPE.java"
|
765
|
include "com/saxonica/testdriver/Licensor.java"
|
766
|
include "net/sf/saxon/testdriver/*.java"
|
767
|
}
|
768
|
|
769
|
task eej_copyTestDriverSources(
|
770
|
type: Copy,
|
771
|
description: "Copy test drivers sources for EE"
|
772
|
) {
|
773
|
from "src/main/java"
|
774
|
into "${buildDir}/src/testdrivers/eej"
|
775
|
include "com/saxonica/testdriver/**/*.java"
|
776
|
include "com/saxonica/js/*.java"
|
777
|
include "net/sf/saxon/testdriver/*.java"
|
778
|
}
|
779
|
|
780
|
task hej_copyTestDriverResources(
|
781
|
type: Copy,
|
782
|
description: "Copy test drivers resources for HE"
|
783
|
) {
|
784
|
from "src/main/java"
|
785
|
into "${buildDir}/testdriver_classes/hej"
|
786
|
include "net/sf/saxon/testdriver/**"
|
787
|
exclude "net/sf/saxon/testdriver/**/*.java"
|
788
|
}
|
789
|
|
790
|
task pej_copyTestDriverResources(
|
791
|
type: Copy,
|
792
|
description: "Copy test drivers resources for PE"
|
793
|
) {
|
794
|
from "src/main/java"
|
795
|
into "${buildDir}/testdriver_classes/pej"
|
796
|
include "net/sf/saxon/testdriver/**"
|
797
|
include "com/saxonica/testdriver/**"
|
798
|
exclude "net/sf/saxon/testdriver/**/*.java"
|
799
|
exclude "com/saxonica/testdriver/**/*.java"
|
800
|
exclude "com/saxonica/testdriver/old/**"
|
801
|
exclude "com/saxonica/testdriver/gui/cache.xml"
|
802
|
}
|
803
|
|
804
|
task eej_copyTestDriverResources(
|
805
|
type: Copy,
|
806
|
description: "Copy test drivers resources for EE"
|
807
|
) {
|
808
|
from "src/main/java"
|
809
|
into "${buildDir}/testdriver_classes/eej"
|
810
|
include "net/sf/saxon/testdriver/**"
|
811
|
include "com/saxonica/testdriver/**"
|
812
|
exclude "net/sf/saxon/testdriver/**/*.java"
|
813
|
exclude "com/saxonica/testdriver/**/*.java"
|
814
|
exclude "com/saxonica/testdriver/old/**"
|
815
|
exclude "com/saxonica/testdriver/gui/cache.xml"
|
816
|
}
|
817
|
|
818
|
// ============================================================
|
819
|
// These tasks all relate to renaming (re-jarring) the ASM jar files
|
820
|
// for EE so that the class names begin com.saxonica. This avoids a
|
821
|
// problem where a different version of the ASM libraries is used in
|
822
|
// the application that is using Saxon.
|
823
|
|
824
|
task asm_createRules(
|
825
|
description: "Create the jarjar rules file for the ASM libraries"
|
826
|
) {
|
827
|
outputs.file("${buildDir}/jarjar-asm.rules")
|
828
|
doLast {
|
829
|
new File("${buildDir}/jarjar-asm.rules")
|
830
|
.withWriter("utf-8") { writer ->
|
831
|
writer.writeLine("rule org.objectweb.** com.saxonica.objectweb.@1")
|
832
|
}
|
833
|
}
|
834
|
doFirst {
|
835
|
mkdir "${buildDir}"
|
836
|
}
|
837
|
}
|
838
|
|
839
|
task asm_jarjar(
|
840
|
description: "Placeholder for the ASM jarjar dependencies"
|
841
|
) {
|
842
|
// just a task to hang dependencies on
|
843
|
}
|
844
|
|
845
|
task asm_unzip(
|
846
|
type: Copy,
|
847
|
description: "Extract classes from the asm-xml-${asmVersion} jar"
|
848
|
) {
|
849
|
// This one is from the original ASM
|
850
|
def zipFile = file("lib/asm-${asmVersion}/asm-xml-${asmVersion}.jar")
|
851
|
def outputDir = "${buildDir}/classes/eej"
|
852
|
from zipTree(zipFile)
|
853
|
into outputDir
|
854
|
}
|
855
|
|
856
|
["asm", "asm-analysis", "asm-commons", "asm-tree", "asm-util"].each { asm ->
|
857
|
Task t = task "asm_${asm}"(
|
858
|
type: JavaExec,
|
859
|
dependsOn: ["asm_createRules"],
|
860
|
description: "Run jarjar on ${asm}-${asmVersion} classes"
|
861
|
) {
|
862
|
inputs.file "lib/asm-${asmVersion}/${asm}-${asmVersion}.jar"
|
863
|
outputs.file "${buildDir}/lib/asm/${asm}-${asmVersion}.jar"
|
864
|
classpath = configurations.preprocessor
|
865
|
main = "com.tonicsystems.jarjar.Main"
|
866
|
args "--rules", "${buildDir}/jarjar-asm.rules",
|
867
|
"lib/asm-${asmVersion}/${asm}-${asmVersion}.jar",
|
868
|
"${buildDir}/lib/asm/${asm}-${asmVersion}.jar"
|
869
|
doFirst {
|
870
|
mkdir "${buildDir}/lib/asm"
|
871
|
}
|
872
|
}
|
873
|
asm_jarjar.dependsOn t
|
874
|
|
875
|
t = task "asm_unzip${asm}"(
|
876
|
type: Copy,
|
877
|
dependsOn: ["asm_jarjar"],
|
878
|
description: "Extract the classes from the ${asm}-${asmVersion} jar"
|
879
|
) {
|
880
|
def zipFile = file("${buildDir}/lib/asm/${asm}-${asmVersion}.jar")
|
881
|
def outputDir = "${buildDir}/classes/eej"
|
882
|
from zipTree(zipFile)
|
883
|
into outputDir
|
884
|
}
|
885
|
asm_unzip.dependsOn t
|
886
|
}
|
887
|
|
888
|
// ============================================================
|
889
|
|
890
|
task hej_MetaInf(
|
891
|
description: "Create META-INF/services/javax.xml.transform.TransformerFactory for HE"
|
892
|
) {
|
893
|
outputs.file("${buildDir}/services/saxon-he/META-INF/services/javax.xml.transform.TransformerFactory")
|
894
|
doFirst {
|
895
|
mkdir "${buildDir}/services/saxon-he/META-INF/services"
|
896
|
}
|
897
|
doLast {
|
898
|
new File("${buildDir}/services/saxon-he/META-INF/services/javax.xml.transform.TransformerFactory")
|
899
|
.withWriter("utf-8") { writer ->
|
900
|
writer.writeLine("net.sf.saxon.TransformerFactoryImpl")
|
901
|
}
|
902
|
}
|
903
|
}
|
904
|
|
905
|
task pej_MetaInf(
|
906
|
description: "Create META-INF/services/javax.xml.transform.TransformerFactory for PE"
|
907
|
) {
|
908
|
outputs.file("${buildDir}/services/saxon-pe/META-INF/services/javax.xml.transform.TransformerFactory")
|
909
|
doFirst {
|
910
|
mkdir "${buildDir}/services/saxon-pe/META-INF/services"
|
911
|
}
|
912
|
doLast {
|
913
|
new File("${buildDir}/services/saxon-pe/META-INF/services/javax.xml.transform.TransformerFactory")
|
914
|
.withWriter("utf-8") { writer ->
|
915
|
writer.writeLine("com.saxonica.config.ProfessionalTransformerFactory")
|
916
|
}
|
917
|
}
|
918
|
}
|
919
|
|
920
|
task eej_schemaFactoryMetaInf(
|
921
|
description: "Create META-INF/services/javax.xml.validation.SchemaFactory for EE"
|
922
|
) {
|
923
|
outputs.file("${buildDir}/services/saxon-ee/META-INF/services/javax.xml.validation.SchemaFactory")
|
924
|
doFirst {
|
925
|
mkdir "${buildDir}/services/saxon-ee/META-INF/services"
|
926
|
}
|
927
|
doLast {
|
928
|
new File("${buildDir}/services/saxon-ee/META-INF/services/javax.xml.validation.SchemaFactory")
|
929
|
.withWriter("utf-8") { writer ->
|
930
|
writer.writeLine("com.saxonica.ee.jaxp.SchemaFactoryImpl")
|
931
|
}
|
932
|
}
|
933
|
}
|
934
|
|
935
|
task eej_MetaInf(
|
936
|
dependsOn: ["eej_schemaFactoryMetaInf"],
|
937
|
description: "Create META-INF/services/javax.xml.transform.TransformerFactory for EE"
|
938
|
) {
|
939
|
outputs.file("${buildDir}/services/saxon-ee/META-INF/services/javax.xml.transform.TransformerFactory")
|
940
|
doFirst {
|
941
|
mkdir "${buildDir}/services/saxon-ee/META-INF/services"
|
942
|
}
|
943
|
doLast {
|
944
|
new File("${buildDir}/services/saxon-ee/META-INF/services/javax.xml.transform.TransformerFactory")
|
945
|
.withWriter("utf-8") { writer ->
|
946
|
writer.writeLine("com.saxonica.config.EnterpriseTransformerFactory")
|
947
|
}
|
948
|
}
|
949
|
}
|
950
|
|
951
|
// ============================================================
|
952
|
|
953
|
task hejJar(
|
954
|
type: Jar,
|
955
|
dependsOn: ["hej_MetaInf", "hejCompile"],
|
956
|
description: "Build the HE jar file"
|
957
|
) {
|
958
|
archiveBaseName = "saxon-he-${saxonVersion}"
|
959
|
manifest {
|
960
|
attributes "Project-Name": "Saxon-HE"
|
961
|
attributes "Main-Class": "net.sf.saxon.Transform"
|
962
|
}
|
963
|
from ("${buildDir}/services/saxon-he") {
|
964
|
include "META-INF/**"
|
965
|
}
|
966
|
from ("${buildDir}/classes/hej") {
|
967
|
include "net/**/*.class"
|
968
|
exclude "net/sf/saxon/option/**"
|
969
|
}
|
970
|
from ("src/main/resources") {
|
971
|
include "net/sf/saxon/data/**"
|
972
|
}
|
973
|
}
|
974
|
|
975
|
// Because the XQJ files are not open source, don't attempt to build
|
976
|
// the jar unless the EE sources are available.
|
977
|
if (file("${projectDir}/src/main/java/com/saxonica/xqj").exists()) {
|
978
|
task hejJarXqj(
|
979
|
type: Jar,
|
980
|
dependsOn: ["eejCompile"],
|
981
|
description: "Build the XQJ jar file for HE"
|
982
|
) {
|
983
|
archiveBaseName = "saxon-he-xqj-${saxonVersion}"
|
984
|
from ("${buildDir}/classes/eej") {
|
985
|
include "com/saxonica/xqj/**/*.class"
|
986
|
include "javax/xml/xquery/**/*.class"
|
987
|
}
|
988
|
}
|
989
|
} else {
|
990
|
task hejJarXqj(
|
991
|
description: "Ignore the XQJ file; the sources are unavailable"
|
992
|
) {
|
993
|
doLast {
|
994
|
println("Ignoring XQJ jar file task; the sources are unavailable")
|
995
|
}
|
996
|
}
|
997
|
}
|
998
|
|
999
|
task pejJar(
|
1000
|
type: Jar,
|
1001
|
dependsOn: ["pej_MetaInf", "pejCompile"],
|
1002
|
description: "Build the PE jar file"
|
1003
|
) {
|
1004
|
archiveBaseName = "saxon-pe-${saxonVersion}"
|
1005
|
manifest {
|
1006
|
attributes "Project-Name": "Saxon-PE"
|
1007
|
attributes "Main-Class": "net.sf.saxon.Transform"
|
1008
|
}
|
1009
|
from ("${buildDir}/services/saxon-pe") {
|
1010
|
include "META-INF/**"
|
1011
|
}
|
1012
|
from ("${buildDir}/classes/pej") {
|
1013
|
include "net/**/*.class"
|
1014
|
include "com/saxonica/**/*.class"
|
1015
|
include "javax/xml/xquery/*.class"
|
1016
|
exclude "**/sql/**/*.class"
|
1017
|
exclude "com/saxonica/CompileStylesheet.class"
|
1018
|
exclude "com/saxonica/CompileStylesheet\$TracingObjectOutputStream.class"
|
1019
|
exclude "com/saxonica/Validate.class"
|
1020
|
exclude "com/saxonica/config/EnterpriseConfiguration.class"
|
1021
|
exclude "com/saxonica/config/EnterpriseConfiguration\$SurrogateSchema.class"
|
1022
|
exclude "com/saxonica/config/EnterpriseTransformerFactory.class"
|
1023
|
exclude "com/saxonica/config/EnterpriseXPathFactory.class"
|
1024
|
exclude "com/saxonica/config/StreamingTransformerFactory.class"
|
1025
|
exclude "com/saxonica/ee/**/*.class"
|
1026
|
exclude "com/saxonica/expr/CastToList.class"
|
1027
|
exclude "com/saxonica/expr/CastToUnion.class"
|
1028
|
exclude "com/saxonica/expr/CastableToList.class"
|
1029
|
exclude "com/saxonica/expr/CastableToUnion.class"
|
1030
|
exclude "com/saxonica/functions/sql/**"
|
1031
|
exclude "net/sf/saxon/option/sql/**"
|
1032
|
}
|
1033
|
from ("src/main/resources") {
|
1034
|
include "net/sf/saxon/data/**"
|
1035
|
}
|
1036
|
}
|
1037
|
|
1038
|
task pejJarSql(
|
1039
|
type: Jar,
|
1040
|
dependsOn: ["pejCompile"],
|
1041
|
description: "Build the SQL jar file for PE"
|
1042
|
) {
|
1043
|
archiveBaseName = "saxon-pe-sql-${saxonVersion}"
|
1044
|
from ("${buildDir}/classes/pej") {
|
1045
|
include "net/sf/saxon/option/sql/*.class"
|
1046
|
include "com/saxonica/functions/sql/*.class"
|
1047
|
}
|
1048
|
}
|
1049
|
|
1050
|
task eejJar(
|
1051
|
type: Jar,
|
1052
|
dependsOn: ["eej_MetaInf", "eejCompile", "asm_unzip"],
|
1053
|
description: "Build the EE jar file"
|
1054
|
) {
|
1055
|
archiveBaseName = "saxon-ee-${saxonVersion}"
|
1056
|
manifest {
|
1057
|
attributes "Project-Name": "Saxon-EE"
|
1058
|
attributes "Main-Class": "net.sf.saxon.Transform"
|
1059
|
}
|
1060
|
from ("${buildDir}/services/saxon-ee") {
|
1061
|
include "META-INF/**"
|
1062
|
}
|
1063
|
from ("${buildDir}/classes/eej") {
|
1064
|
include "net/**/*.class"
|
1065
|
include "com/saxonica/**/*.class"
|
1066
|
include "javax/xml/xquery/*.class"
|
1067
|
exclude "org/objectweb/**/*.class"
|
1068
|
exclude "**/sql/**/*.class"
|
1069
|
exclude "com/saxonica/StatsTransform*.class"
|
1070
|
exclude "com/saxonica/functions/sql/**"
|
1071
|
exclude "net/sf/saxon/option/sql/**"
|
1072
|
}
|
1073
|
from ("src/main/resources") {
|
1074
|
include "net/sf/saxon/data/**"
|
1075
|
}
|
1076
|
}
|
1077
|
|
1078
|
task eejJarSql(
|
1079
|
type: Jar,
|
1080
|
dependsOn: ["eejCompile"],
|
1081
|
description: "Build the SQL jar file for EE"
|
1082
|
) {
|
1083
|
archiveBaseName = "saxon-ee-sql-${saxonVersion}"
|
1084
|
from ("${buildDir}/classes/eej") {
|
1085
|
include "net/sf/saxon/option/sql/*.class"
|
1086
|
include "com/saxonica/functions/sql/*.class"
|
1087
|
}
|
1088
|
}
|
1089
|
|
1090
|
// ============================================================
|
1091
|
|
1092
|
task signJars(
|
1093
|
dependsOn: ["hejSignJars", "pejSignJars", "eejSignJars"],
|
1094
|
description: "Sign all the jar files."
|
1095
|
) {
|
1096
|
// Just a container to hang dependencies on
|
1097
|
}
|
1098
|
|
1099
|
task hejSignJars(
|
1100
|
description: "Sign the HEJ jar files"
|
1101
|
) {
|
1102
|
// Just a container to hang dependencies on
|
1103
|
}
|
1104
|
|
1105
|
task pejSignJars(
|
1106
|
description: "Sign the PEJ jar files"
|
1107
|
) {
|
1108
|
// Just a container to hang dependencies on
|
1109
|
}
|
1110
|
|
1111
|
task eejSignJars(
|
1112
|
description: "Sign the EEJ jar files"
|
1113
|
) {
|
1114
|
// Just a container to hang dependencies on
|
1115
|
}
|
1116
|
|
1117
|
// Create tasks for signing jars...
|
1118
|
["he", "pe", "ee"].each { rel ->
|
1119
|
if (canSignJars) {
|
1120
|
Task t = task "${rel}_jJarSignJar"(
|
1121
|
type: Exec,
|
1122
|
dependsOn: ["${rel}jJar"],
|
1123
|
description: "Sign the ${rel.toUpperCase()}J jar file"
|
1124
|
) {
|
1125
|
inputs.file "${buildDir}/libs/saxon-${rel}-${saxonVersion}.jar"
|
1126
|
def args = signjarArgs +
|
1127
|
["${buildDir}/libs/saxon-${rel}-${saxonVersion}.jar",
|
1128
|
signkeyNewAlias,
|
1129
|
"-storepass", signkeyPassword]
|
1130
|
commandLine args
|
1131
|
}
|
1132
|
tasks.findByName("${rel}jSignJars").dependsOn t
|
1133
|
|
1134
|
t = task "${rel}j_JarSignTests"(
|
1135
|
type: Exec,
|
1136
|
dependsOn: ["${rel}jJarTests"],
|
1137
|
description: "Sign the ${rel.toUpperCase()}J test jar file"
|
1138
|
) {
|
1139
|
inputs.file "${buildDir}/libs/saxon-${rel}-test-${saxonVersion}.jar"
|
1140
|
def args = signjarArgs +
|
1141
|
["${buildDir}/libs/saxon-${rel}-test-${saxonVersion}.jar",
|
1142
|
signkeyNewAlias,
|
1143
|
"-storepass", signkeyPassword]
|
1144
|
commandLine args
|
1145
|
}
|
1146
|
tasks.findByName("${rel}jSignJars").dependsOn t
|
1147
|
|
1148
|
t = task "${rel}j_JarSignXqj"(
|
1149
|
type: Exec,
|
1150
|
dependsOn: ["${rel}jJarXqj"],
|
1151
|
description: "Sign the ${rel.toUpperCase()}J XQJ jar file"
|
1152
|
) {
|
1153
|
inputs.file "${buildDir}/libs/saxon-${rel}-xqj-${saxonVersion}.jar"
|
1154
|
def args = signjarArgs +
|
1155
|
["${buildDir}/libs/saxon-${rel}-xqj-${saxonVersion}.jar",
|
1156
|
signkeyNewAlias,
|
1157
|
"-storepass", signkeyPassword]
|
1158
|
commandLine args
|
1159
|
}
|
1160
|
tasks.findByName("${rel}jSignJars").dependsOn t
|
1161
|
|
1162
|
if (rel != 'he') {
|
1163
|
t = task "${rel}j_JarSignSql"(
|
1164
|
type: Exec,
|
1165
|
dependsOn: ["${rel}jJarSql"],
|
1166
|
description: "Sign the ${rel.toUpperCase()} jar file"
|
1167
|
) {
|
1168
|
inputs.file "${buildDir}/libs/saxon-${rel}-sql-${saxonVersion}.jar"
|
1169
|
def args = signjarArgs +
|
1170
|
["${buildDir}/libs/saxon-${rel}-sql-${saxonVersion}.jar",
|
1171
|
signkeyNewAlias,
|
1172
|
"-storepass", signkeyPassword]
|
1173
|
commandLine args
|
1174
|
}
|
1175
|
tasks.findByName("${rel}jSignJars").dependsOn t
|
1176
|
}
|
1177
|
} else {
|
1178
|
Task t = task "${rel}j_JarSignJar"(
|
1179
|
description: "Cannot sign the ${rel.toUpperCase()}J jar file"
|
1180
|
) {
|
1181
|
doLast {
|
1182
|
throw new GradleException("Jar signing is not configured.")
|
1183
|
}
|
1184
|
}
|
1185
|
tasks.findByName("${rel}jSignJars").dependsOn t
|
1186
|
|
1187
|
t = task "${rel}j_JarSignTests"(
|
1188
|
description: "Cannot sign the ${rel.toUpperCase()}J test jar file"
|
1189
|
) {
|
1190
|
doLast {
|
1191
|
throw new GradleException("Jar signing is not configured.")
|
1192
|
}
|
1193
|
}
|
1194
|
tasks.findByName("${rel}jSignJars").dependsOn t
|
1195
|
|
1196
|
t = task "${rel}j_JarSignXqj"(
|
1197
|
description: "Cannot sign the ${rel.toUpperCase()}J XQJ jar file"
|
1198
|
) {
|
1199
|
doLast {
|
1200
|
throw new GradleException("Jar signing is not configured.")
|
1201
|
}
|
1202
|
}
|
1203
|
tasks.findByName("${rel}jSignJars").dependsOn t
|
1204
|
|
1205
|
if (rel != 'he') {
|
1206
|
t = task "${rel}j_JarSignSql"(
|
1207
|
description: "Cannot sign the ${rel.toUpperCase()} jar file"
|
1208
|
) {
|
1209
|
doLast {
|
1210
|
throw new GradleException("Jar signing is not configured.")
|
1211
|
}
|
1212
|
}
|
1213
|
tasks.findByName("${rel}jSignJars").dependsOn t
|
1214
|
}
|
1215
|
}
|
1216
|
}
|
1217
|
|
1218
|
// ============================================================
|
1219
|
|
1220
|
task eej_compile_junit_tests(
|
1221
|
type: JavaCompile,
|
1222
|
dependsOn: ["eejCompile"],
|
1223
|
description: "Compile JUnit tests for Saxon-EE Java"
|
1224
|
) {
|
1225
|
classpath = configurations.productTests + files("${buildDir}/classes/eej")
|
1226
|
source fileTree(dir: "${projectDir}/src/test/java",
|
1227
|
include: ["jaxptest/*.java",
|
1228
|
"millicom/*.java",
|
1229
|
"commands/*.java",
|
1230
|
// "failing/*.java", // Known to fail?
|
1231
|
"internaltests/*.java",
|
1232
|
"jstests/*.java",
|
1233
|
"nativetests/*.java",
|
1234
|
"performance/*.java",
|
1235
|
"pulltests/*.java",
|
1236
|
"regextests/*.java",
|
1237
|
"s9apitest/*.java",
|
1238
|
"sorttests/*.java",
|
1239
|
// "tools/*.java", // Not tests
|
1240
|
"xqjtests/*.java"])
|
1241
|
destinationDirectory = new File("${buildDir}/test_classes/eej")
|
1242
|
}
|
1243
|
|
1244
|
task eejTests(
|
1245
|
type: JavaExec,
|
1246
|
dependsOn: ["eej_compile_junit_tests"]
|
1247
|
) {
|
1248
|
classpath = configurations.productTests + files("${buildDir}/classes/eej") + files("${buildDir}/test_classes/eej")
|
1249
|
main = "org.junit.platform.console.ConsoleLauncher"
|
1250
|
args "--scan-class-path"
|
1251
|
}
|
1252
|
|
1253
|
// ============================================================
|
1254
|
|
1255
|
task hejRelease(
|
1256
|
type: Copy,
|
1257
|
dependsOn: ["hejJar", "hejJarXqj", "hejJarTests", "hej_notices"],
|
1258
|
description: "Build the HE release for Java"
|
1259
|
) {
|
1260
|
from "${buildDir}/libs"
|
1261
|
into "${buildDir}/releases/hej"
|
1262
|
include "saxon-he-${saxonVersion}.jar"
|
1263
|
include "saxon-he-xqj-${saxonVersion}.jar"
|
1264
|
include "saxon-he-test-${saxonVersion}.jar"
|
1265
|
rename { filename ->
|
1266
|
if (filename.startsWith("saxon-he-test")) {
|
1267
|
filename = "saxon-he-test-${saxonVersion}.jar"
|
1268
|
}
|
1269
|
}
|
1270
|
}
|
1271
|
|
1272
|
task pejRelease(
|
1273
|
type: Copy,
|
1274
|
dependsOn: ["pejJar", "pejJarSql", "pejJarTests", "pej_libs", "pej_notices"],
|
1275
|
description: "Build the PE release for Java"
|
1276
|
) {
|
1277
|
from "${buildDir}/libs"
|
1278
|
into "${buildDir}/releases/pej"
|
1279
|
include "saxon-pe-${saxonVersion}.jar"
|
1280
|
include "saxon-pe-sql-${saxonVersion}.jar"
|
1281
|
include "saxon-pe-test-${saxonVersion}.jar"
|
1282
|
rename { filename ->
|
1283
|
if (filename.startsWith("saxon-pe-sql")) {
|
1284
|
filename.replace("saxon-pe-sql", "saxon-sql")
|
1285
|
} else {
|
1286
|
filename
|
1287
|
}
|
1288
|
}
|
1289
|
}
|
1290
|
|
1291
|
task eejRelease(
|
1292
|
type: Copy,
|
1293
|
dependsOn: ["eejJar", "eejJarSql", "eejJarTests", "eej_libs", "eej_notices"],
|
1294
|
description: "Build the EE release for Java"
|
1295
|
) {
|
1296
|
from "${buildDir}/libs"
|
1297
|
into "${buildDir}/releases/eej"
|
1298
|
include "saxon-ee-${saxonVersion}.jar"
|
1299
|
include "saxon-ee-sql-${saxonVersion}.jar"
|
1300
|
include "saxon-ee-test-${saxonVersion}.jar"
|
1301
|
rename { filename ->
|
1302
|
if (filename.startsWith("saxon-ee-sql")) {
|
1303
|
filename.replace("saxon-ee-sql", "saxon-sql")
|
1304
|
} else {
|
1305
|
filename
|
1306
|
}
|
1307
|
}
|
1308
|
}
|
1309
|
|
1310
|
if (file("${projectDir}/src/main/java/com").exists()) {
|
1311
|
task javaReleases(
|
1312
|
dependsOn: ["hejRelease", "pejRelease", "eejRelease"],
|
1313
|
description: "Build all of the Java releases"
|
1314
|
) {
|
1315
|
// Just a container to hang dependencies on
|
1316
|
}
|
1317
|
} else {
|
1318
|
// Ignore the EEJ and PEJ releases if the sources aren't available
|
1319
|
task javaReleases(
|
1320
|
dependsOn: ["hejRelease"],
|
1321
|
description: "Build all of the Java releases"
|
1322
|
) {
|
1323
|
// Just a container to hang dependencies on
|
1324
|
}
|
1325
|
}
|
1326
|
|
1327
|
// ============================================================
|
1328
|
|
1329
|
// Testing task for various Gradle debugging efforts
|
1330
|
task helloWorld() {
|
1331
|
doLast {
|
1332
|
println("Hello, world.")
|
1333
|
/*
|
1334
|
configurations.documentation.resolve().each { path ->
|
1335
|
println(path)
|
1336
|
}
|
1337
|
*/
|
1338
|
}
|
1339
|
}
|