Project

Profile

Help

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

he / build-n.gradle @ b258012b

1
// To support the documentation builds, we need to be able to run
2
// the CSharp compiler under Mono. This is not used for releases.
3
def mono = null
4
["${System.getenv("SAXON_MONO_FRAMEWORK")}/bin/mono",
5
 "${monoFramework}/bin/mono",
6
 "z:/some/other/mono/path"].each { path ->
7
  if (mono == null && new File(path).exists()) {
8
    mono = path
9
  }
10
}
11

    
12
// Find C# compiler: the first path that exists in this list
13
// will be used as the C# compiler.
14
//
15
def csharpCompiler = null
16
["C:/Windows/Microsoft.net/Framework/${dotNetFrameworkVersion}/csc.exe",
17
 "z:/some/other/compiler/path"].each { csc ->
18
  // This only makes sense on Windows, so always using file:/// is ok
19
  if (csharpCompiler == null && pathExists(csc)) {
20
    csharpCompiler = [ csc ]
21
  }
22
}
23

    
24
// Only the mono version of the C# compiler produces the correct
25
// documentation XML. ¯\_(ツ)_/¯
26
def monoCSharpCompiler = csharpCompiler
27
def ikvmExecutable = ["${ikvmDir}/ikvm-${ikvmVersion}/bin/ikvmc.exe"]
28
if (mono != null) {
29
  ikvmExecutable = [mono, "${ikvmDir}/ikvm-${ikvmVersion}/bin/ikvmc.exe"]
30
  csharpCompiler = [mono, "${monoFramework}/lib/mono/4.5/csc.exe"]
31
  monoCSharpCompiler = [mono, "${monoFramework}/lib/mono/4.5/mcs.exe"]
32
}
33

    
34
def additionalIkvmOptions = []
35
if (hasProperty("ikvmDebug")) {
36
  additionalIkvmOptions += ["-debug"]
37
}
38

    
39
task hen_featureKeys(
40
  type: JavaExec,
41
  description: "Construct the feature keys for HE"
42
) {
43
  inputs.files fileTree(dir: "${projectDir}/tools/featureKeys")
44
  outputs.file "${projectDir}/src/main/csharp/api/Saxon.Api/Feature.cs"
45
  outputs.file "${projectDir}/src/main/csharp/api/Saxon.Api/FeatureKeys.cs"
46
  classpath = configurations.preprocessor
47
  main = "net.sf.saxon.Transform"
48
  args "${projectDir}/tools/featureKeys/FeatureKeys.xml",
49
    "-xsl:${projectDir}/tools/featureKeys/FeatureKeysToCSharp.xsl",
50
    "-o:${projectDir}/src/main/csharp/api/Saxon.Api/establish-an-output-base-uri"
51
}
52

    
53
task hen_setupPreprocess(
54
  type: Copy,
55
  dependsOn: ["hen_featureKeys"],
56
  description: "Copy HE sources for preprocessing HE"
57
) {
58
  from "${projectDir}/src/main/java"
59
  into "${buildDir}/filtered/hen"
60
  include "net/sf/saxon/**/*.java"
61
  include "net/sf/saxon/data/**"
62
  exclude "net/sf/saxon/option/cpp/**"
63
  exclude "net/sf/saxon/jetonnet/**"
64
  exclude "net/sf/saxon/Gizmo.java"
65
  exclude "**/TransformerFactoryImpl.java"
66
  exclude "net/sf/saxon/BasicTransformerFactory.java"
67
  exclude "**/ant/**"
68
  exclude "**/dom/**"
69
  exclude "**/dom4j/**"
70
  exclude "**/java/**"
71
  exclude "**/testdriver/**"
72
  exclude "net/sf/saxon/testdriver/**/*.java"
73
  exclude "**/jaxp/**"
74
  exclude "**/jdom/**"
75
  exclude "**/jdom2/**"
76
  exclude "**/axiom/**"
77
  exclude "**/s9api/DOMDestination.java"
78
  exclude "**/sql/**"
79
  exclude "**/xom/**"
80
  exclude "**/xpath/**"
81
  exclude "**/xqj/**"
82
  exclude "**/stax/**"
83
}
84

    
85
task pen_setupPreprocess(
86
  type: Copy,
87
  dependsOn: ["hen_featureKeys"],
88
  description: "Copy PE sources for preprocessing PE"
89
) {
90
  from "${projectDir}/src/main/java"
91
  into "${buildDir}/filtered/pen"
92
  include "net/sf/saxon/**/*.java"
93
  include "net/sf/saxon/data/**"
94
  exclude "net/sf/saxon/option/cpp/**"
95
  exclude "net/sf/saxon/jetonnet/**"
96
  exclude "net/sf/saxon/Gizmo.java"
97
  exclude "**/TransformerFactoryImpl.java"
98
  exclude "net/sf/saxon/BasicTransformerFactory.java"
99
  exclude "**/testdriver/**"
100
  exclude "**/ant/**"
101
  exclude "**/dom/**"
102
  exclude "**/dom4j/**"
103
  exclude "**/java/**"
104
  exclude "**/jaxp/**"
105
  exclude "**/jdom/**"
106
  exclude "**/jdom2/**"
107
  exclude "**/axiom/**"
108
  exclude "**/s9api/DOMDestination.java"
109
  exclude "**/sql/**"
110
  exclude "**/xom/**"
111
  exclude "**/xpath/**"
112
  exclude "**/xqj/**"
113
  exclude "**/stax/**"
114
  include "com/saxonica/**/*.java"
115
  exclude "com/saxonica/ee/**/*.java"
116
  exclude "com/saxonica/functions/extfn/cpp/*.java"
117
  exclude "com/saxonica/testdriver/**/*.java"
118
  exclude "net/sf/saxon/testdriver/**/*.java"
119
  exclude "com/saxonica/jaxp/*.java"
120
  exclude "com/saxonica/js/**"
121
  exclude "com/saxonica/config/ProfessionalXPathFactory.java" 
122
  exclude "com/saxonica/config/EnterpriseConfiguration.java" 
123
  exclude "com/saxonica/config/JavaPlatformPE.java" 
124
  exclude "com/saxonica/config/JavaPlatformEE.java" 
125
  exclude "com/saxonica/config/JavaPlatformC.java"
126
  exclude "com/saxonica/config/ee/**" 
127
  exclude "com/saxonica/stream/**" 
128
  exclude "com/saxonica/schema/**" 
129
  exclude "com/saxonica/bytecode/**" 
130
  exclude "com/saxonica/expr/ee/**" 
131
  exclude "com/saxonica/update/**/*.java"
132
  exclude "com/saxonica/validate/**/*.java"
133
  exclude "com/saxonica/expr/CastToUnion.java"
134
  exclude "com/saxonica/expr/CastableToUnion.java"
135
  exclude "com/saxonica/expr/CastableToUnion.java"
136
  exclude "com/saxonica/Validate.java"
137
  exclude "com/saxonica/config/ProfessionalTransformerFactory.java"
138
  exclude "com/saxonica/config/ProfessionalXPathFactory.java"
139
  exclude "com/saxonica/config/EnterpriseTransformerFactory.java"
140
  exclude "com/saxonica/config/StreamingTransformerFactory.java"
141
  exclude "com/saxonica/config/EnterpriseXPathFactory.java"
142
  exclude "com/saxonica/config/DynamicLoaderEE.java"
143
  exclude "com/saxonica/config/StandardSchemaResolver.java"
144
  exclude "com/saxonica/functions/extfn/NativeCall.java"
145
  exclude "**/xqj/**"
146
}
147

    
148
task een_setupPreprocess(
149
  type: Copy,
150
  dependsOn: ["hen_featureKeys"],
151
  description: "Copy EE sources for preprocessing EE"
152
) {
153
  from "${projectDir}/src/main/java"
154
  into "${buildDir}/filtered/een"
155
  include "net/sf/saxon/**/*.java"
156
  include "net/sf/saxon/data/**"
157
  exclude "net/sf/saxon/TransformerFactoryImpl.java"
158
  exclude "net/sf/saxon/BasicTransformerFactory.java"
159
  exclude "net/sf/saxon/option/cpp/**"
160
  exclude "net/sf/saxon/jetonnet/**"
161
  exclude "net/sf/saxon/Gizmo.java"
162
  exclude "**/ant/**"
163
  exclude "**/dom/**"
164
  exclude "**/dom4j/**"
165
  exclude "**/java/**"
166
  exclude "**/jaxp/**"
167
  exclude "**/jdom/**"
168
  exclude "**/jdom2/**"
169
  exclude "**/axiom/**"
170
  exclude "**/s9api/DOMDestination.java"
171
  exclude "**/sql/**"
172
  exclude "**/xom/**"
173
  exclude "**/xpath/**"
174
  exclude "**/xqj/**"
175
  exclude "**/stax/**"
176
  include "com/saxonica/**/*.java"
177
  exclude "com/saxonica/functions/extfn/cpp/*.java"
178
  exclude "com/saxonica/testdriver/**/*.java"
179
  exclude "net/sf/saxon/testdriver/**/*.java"
180
  exclude "com/saxonica/ee/jaxp/*.java"
181
  exclude "com/saxonica/js/**"
182
  exclude "com/saxonica/ee/domino/**/*.java"
183
  exclude "com/saxonica/config/JavaPlatformPE.java"
184
  exclude "com/saxonica/config/JavaPlatformEE.java"
185
  exclude "com/saxonica/config/JavaPlatformC.java"
186
  exclude "com/saxonica/config/ProfessionalXPathFactory.java"
187
  exclude "com/saxonica/config/EnterpriseXPathFactory.java"
188
  exclude "com/saxonica/config/ProfessionalTransformerFactory.java"
189
  exclude "com/saxonica/config/EnterpriseTransformerFactory.java"
190
  exclude "com/saxonica/config/StreamingTransformerFactory.java"
191
  exclude "com/saxonica/config/NativePlatformPE.java"
192
  exclude "**/xqj/**"
193
}
194

    
195
task hen_preprocess(
196
  type: JavaExec,
197
  dependsOn: ["hen_setupPreprocess", "record_branch"],
198
  description: "Preprocess HE sources"
199
) {
200
  inputs.files fileTree(dir: "${buildDir}/filtered/hen")
201
  outputs.files fileTree(dir: "${buildDir}/preprocess/hen")
202
  classpath = configurations.preprocessor
203
  main = "com.igormaznitsa.jcp.JcpPreprocessor"
204
  args "/c",
205
    "/i:${buildDir}/filtered/hen", "/o:${buildDir}/preprocess/hen",
206
    "/p:EE=false", "/p:PE=false", "/p:DOTNET=true",
207
    "/p:SAXONC=false", "/p:BYTECODE=false"
208
  doFirst {
209
    mkdir "${buildDir}/preprocess/hen"
210
  }
211
}
212

    
213
task pen_preprocess(
214
  type: JavaExec,
215
  dependsOn: ["pen_setupPreprocess", "record_branch"],
216
  description: "Preprocess PE sources"
217
) {
218
  inputs.files fileTree(dir: "${buildDir}/filtered/pen")
219
  outputs.files fileTree(dir: "${buildDir}/preprocess/pen")
220
  classpath = configurations.preprocessor
221
  main = "com.igormaznitsa.jcp.JcpPreprocessor"
222
  args "/c",
223
    "/i:${buildDir}/filtered/pen", "/o:${buildDir}/preprocess/pen",
224
    "/p:EE=false", "/p:PE=true", "/p:DOTNET=true",
225
    "/p:SAXONC=false", "/p:BYTECODE=false", "/p:HOF=true"
226
  doFirst {
227
    mkdir "${buildDir}/preprocess/pen"
228
  }
229
}
230

    
231
task een_preprocess(
232
  type: JavaExec,
233
  dependsOn: ["een_setupPreprocess", "record_branch"],
234
  description: "Preprocess EE sources"
235
) {
236
  inputs.files fileTree(dir: "${buildDir}/filtered/een")
237
  outputs.files fileTree(dir: "${buildDir}/preprocess/een")
238
  classpath = configurations.preprocessor
239
  main = "com.igormaznitsa.jcp.JcpPreprocessor"
240
  args "/c",
241
    "/i:${buildDir}/filtered/een", "/o:${buildDir}/preprocess/een",
242
    "/p:EE=true", "/p:PE=false", "/p:DOTNET=true",
243
    "/p:SAXONC=false", "/p:BYTECODE=true", "/p:HOF=true",
244
    "/p:STREAM=true", "/p:SCHEMA=true"
245
  doFirst {
246
    mkdir "${buildDir}/preprocess/een"
247
  }
248
}
249

    
250
task hen_sources(
251
  type: Copy,
252
  dependsOn: ["hen_preprocess"],
253
  description: "Collect the preprocessed HE sources for compilation"
254
) {
255
  from "${buildDir}/preprocess/hen"
256
  into "${buildDir}/src/hen"
257
  filter { line ->
258
    if (line.contains("import com.saxonica")
259
        || line.contains("import net.sf.saxon.stax")
260
        || line.contains("import net.sf.saxon.jaxp")
261
        || line.contains("net.sf.saxon.xpath.JAXPXPathStaticContext")) {
262
      null
263
    } else {
264
      line
265
    }
266
  }
267
}
268

    
269
task pen_sources(
270
  type: Copy,
271
  dependsOn: ["pen_preprocess"],
272
  description: "Collect the preprocessed PE sources for compilation"
273
) {
274
  from "${buildDir}/preprocess/pen"
275
  into "${buildDir}/src/pen"
276
  filter { line ->
277
    if (line.contains("import com.saxonica.ee")
278
        || line.contains("import com.saxonica.config.ee")
279
        || line.contains("net.sf.saxon.xpath.JAXPXPathStaticContext")
280
        || line.contains("import net.sf.saxon.stax")
281
        || line.contains("import net.sf.saxon.jaxp")) {
282
      null
283
    } else {
284
      line
285
    }
286
  }
287
}
288

    
289
task een_sources(
290
  type: Copy,
291
  dependsOn: ["een_preprocess"],
292
  description: "Collect the preprocessed EE sources for compilation"
293
) {
294
  from "${buildDir}/preprocess/een"
295
  into "${buildDir}/src/een"
296
  filter { line ->
297
    if (line.contains("net.sf.saxon.xpath.JAXPXPathStaticContext")
298
        || line.contains("import com.saxonica.ee.jaxp.SchemaFactoryImpl")
299
        || line.contains("import net.sf.saxon.stax")
300
        || line.contains("import net.sf.saxon.jaxp")) {
301
      null
302
    } else {
303
      line
304
    }
305
  }
306
}
307

    
308
// ============================================================
309

    
310
Task chsa = task hen_copySaxonApi(
311
  type: Copy,
312
  description: "Copy the Saxon.API C# files"
313
) {
314
  from "${projectDir}/src/main/csharp/api/Saxon.Api"
315
  into "${buildDir}/n/csharp/api/Saxon.Api"
316
  include "*.cs"
317
}
318

    
319
task hen_ApiAssemblyInfo(
320
  description: "Create the AssemblyInfo.cs file for the Saxon.Api"
321
) {
322
  outputs.file("${buildDir}/n/csharp/api/Saxon.Api/Properties/AssemblyInfo.cs")
323
  doLast {
324
    new File("${buildDir}/n/csharp/api/Saxon.Api/Properties/AssemblyInfo.cs")
325
      .withWriter("utf-8") { writer ->
326
        writer.writeLine("          using System.Reflection;")
327
        writer.writeLine("          using System.Runtime.CompilerServices;")
328
        writer.writeLine("          using System.Runtime.InteropServices;")
329
        writer.writeLine("          [assembly: AssemblyTitle(\"Saxon.Api\")]")
330
        writer.writeLine("          [assembly: AssemblyDescription(\"\")]")
331
        writer.writeLine("          [assembly: AssemblyConfiguration(\"\")]")
332
        writer.writeLine("          [assembly: AssemblyCompany(\"Saxonica\")]")
333
        writer.writeLine("          [assembly: AssemblyProduct(\"Saxon.Api\")]")
334
        writer.writeLine("          [assembly: AssemblyCopyright(\"Copyright © Saxonica 2020\")]")
335
        writer.writeLine("          [assembly: AssemblyTrademark(\"\")]")
336
        writer.writeLine("          [assembly: AssemblyCulture(\"\")]")
337
        writer.writeLine("          [assembly: ComVisible(false)]")
338
        writer.writeLine("          [assembly: Guid(\"8cf9aad8-da5f-47f0-9251-1fbcbdcfe477\")]")
339
        writer.writeLine("          [assembly: AssemblyVersion(\"${saxonVersion}\")]")
340
        writer.writeLine("          [assembly: AssemblyFileVersion(\"${saxonVersion}\")]")
341
      }
342
  }
343
  doFirst {
344
    mkdir "${buildDir}/n/csharp/api/Saxon.Api/Properties"
345
  }
346
}
347

    
348
task hen_copySaxonCmd(
349
  type: Copy,
350
  description: "Copy the cmd C# files"
351
) {
352
  from "${projectDir}/src/main/csharp/cmd"
353
  into "${buildDir}/n/csharp/cmd"
354
  include "**/Transform.cs"
355
  include "**/Query.cs"
356
  include "**/Validate.cs"
357
}
358

    
359
task hen_copySamples(
360
  type: Copy,
361
  description: "Copy the HE sample C# files"
362
) {
363
  from "${projectDir}/src/samples/cs"
364
  into "${buildDir}/n/csharp/samples"
365
  include "ExamplesEE.cs"
366
  include "ExamplesHE.cs"
367
  include "ExamplesPE.cs"
368
  include "SampleExtensions.cs"
369
  include "XPathExample.cs"
370
}
371

    
372
task hen_copyDevelopmentSources(
373
  dependsOn: ["hen_copySaxonApi", "hen_ApiAssemblyInfo",
374
              "hen_copySaxonCmd", "hen_copySamples"],
375
  description: "Setup the C# build environment"
376
) {
377
    // Just a task to hang dependencies on
378
}
379

    
380
task henCompile(
381
  type: JavaCompile,
382
  dependsOn: ["hen_sources", "hen_copyDevelopmentSources"],
383
  description: "Compile HE for .NET"
384
) {
385
  classpath = configurations.compileClasspath + configurations.compileDotNet
386
  source = "${buildDir}/src/hen"
387
  destinationDirectory = new File("${buildDir}/classes/hen")
388
}
389

    
390
task penCompile(
391
  type: JavaCompile,
392
  dependsOn: ["pen_sources", "hen_copyDevelopmentSources"],
393
  description: "Compile PE for .NET"
394
) {
395
  classpath = configurations.compileClasspath + configurations.compileDotNet
396
  source = "${buildDir}/src/pen"
397
  destinationDirectory = new File("${buildDir}/classes/pen")
398
}
399

    
400
task eenCompile(
401
  type: JavaCompile,
402
  dependsOn: ["een_sources", "hen_copyDevelopmentSources"],
403
  description: "Compile EE for .NET"
404
) {
405
  classpath = configurations.compileClasspath + configurations.asmDotNet
406
  source = "${buildDir}/src/een"
407
  destinationDirectory = new File("${buildDir}/classes/een")
408
}
409

    
410
task hen_jar(
411
  type: Jar,
412
  dependsOn: ["henCompile"],
413
  description: "Build the HE jar file for Saxon .NET"
414
) {
415
  archiveBaseName = "saxon10he"
416
  destinationDirectory = file("${buildDir}/n/jar")
417
  from ("build/classes/hen") {
418
    include "net/**/*.class"
419
    exclude "net/sf/saxon/option/**/*.class"
420
  }
421
  from ("build/src/hen") {
422
    include "**"
423
  }
424
  doFirst {
425
    mkdir "build/n/jar"
426
  }
427
}
428

    
429
task pen_jar(
430
  type: Jar,
431
  dependsOn: ["penCompile"],
432
  description: "Build the PE jar file for Saxon .NET"
433
) {
434
  archiveBaseName = "saxon10pe"
435
  destinationDirectory = file("${buildDir}/n/jar")
436
  from ("build/classes/pen") {
437
    include "net/**/*.class"
438
    exclude "net/sf/saxon/ant/*.class"
439
    exclude "**/sql/**/*.class"
440
    include "com/saxonica/**/*.class"
441
    exclude "com/saxonica/bytecode/**/*.class"
442
    exclude "com/saxonica/jaxp/**/**/*.class"
443
    exclude "com/saxonica/schema/**/*.class"
444
    exclude "com/saxonica/stream/**/*.class"
445
    exclude "com/saxonica/testdriver/**/*.class"
446
    exclude "net/sf/saxon/testdriver/**/*.class"
447
    exclude "com/saxonica/update/**/*.class"
448
    exclude "com/saxonica/validate/**/*.class"
449
    exclude "com/saxonica/expr/CastToUnion.class"
450
    exclude "com/saxonica/expr/CastableToUnion.class"
451
    exclude "com/saxonica/expr/CastableToList.class"
452
    exclude "com/saxonica/Validate.class"
453
    exclude "com/saxonica/config/EnterpriseConfiguration.class"
454
    exclude "com/saxonica/config/EnterpriseConfiguration\$SurrogateSchema.class"
455
    exclude "com/saxonica/config/EnterpriseConfiguration\$1.class"
456
    exclude "com/saxonica/config/ProfessionalTransformerFactory.class"
457
    exclude "com/saxonica/config/ProfessionalXPathFactory.class"
458
    exclude "com/saxonica/config/EnterpriseTransformerFactory.class"
459
    exclude "com/saxonica/config/StreamingTransformerFactory.class"
460
    exclude "com/saxonica/config/EnterpriseXPathFactory.class"
461
    exclude "com/saxonica/config/DynamicLoaderEE.class"
462
    exclude "com/saxonica/config/StandardSchemaResolver.class"
463
    exclude "com/saxonica/expr/ee/*.class"
464
  }
465
  from ("src/main/java") {
466
    include "net/sf/saxon/data/**"
467
  }
468
  doFirst {
469
    mkdir "build/n/jar"
470
  }
471
}
472

    
473
task een_jar(
474
  type: Jar,
475
  dependsOn: ["eenCompile"],
476
  description: "Build the EE jar file for Saxon .NET"
477
) {
478
  archiveBaseName = "saxon10ee"
479
  destinationDirectory = file("${buildDir}/n/jar")
480
  from ("build/classes/een") {
481
    include "net/**/*.class"
482
    include "com/saxonica/**/*.class"
483
    include "org/objectweb/**/*.class"
484
    exclude "com/saxonica/config/EnterpriseTransformerFactory.class"
485
    exclude "com/saxonica/config/EnterpriseXPathFactory.class"
486
  }
487
  from ("src/main/java") {
488
    include "net/sf/saxon/data/**"
489
  }
490
  doFirst {
491
    mkdir "build/n/jar"
492
  }
493
}
494

    
495
task ikvm_prepareJarAsm(
496
  type: Copy,
497
  description: "Copy the ASM jars for IKVM"
498
) {
499
  from "lib/asm-${asmVersion}"
500
  into "${buildDir}/n/jar/asm-${asmVersion}"
501
  include "*.jar"
502
}
503

    
504
task ikvm_prepareJar(
505
  type: Copy,
506
  dependsOn: ["ikvm_prepareJarAsm", "rejar_Xerces"],
507
  description: "Copy the ICU4J, TagSoup, Mail, and Xerces jars for IKVM"
508
) {
509
  from "${icu4jJar}"
510
  into "${buildDir}/n/jar"
511
  from "${tagsoupJar}"
512
  into "${buildDir}/n/jar"
513
  from "${mailJar}"
514
  into "${buildDir}/n/jar"
515
  from "${buildDir}/xerces/xerces.jar"
516
  into "${buildDir}/n/jar"
517
}
518

    
519
task "n_notices"(
520
  type: Copy,
521
  description: "Copy the notices into the staging directory"
522
) {
523
  from "src/docs/notices"
524
  into "${buildDir}/n/notices"
525
}
526

    
527
["h", "p", "e"].each { initial ->
528
  def release = initial + "e"
529
  def RELEASE = release.toUpperCase()
530
  task "${release}n_setupDll"(
531
    type: Copy,
532
    dependsOn: ["${release}n_jar", "ikvm_prepareJar"],
533
    description: "Setup the IKVM environment for ${RELEASE}"
534
) {
535
    from "${ikvmDir}/ikvm-${ikvmVersion}/bin"
536
    into "${buildDir}/n/bin/${release}"
537
    include "IKVM.OpenJDK.Core.dll"
538
    include "IKVM.OpenJDK.Localedata.dll"
539
    include "IKVM.OpenJDK.Charsets.dll"
540
    include "IKVM.OpenJDK.Text.dll"
541
    include "IKVM.OpenJDK.Util.dll"
542
    include "IKVM.OpenJDK.XML.API.dll"
543
    include "IKVM.OpenJDK.Security.dll"
544
    //include "xercesImpl.dll"
545
    include "IKVM.Runtime.dll"
546
  }
547

    
548
  task "${release}n_iss"(
549
    type: Copy,
550
    description: "Create the ${release}.iss file for the .net installer"
551
  ) {
552
    inputs.file("${projectDir}/src/dotnet/${release}.iss")
553
    outputs.file("${buildDir}/n/${release}.iss")
554

    
555
    from "${projectDir}/src/dotnet/${release}.iss"
556
    into "${buildDir}/n"
557
    filter { line ->
558
      line \
559
        .replace("@@SOURCE_DIR@@", "bin\\${release}") \
560
        .replace("@@OUTPUT_DIR@@", "..\\..\\..\\distributions") \
561
        .replace("@@VERSION@@", saxonVersion) \
562
        .replace("@@VERSION_H@@", version_h) \
563
        .replace("@@IKVM_STRONGNAME@@", ikvmStrongname) \
564
        .replace("@@MAJOR_VERSION@@", saxonMajorVersion) \
565
        .replace("@@MINOR_VERSION@@", saxonMinorVersion) \
566
        .replace("@@COPYRIGHT_YEAR@@", "2020")
567
    }
568
  }
569

    
570
  task "${release}nInstaller"(
571
    type: Exec,
572
    dependsOn: ["${release}nProduct", "${release}n_iss", "n_notices"],
573
    description: "Build the ${RELEASE} installer for .NET"
574
  ) {
575
    commandLine "${dotNetInstaller}",
576
      "/cc", "${buildDir}/n/${release}.iss"
577
  }
578

    
579
  task "${release}nSigner"(
580
    type: Exec,
581
    dependsOn: ["${release}nInstaller"]
582
  ) {
583
    commandLine "signtool",
584
      "sign", "/a",
585
      "/tr", "http://rfc3161timestamp.globalsign.com/advanced",
586
      "/td", "SHA256",
587
      "${buildDir}/distributions/Saxon${RELEASE}${saxonMajorVersion}-${saxonMinorVersion}N-setup.exe"
588
  }
589
}
590

    
591
task henDll(
592
  type: Exec,
593
  dependsOn: ["hen_setupDll"],
594
  description: "Build HE .dll with IKVM"
595
) {
596
  inputs.files("${buildDir}/n/bin/jar")
597
  inputs.file("${buildDir}/xerces/xerces.jar")
598
  inputs.file("${ikvmDir}/saxondotnet.snk")
599
  outputs.file("build/n/bin/he/saxon-he-${saxonMajorVersion}.${saxonMinorVersion}.dll")
600

    
601
  def ikvmCommand = ikvmExecutable \
602
  + additionalIkvmOptions \
603
  + ["-out:${buildDir}/n/bin/he/saxon-he-${saxonMajorVersion}.${saxonMinorVersion}.dll",
604
     "-assembly:saxon-he-${saxonMajorVersion}.${saxonMinorVersion}",
605
     "-target:library",
606
     "-keyfile:${ikvmDir}/saxondotnet.snk",
607
     "-version:${saxonVersion}",
608
     "-srcpath:${buildDir}/preprocess/hen",
609
     "-reference:mscorlib.dll",
610
     "-reference:System.Xml.dll",
611
     "-reference:System.dll",
612
     "-reference:${buildDir}/n/bin/he/IKVM.OpenJDK.Core.dll",
613
     "${buildDir}/n/jar/saxon10he.jar",
614
     "${buildDir}/n/jar/xerces.jar"]
615

    
616
  commandLine ikvmCommand
617
  doFirst {
618
    mkdir "${buildDir}/n/bin/he"
619
  }
620
}
621

    
622
task penDll(
623
  type: Exec,
624
  dependsOn: ["pen_setupDll"],
625
  description: "Build PE .dll with IKVM"
626
) {
627
  inputs.files("${buildDir}/n/bin/jar")
628
  inputs.file("${buildDir}/xerces/xerces.jar")
629
  inputs.file("${ikvmDir}/saxondotnet.snk")
630
  outputs.file("build/n/bin/pe/saxon-pe-${saxonMajorVersion}.${saxonMinorVersion}.dll")
631

    
632
  def ikvmCommand = ikvmExecutable \
633
  + additionalIkvmOptions \
634
  + ["-out:${buildDir}/n/bin/pe/saxon-pe-${saxonMajorVersion}.${saxonMinorVersion}.dll",
635
     "-assembly:saxon-pe-${saxonMajorVersion}.${saxonMinorVersion}",
636
     "-target:library",
637
     "-keyfile:${ikvmDir}/saxondotnet.snk",
638
     "-version:${saxonVersion}",
639
     "-srcpath:${buildDir}/preprocess/pen",
640
     "-reference:mscorlib.dll",
641
     "-reference:System.Xml.dll",
642
     "-reference:System.dll",
643
     "-reference:${buildDir}/n/bin/pe/IKVM.OpenJDK.Core.dll",
644
     "-reference:System.Security.dll",
645
     "${buildDir}/n/jar/saxon10pe.jar",
646
     "${buildDir}/n/jar/xerces.jar",
647
     "${buildDir}/n/jar/tagsoup-${tagsoupVersion}.jar",
648
     "${buildDir}/n/jar/javax.mail-${mailVersion}.jar",
649
     "${buildDir}/n/jar/icu4j-${icu4jVersion}.jar"]
650

    
651
  commandLine ikvmCommand
652
  doFirst {
653
    mkdir "${buildDir}/n/bin/pe"
654
  }
655
}
656

    
657
task eenDll(
658
  type: Exec,
659
  dependsOn: ["een_setupDll"],
660
  description: "Build EE .dll with IKVM"
661
) {
662
  inputs.files("${buildDir}/n/bin/jar")
663
  inputs.file("${buildDir}/xerces/xerces.jar")
664
  inputs.file("${ikvmDir}/saxondotnet.snk")
665
  outputs.file("${buildDir}/n/bin/ee/saxon-ee-${saxonMajorVersion}.${saxonMinorVersion}.dll")
666

    
667
  def ikvmCommand = ikvmExecutable \
668
  + additionalIkvmOptions \
669
  + ["-out:${buildDir}/n/bin/ee/saxon-ee-${saxonMajorVersion}.${saxonMinorVersion}.dll",
670
     "-assembly:saxon-ee-${saxonMajorVersion}.${saxonMinorVersion}",
671
     "-target:library",
672
     "-keyfile:${ikvmDir}/saxondotnet.snk",
673
     "-version:${saxonVersion}",
674
     "-srcpath:${buildDir}/preprocess/een",
675
     "-reference:mscorlib.dll",
676
     "-reference:System.Xml.dll",
677
     "-reference:System.dll",
678
     "-reference:${buildDir}/n/bin/ee/IKVM.OpenJDK.Core.dll",
679
     "-reference:System.Security.dll",
680
     "${buildDir}/n/jar/saxon10ee.jar",
681
     "${buildDir}/n/jar/xerces.jar",
682
     "${buildDir}/n/jar/asm-${asmVersion}/asm-${asmVersion}.jar",
683
     "${buildDir}/n/jar/asm-${asmVersion}/asm-analysis-${asmVersion}.jar",
684
     "${buildDir}/n/jar/asm-${asmVersion}/asm-commons-${asmVersion}.jar",
685
     "${buildDir}/n/jar/asm-${asmVersion}/asm-tree-${asmVersion}.jar",
686
     "${buildDir}/n/jar/asm-${asmVersion}/asm-util-${asmVersion}.jar",
687
     "${buildDir}/n/jar/tagsoup-${tagsoupVersion}.jar",
688
     "${buildDir}/n/jar/javax.mail-${mailVersion}.jar",
689
     "${buildDir}/n/jar/icu4j-${icu4jVersion}.jar"]
690

    
691
  commandLine ikvmCommand
692
  doFirst {
693
    mkdir "${buildDir}/n/bin/ee"
694
  }
695
}
696

    
697
task productDlls(
698
  dependsOn: ["henDll", "penDll", "eenDll"],
699
  description: "Build all the product .dll files with IKVM"
700
) {
701
  doLast {
702
    println("Built DLLs")
703
  }
704
}
705

    
706
// ============================================================
707
// Tasks to rejar Xerces and Resolver for .NET
708

    
709
task unjar_XercesImpl(
710
  type: Copy,
711
  description: "Unjar XercesImple for .NET build"
712
) {
713
  inputs.file("lib/xercesImpl.jar")
714
  outputs.files(fileTree("${buildDir}/xerces/org/apache/xerces"))
715
  from zipTree(file("lib/xercesImpl.jar"))
716
  into "${buildDir}/xerces"
717
}
718

    
719
task unjar_Resolver(
720
  type: Copy,
721
  description: "Unjar Resolver for .NET build"
722
) {
723
  from zipTree(file(resolverJar))
724
  into "${buildDir}/xerces"
725
}
726
// This task is always out of date because
727
// .../build/xerces/META-INF/MANIFEST.MF has changed.
728
// Skip this if it doesn't seem to be necessary
729
unjar_Resolver.onlyIf {
730
  !file("${buildDir}/xerces/org/apache/xml/resolver/Catalog.class").exists()
731
}
732

    
733
task rejar_Xerces(
734
  type: Jar,
735
  dependsOn: ["unjar_XercesImpl", "unjar_Resolver"],
736
  description: "Unjar Xerces and Resolver for .NET build"
737
) {
738
  inputs.files fileTree("${buildDir}/xerces/org")
739
  outputs.file "${buildDir}/xerces/xerces.jar"
740
  archiveBaseName = "xerces"
741
  destinationDirectory = file("${buildDir}/xerces")
742
  from ("${buildDir}/xerces") {
743
    include "**/*.class"
744
    include "**/*.properties"
745
    exclude "org.w3c.dom.html.HTMLDOMImplementation.class"
746
    exclude "META-INF/MANIFEST.MF"
747
  }
748
}
749

    
750
task hen_cmdAssemblyInfo(
751
  description: "Create the AssemblyInfo.cs file for the Saxon commands"
752
) {
753
  outputs.file("${buildDir}/n/csharp/cmd/AssemblyInfo.cs")
754
  doLast {
755
    new File("${buildDir}/n/csharp/cmd/AssemblyInfo.cs")
756
      .withWriter("utf-8") { writer ->
757
        writer.writeLine("          using System.Reflection;")
758
        writer.writeLine("          using System.Runtime.CompilerServices;")
759
        writer.writeLine("          using System.Runtime.InteropServices;")
760
        writer.writeLine("          [assembly: AssemblyCompany(\"Saxonica\")]")
761
        writer.writeLine("          [assembly: AssemblyProduct(\"Saxon.HE\")]")
762
        writer.writeLine("          [assembly: AssemblyCopyright(\"Copyright © Saxonica 2020\")]")
763
        writer.writeLine("          [assembly: AssemblyVersion(\"${saxonVersion}\")]")
764
        writer.writeLine("          [assembly: AssemblyFileVersion(\"${saxonVersion}\")]")
765
      }
766
  }
767
  doFirst {
768
    mkdir "${buildDir}/n/csharp/cmd"
769
  }
770
}
771

    
772
// If we didn't find a C# compiler, abort all the C# compile steps
773
if (csharpCompiler == null) {
774
  ["h", "p", "e"].each { initial ->
775
    def release = initial + "e"
776
    def Release = initial.toUpperCase() + "e"
777
    def RELEASE = release.toUpperCase()
778
    def product = "${release}n"
779
    ["csharpApi", "csharpTransform", "csharpQuery"].each { step ->
780
      def desc = "Compile Saxon.Api for ${RELEASE}"
781
      if (step == "csharpTransform") {
782
        desc = "Compile Tranform.exe for ${RELEASE}"
783
      } else if (step == "csharpQuery") {
784
        desc = "Compile Query.exe for ${RELEASE}"
785
      }
786
      desc = desc + " (Fails on this platform)"
787
      task "${product}_${step}"(
788
        description: desc
789
      ) {
790
        doLast {
791
          throw new GradleException("Cannot build .NET; no C# compiler.")
792
        }
793
      }
794
    }
795
  }
796
  task een_csharpValidate(
797
    description: "Compile Validate.exe for EE (Fails on this platform)"
798
  ) {
799
    doLast {
800
      throw new GradleException("Cannot build .NET; no C# compiler.")
801
    }
802
  } 
803
} else {
804
  task hen_csharpApi(
805
    dependsOn: ["henDll"],
806
    description: "Compile Saxon.Api for HE"
807
  ) {
808
    inputs.files("${buildDir}/n/build/dll/he")
809
    inputs.files("${buildDir}/n/csharp/api")
810
    outputs.file("${buildDir}/n/bin/he/saxon-he-api-${saxonMajorVersion}.${saxonMinorVersion}.dll")
811

    
812
    doLast {
813
      def args = csharpCompiler \
814
      + ["-out:${buildDir}/n/bin/he/saxon-he-api-${saxonMajorVersion}.${saxonMinorVersion}.dll",
815
         "-target:library",
816
         "-doc:${buildDir}/n/saxon-he-api-${saxonMajorVersion}.${saxonMinorVersion}.xml",
817
         "-keyfile:${ikvmDir}/saxondotnet.snk"]
818
      fileTree(dir: "${buildDir}/n/bin/he",
819
               include: "*.dll").each { dll ->
820
        args += ["-reference:${dll}"]
821
      }
822
      fileTree(dir: "${buildDir}/n/csharp/api/Saxon.Api",
823
               include: "**/*.cs").each { cs ->
824
        args += [cs]
825
      }
826

    
827
      exec {
828
        commandLine args
829
      }
830
    }
831
  }
832

    
833
  task hen_csharpTransform(
834
    dependsOn: ["henDll", "hen_csharpApi", "hen_cmdAssemblyInfo"],
835
    description: "Compile Transform.exe for HE"
836
  ) {
837
    inputs.files("${buildDir}/n/build/dll/he")
838
    inputs.files("${buildDir}/n/csharp/cmd")
839
    outputs.file("${buildDir}/n/bin/he/Transform.exe")
840

    
841
    doLast {
842
      def args = csharpCompiler \
843
      + ["-out:${buildDir}/n/bin/he/Transform.exe",
844
         "-target:exe",
845
         "-keyfile:${ikvmDir}/saxondotnet.snk"]
846
      fileTree(dir: "${buildDir}/n/bin/he",
847
               include: "*.dll").each { dll ->
848
        args += ["-reference:${dll}"]
849
      }
850
      // This only runs on Windows, so make sure you use "\"
851
      args += ["${buildDir}\\n\\csharp\\cmd\\Transform.cs",
852
               "${buildDir}\\n\\csharp\\cmd\\AssemblyInfo.cs"]
853

    
854
      exec {
855
        commandLine args
856
      }
857
    }
858
  }
859

    
860
  task hen_csharpQuery(
861
    dependsOn: ["henDll", "hen_csharpApi", "hen_cmdAssemblyInfo"],
862
    description: "Compile Query.exe for HE"
863
  ) {
864
    inputs.files("${buildDir}/n/build/dll/he")
865
    inputs.files("${buildDir}/n/csharp/cmd")
866
    outputs.file("${buildDir}/n/bin/he/Query.exe")
867

    
868
    doLast {
869
      def args = csharpCompiler \
870
      + ["-out:${buildDir}/n/bin/he/Query.exe",
871
         "-target:exe",
872
         "-keyfile:${ikvmDir}/saxondotnet.snk"]
873
      fileTree(dir: "${buildDir}/n/bin/he",
874
               include: "*.dll").each { dll ->
875
        args += ["-reference:${dll}"]
876
      }
877
      // This only runs on Windows, so make sure you use "\"
878
      args += ["${buildDir}\\n\\csharp\\cmd\\Query.cs",
879
               "${buildDir}\\n\\csharp\\cmd\\AssemblyInfo.cs"]
880

    
881
      exec {
882
        commandLine args
883
      }
884
    }
885
  }
886

    
887
  task pen_csharpApi(
888
    dependsOn: ["penDll"],
889
    description: "Compile Saxon.Api for PE"
890
  ) {
891
    inputs.files("${buildDir}/n/build/dll/pe")
892
    inputs.files("${buildDir}/n/csharp/api")
893
    outputs.file("${buildDir}/n/bin/pe/saxon-pe-api-${saxonMajorVersion}.${saxonMinorVersion}.dll")
894

    
895
    doLast {
896
      def args = csharpCompiler \
897
      + ["-out:${buildDir}/n/bin/pe/saxon-pe-api-${saxonMajorVersion}.${saxonMinorVersion}.dll",
898
         "-target:library",
899
         "-doc:${buildDir}/n/saxon-pe-api-${saxonMajorVersion}.${saxonMinorVersion}.xml",
900
         "-keyfile:${ikvmDir}/saxondotnet.snk"]
901
      fileTree(dir: "${buildDir}/n/bin/pe",
902
               include: "*.dll").each { dll ->
903
        args += ["-reference:${dll}"]
904
      }
905
      fileTree(dir: "${buildDir}/n/csharp/api/Saxon.Api",
906
               include: "**/*.cs").each { cs ->
907
        args += [cs]
908
      }
909

    
910
      exec {
911
        commandLine args
912
      }
913
    }
914
  }
915

    
916
  task pen_csharpTransform(
917
    dependsOn: ["penDll", "pen_csharpApi", "hen_cmdAssemblyInfo"],
918
    description: "Compile Transform.exe for PE"
919
  ) {
920
    inputs.files("${buildDir}/n/build/dll/pe")
921
    inputs.files("${buildDir}/n/csharp/cmd")
922
    outputs.file("${buildDir}/n/bin/pe/Transform.exe")
923

    
924
    doLast {
925
      def args = csharpCompiler \
926
      + ["-out:${buildDir}/n/bin/pe/Transform.exe",
927
         "-target:exe",
928
         "-keyfile:${ikvmDir}/saxondotnet.snk"]
929
      fileTree(dir: "${buildDir}/n/bin/pe",
930
               include: "*.dll").each { dll ->
931
        args += ["-reference:${dll}"]
932
      }
933
      // This only runs on Windows, so make sure you use "\"
934
      args += ["${buildDir}\\n\\csharp\\cmd\\Transform.cs",
935
               "${buildDir}\\n\\csharp\\cmd\\AssemblyInfo.cs"]
936

    
937
      exec {
938
        commandLine args
939
      }
940
    }
941
  }
942

    
943
  task pen_csharpQuery(
944
    dependsOn: ["penDll", "pen_csharpApi", "hen_cmdAssemblyInfo"],
945
    description: "Compile Query.exe for PE"
946
  ) {
947
    inputs.files("${buildDir}/n/build/dll/pe")
948
    inputs.files("${buildDir}/n/csharp/cmd")
949
    outputs.file("${buildDir}/n/bin/pe/Query.exe")
950

    
951
    doLast {
952
      def args = csharpCompiler \
953
      + ["-out:${buildDir}/n/bin/pe/Query.exe",
954
         "-target:exe",
955
         "-keyfile:${ikvmDir}/saxondotnet.snk"]
956
      fileTree(dir: "${buildDir}/n/bin/pe",
957
               include: "*.dll").each { dll ->
958
        args += ["-reference:${dll}"]
959
      }
960
      // This only runs on Windows, so make sure you use "\"
961
      args += ["${buildDir}\\n\\csharp\\cmd\\Query.cs",
962
               "${buildDir}\\n\\csharp\\cmd\\AssemblyInfo.cs"]
963

    
964
      exec {
965
        commandLine args
966
      }
967
    }
968
  }
969

    
970
  if (csharpCompiler == monoCSharpCompiler) {
971
    task een_csharpApi(
972
      dependsOn: ["eenDll"],
973
      description: "Compile Saxon.Api for EE"
974
    ) {
975
      inputs.files("${buildDir}/n/build/dll/ee")
976
      inputs.files("${buildDir}/n/csharp/api")
977
      outputs.file("${buildDir}/n/bin/ee/saxon-ee-api-${saxonMajorVersion}.${saxonMinorVersion}.dll")
978

    
979
      doFirst {
980
        println("********************************************************************")
981
        println("Warning: this task will not generate useful documentation API XML.")
982
        println("You must use the Mono/mcs compiler to get useful documentation.")
983
        println("********************************************************************")
984
      }
985

    
986
      doLast {
987
        def args = csharpCompiler \
988
        + ["-out:${buildDir}/n/bin/ee/saxon-ee-api-${saxonMajorVersion}.${saxonMinorVersion}.dll",
989
           "-target:library",
990
           "-doc:${buildDir}/n/saxon-ee-api-${saxonMajorVersion}.${saxonMinorVersion}.xml",
991
           "-keyfile:${ikvmDir}/saxondotnet.snk"]
992
        fileTree(dir: "${buildDir}/n/bin/ee",
993
                 include: "*.dll").each { dll ->
994
          args += ["-reference:${dll}"]
995
        }
996
        fileTree(dir: "${buildDir}/n/csharp/api/Saxon.Api",
997
                 include: "**/*.cs").each { cs ->
998
          args += [cs]
999
        }
1000
        
1001
        exec {
1002
          commandLine args
1003
        }
1004
      }
1005
    }
1006
  } else {
1007
    task een_csharpApi(
1008
      dependsOn: ["eenDll", "hen_ApiAssemblyInfo"],
1009
      description: "Compile Saxon.Api for EE"
1010
    ) {
1011
      inputs.files("${buildDir}/n/build/dll/ee")
1012
      inputs.files("${buildDir}/n/csharp/api")
1013
      outputs.file("${buildDir}/n/bin/ee/saxon-ee-api-${saxonMajorVersion}.${saxonMinorVersion}.dll")
1014

    
1015
      doLast {
1016
        def args = monoCSharpCompiler \
1017
        + ["/nologo",
1018
           "/debug+",
1019
           "-keyfile:${ikvmDir}/saxondotnet.snk",
1020
           "/optimize-",
1021
           "-out:${buildDir}/n/bin/ee/saxon-ee-api-${saxonMajorVersion}.${saxonMinorVersion}.dll",
1022
           "/target:library",
1023
           "/nostdlib-",
1024
           "/warn:3",
1025
           "/doc:${buildDir}/n/saxon-ee-api-${saxonMajorVersion}.${saxonMinorVersion}.xml",
1026
           "/fullpaths"]
1027
        fileTree(dir: "${buildDir}/n/bin/ee",
1028
                 include: "*.dll").each { dll ->
1029
          if (!dll.toString().contains("saxon-ee-api")) {
1030
            args += ["-reference:${dll}"]
1031
          }
1032
        }
1033
        fileTree(dir: "${buildDir}/n/csharp/api/Saxon.Api",
1034
                 include: "**/*.cs").each { cs ->
1035
          args += [cs]
1036
        }
1037

    
1038
        exec {
1039
          commandLine args
1040
        }
1041
      }
1042
    }
1043
  }
1044

    
1045
  task een_csharpTransform(
1046
    dependsOn: ["eenDll", "een_csharpApi", "hen_cmdAssemblyInfo"],
1047
    description: "Compile Transform.exe for EE"
1048
  ) {
1049
    inputs.files("${buildDir}/n/build/dll/ee")
1050
    inputs.files("${buildDir}/n/csharp/cmd")
1051
    outputs.file("${buildDir}/n/bin/ee/Transform.exe")
1052

    
1053
    doLast {
1054
      def args = csharpCompiler \
1055
      + ["-out:${buildDir}/n/bin/ee/Transform.exe",
1056
         "-target:exe",
1057
         "-keyfile:${ikvmDir}/saxondotnet.snk"]
1058
      fileTree(dir: "${buildDir}/n/bin/ee",
1059
               include: "*.dll").each { dll ->
1060
        args += ["-reference:${dll}"]
1061
      }
1062
      // This only runs on Windows, so make sure you use "\"
1063
      args += ["${buildDir}\\n\\csharp\\cmd\\Transform.cs",
1064
               "${buildDir}\\n\\csharp\\cmd\\AssemblyInfo.cs"]
1065

    
1066
      exec {
1067
        commandLine args
1068
      }
1069
    }
1070
  }
1071

    
1072
  task een_csharpQuery(
1073
    dependsOn: ["eenDll", "een_csharpApi", "hen_cmdAssemblyInfo"],
1074
    description: "Compile Query.exe for EE"
1075
  ) {
1076
    inputs.files("${buildDir}/n/build/dll/ee")
1077
    inputs.files("${buildDir}/n/csharp/cmd")
1078
    outputs.file("${buildDir}/n/bin/ee/Query.exe")
1079

    
1080
    doLast {
1081
      def args = csharpCompiler \
1082
      + ["-out:${buildDir}/n/bin/ee/Query.exe",
1083
         "-target:exe",
1084
         "-keyfile:${ikvmDir}/saxondotnet.snk"]
1085
      fileTree(dir: "${buildDir}/n/bin/ee",
1086
               include: "*.dll").each { dll ->
1087
        args += ["-reference:${dll}"]
1088
      }
1089
      // This only runs on Windows, so make sure you use "\"
1090
      args += ["${buildDir}\\n\\csharp\\cmd\\Query.cs",
1091
               "${buildDir}\\n\\csharp\\cmd\\AssemblyInfo.cs"]
1092

    
1093
      exec {
1094
        commandLine args
1095
      }
1096
    }
1097
  }
1098

    
1099
  task een_csharpValidate(
1100
    dependsOn: ["eenDll", "een_csharpApi", "hen_cmdAssemblyInfo"],
1101
    description: "Compile Validate.exe for EE"
1102
  ) {
1103
    inputs.files("${buildDir}/n/build/dll/ee")
1104
    inputs.files("${buildDir}/n/csharp/cmd")
1105
    outputs.file("${buildDir}/n/bin/ee/Validate.exe")
1106

    
1107
    doLast {
1108
      def args = csharpCompiler \
1109
      + ["-out:${buildDir}/n/bin/ee/Validate.exe",
1110
         "-target:exe",
1111
         "-keyfile:${ikvmDir}/saxondotnet.snk"]
1112
      fileTree(dir: "${buildDir}/n/bin/ee",
1113
               include: "*.dll").each { dll ->
1114
        args += ["-reference:${dll}"]
1115
      }
1116
      // This only runs on Windows, so make sure you use "\"
1117
      args += ["${buildDir}\\n\\csharp\\cmd\\Validate.cs",
1118
               "${buildDir}\\n\\csharp\\cmd\\AssemblyInfo.cs"]
1119

    
1120
      exec {
1121
        commandLine args
1122
      }
1123
    }
1124
  }
1125
}
1126

    
1127
task henProduct(
1128
  type: Copy,
1129
  dependsOn: ["hen_csharpApi", "hen_csharpTransform", "hen_csharpQuery"],
1130
  description: "Build Saxon HE for .NET"
1131
) {
1132
  from "${buildDir}/n/saxon-he-api-${saxonMajorVersion}.${saxonMinorVersion}.xml"
1133
  into "${buildDir}/n/bin/he"
1134
}
1135

    
1136
task penProduct(
1137
  type: Copy,
1138
  dependsOn: ["pen_csharpApi", "pen_csharpTransform", "pen_csharpQuery"],
1139
  description: "Build Saxon PE for .NET"
1140
) {
1141
  from "${buildDir}/n/saxon-pe-api-${saxonMajorVersion}.${saxonMinorVersion}.xml"
1142
  into "${buildDir}/n/bin/pe"
1143
}
1144

    
1145
task eenProduct(
1146
  type: Copy,
1147
  dependsOn: ["een_csharpApi", "een_csharpTransform", "een_csharpQuery", "een_csharpValidate"],
1148
  description: "Build Saxon EE for .NET"
1149
) {
1150
  from "${buildDir}/n/saxon-ee-api-${saxonMajorVersion}.${saxonMinorVersion}.xml"
1151
  into "${buildDir}/n/bin/ee"
1152
}
1153

    
1154
if (file("${projectDir}/src/main/java/com").exists()) {
1155
  task dotNetProducts(
1156
    dependsOn: ["henProduct", "penProduct", "eenProduct"],
1157
    description: "Builds all of the .NET products"
1158
  ) {
1159
    // nop
1160
  }
1161

    
1162
  task dotNetInstallers(
1163
    dependsOn: ["henInstaller", "penInstaller", "eenInstaller"],
1164
    description: "Builds all of the .NET installers"
1165
  ) {
1166
    // nop
1167
  }
1168
} else {
1169
  // Ignore the EEJ and PEJ releases if the sources aren't available
1170
  task dotNetProducts(
1171
    dependsOn: ["henProduct"],
1172
    description: "Builds all of the .NET products"
1173
  ) {
1174
    // nop
1175
  }
1176

    
1177
  task dotNetInstallers(
1178
    dependsOn: ["henInstaller"],
1179
    description: "Builds all of the .NET installers"
1180
  ) {
1181
    // nop
1182
  }
1183
}
1184

    
1185

    
(7-7/14)