Project

Profile

Help

Maintenance. Planio will be undergoing a scheduled maintenance this weekend. Between Saturday, July 24 at 9:00 UTC and Sunday, July 25, 22:00 UTC your account might observe occasional downtimes which may last up to several minutes in some cases.

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

he / build-doc.gradle @ saxon10

1
task clone_expath_cg(
2
  type: Exec,
3
  description: "Clones the expath-cg github repository for doc builds"
4
) {
5
  commandLine "git",
6
    "clone",
7
    "https://github.com/expath/expath-cg.git",
8
    "${buildDir}/expath-cg"
9
}
10
clone_expath_cg.onlyIf {
11
  !file("${buildDir}/expath-cg").exists()
12
}
13

    
14
// ============================================================
15

    
16
task documentation(
17
  dependsOn: ["update_documentation", "gen_contents_ref", "gen_feature_matrix"],
18
  description: "Build the documentation and pages for website"
19
) {
20
  // Just a place to hang dependencies
21
}
22

    
23
// ============================================================
24

    
25
task filter_sources_for_javadoc(
26
  type: Copy,
27
  description: "Copy the Java source files for making JavaDoc (excludes some classes)"
28
) {
29
  inputs.files fileTree(dir: "${projectDir}/src/main/java")
30
  outputs.files fileTree(dir: "${buildDir}/javadoc_src")
31
  
32
  // N.B. these exclusions are also applied in the tasks below.
33
  into "${buildDir}/javadoc_src"
34
  from ("${projectDir}/src/main/java") {
35
    include "net/**"
36
    include "com/**"
37
    include "javax/**"
38
    exclude "**/dotnet/**"
39
    exclude "net/sf/saxon/option/cpp/**"
40
    exclude "net/sf/saxon/testdriver/**"
41
    exclude "com/saxonica/functions/extfn/cpp/**"
42
    exclude "com/saxonica/js/**"
43
    exclude "com/saxonica/testdriver/**"
44
    exclude "com/saxonica/config/DotNetExtensionFunctionFactory.java"
45
    exclude "com/saxonica/config/DotNetExtensionLibrary.java"
46
    exclude "com/saxonica/config/DotNetPlatformPE.java"
47
    exclude "com/saxonica/config/JavaPlatformC.java"
48
    exclude "com/saxonica/expr/DotNetExtensionFunctionCall.java"
49
  }
50
}
51

    
52
task product_javadoc(
53
  type: Exec,
54
  dependsOn: ["filter_sources_for_javadoc"],
55
  description: "Generate Javadoc files"
56
) {
57
  // If you can't do something the easy way, do it the hard way.
58
  // The Gradle JavaDoc plugin should be able to do this, but it doesn't
59
  // do the right thing and it's completely unclear why. (The symptom that
60
  // forced me to resort to this approach was including every file twice.)
61
  inputs.files fileTree(dir: "${buildDir}/javadoc_src")
62
  outputs.files fileTree(dir: "${buildDir}/javadoc")
63

    
64
  def cp = ""
65
  configurations.documentation.resolve().each { path ->
66
    cp = cp + System.getProperty("path.separator") + path
67
  }
68

    
69
  // Any directory that contains a java file is assumed to be a
70
  // package...because that's the way packages work in Java.
71
  // Frustratingly, we have to base this on the main source directory,
72
  // not the one created by filter_sources_for_javadoc because this
73
  // calculation runs during the Gradle configuration phase when
74
  // that directory might not yet exist. FIXME: do this better
75
  def filesep = System.getProperty("file.separator")
76
  // If there are back slashes in the filesep, make sure they're escaped!
77
  def fsre = filesep.replaceAll("\\\\", "\\\\\\\\")
78
  def packages = [:]
79
  fileTree(dir: "${projectDir}/src/main/java",
80
           include: ["net/**", "com/**", "javax/**"],
81
           exclude: ["**/dotnet/**",
82
                     "net/sf/saxon/option/cpp/**",
83
                     "net/sf/saxon/testdriver/**",
84
                     "com/saxonica/functions/extfn/cpp/**",
85
                     "com/saxonica/js/**",
86
                     "com/saxonica/testdriver/**",
87
                     "com/saxonica/config/DotNetExtensionFunctionFactory.java",
88
                     "com/saxonica/config/DotNetExtensionLibrary.java",
89
                     "com/saxonica/config/DotNetPlatformPE.java",
90
                     "com/saxonica/config/JavaPlatformC.java",
91
                     "com/saxonica/expr/DotNetExtensionFunctionCall.java"]).each { pkg ->
92
    def fn = pkg.toString()
93
    fn = fn.substring("{$projectDir}/src/main/java".length()-1)
94
    def pos = fn.lastIndexOf(filesep)
95
    fn = fn.substring(0, pos).replaceAll(fsre, ".")
96
    packages[fn] = 1
97
  }
98

    
99
  def command = ["javadoc",
100
                 "-sourcepath", "${buildDir}/javadoc_src",
101
                 "-Xdoclint:none",
102
                 "-d", "${buildDir}/javadoc",
103
                 "-protected",
104
                 "-classpath", cp,
105
                 "-bottom", "Copyright (c) 2004-2021 Saxonica Limited. All rights reserved.",
106
                 "-doctitle", "Saxon ${saxonVersion} Java API Documentation",
107
                 "-group", "s9api Interface", "net.sf.saxon.s9api",
108
                 "-group", "Other Interfaces", "com.saxonica.config:net.sf.saxon:net.sf.saxon.lib:net.sf.saxon.om:net.sf.saxon.query:net.sf.saxon.sxpath:net.sf.saxon.value:net.sf.saxon.type:net.sf.saxon.xpath:net.sf.saxon.xqj",
109
                 "-group", "External Interfaces", "javax.xml.xquery",
110
                 "-source", "1.8"] + packages.keySet()
111

    
112
  commandLine command
113

    
114
  doFirst {
115
      mkdir "${buildDir}/javadoc"
116
    }
117
}
118

    
119
task product_jeljavadoc(
120
  type: Exec,
121
  dependsOn: ["filter_sources_for_javadoc"],
122
  description: "Generate Javadoc XML files"
123
) {
124
  // If you can't do something the easy way, do it the hard way.
125
  // The Gradle JavaDoc plugin should be able to do this, but it doesn't
126
  // do the right thing with package descriptions and it's completely
127
  // unclear why.
128
  inputs.files fileTree(dir: "${buildDir}/javadoc_src")
129
  inputs.file "${projectDir}/lib/jeldoc.jar"
130
  outputs.files fileTree(dir: "${buildDir}/jeljavadoc")
131

    
132
  def cp = ""
133
  configurations.documentation.resolve().each { path ->
134
    cp = cp + System.getProperty("path.separator") + path
135
  }
136

    
137
  // Any directory that contains a java file is assumed to be a
138
  // package...because that's the way packages work in Java.
139
  // Frustratingly, we have to base this on the main source directory,
140
  // not the one created by filter_sources_for_javadoc because this
141
  // calculation runs during the Gradle configuration phase when
142
  // that directory might not yet exist. FIXME: do this better
143
  def filesep = System.getProperty("file.separator")
144
  // If there are back slashes in the filesep, make sure they're escaped!
145
  def fsre = filesep.replaceAll("\\\\", "\\\\\\\\")
146
  def packages = [:]
147
  fileTree(dir: "${projectDir}/src/main/java",
148
           include: ["net/**", "com/**", "javax/**"],
149
           exclude: ["**/dotnet/**",
150
                     "net/sf/saxon/option/cpp/**",
151
                     "net/sf/saxon/testdriver/**",
152
                     "com/saxonica/functions/extfn/cpp/**",
153
                     "com/saxonica/js/**",
154
                     "com/saxonica/testdriver/**",
155
                     "com/saxonica/config/DotNetExtensionFunctionFactory.java",
156
                     "com/saxonica/config/DotNetExtensionLibrary.java",
157
                     "com/saxonica/config/DotNetPlatformPE.java",
158
                     "com/saxonica/config/JavaPlatformC.java",
159
                     "com/saxonica/expr/DotNetExtensionFunctionCall.java"]).each { pkg ->
160
    def fn = pkg.toString()
161
    fn = fn.substring("{$projectDir}/src/main/java".length()-1)
162
    def pos = fn.lastIndexOf(filesep)
163
    fn = fn.substring(0, pos).replaceAll(fsre, ".")
164
    packages[fn] = 1
165
  }
166

    
167
  def command = ["javadoc",
168
                 "-sourcepath", "${buildDir}/javadoc_src",
169
                 "-d", "${buildDir}/jeljavadoc",
170
                 "-package",
171
                 "-filename", "jeldoclet-out.xml",
172
                 "-includeNamespace",
173
                 "-outputEncoding", "utf-8",
174
                 "-classpath", cp,
175
                 "-doclet", "com.jeldoclet.JELDoclet",
176
                 "-docletpath", cp,
177
                 "-source", "1.8"] + packages.keySet()
178

    
179
  commandLine command
180

    
181
  doFirst {
182
      mkdir "${buildDir}/jeljavadoc"
183
    }
184
}
185

    
186
task product_xsljavadoc(
187
  type: JavaExec,
188
  dependsOn: ["product_jeljavadoc"],
189
  description: "Convert javadoc XML into format for documentation"
190
) {
191
  inputs.files fileTree(dir: "${buildDir}/jeljavadoc")
192
  inputs.file "${projectDir}/tools/docs/javadoc/chunk-javadoc.xsl"
193
  outputs.files fileTree(dir: "${buildDir}/javadoc-xml")
194
  classpath = configurations.documentation
195
  main = "com.saxonica.Transform"
196
  args "-s:${buildDir}/jeljavadoc/jeldoclet-out.xml",
197
    "-xsl:${projectDir}/tools/docs/javadoc/chunk-javadoc.xsl",
198
    "-o:${buildDir}/javadoc-xml/out",
199
    "base-output=${buildDir}/javadoc-xml/"
200
}
201

    
202
task javadoc_linkchecker(
203
  type: JavaExec,
204
  dependsOn: ["product_xsljavadoc"],
205
  description: "Generate report of links"
206
) {
207
  inputs.files fileTree(dir: "${buildDir}/javadoc-xml")
208
  inputs.file "${projectDir}/tools/docs/javadoc/check-tag-links.xsl"
209
  outputs.file "${buildDir}/javadoc-tag-check.xml"
210
  classpath = configurations.documentation
211
  main = "com.saxonica.Transform"
212
  args "-s:${buildDir}/javadoc-xml/javadoc-types.xml",
213
    "-xsl:${projectDir}/tools/docs/javadoc/check-tag-links.xsl",
214
    "-o:${buildDir}/javadoc-tag-check.xml"
215
}
216

    
217
task dotnet_doc_parsecs(
218
  type: JavaExec,
219
  dependsOn: ["een_csharpApi"],
220
  description: "Parse dotnet cs files for docs"
221
) {
222
  inputs.files fileTree(dir: "${buildDir}/n/csharp/api/Saxon.Api")
223
  inputs.file "${projectDir}/tools/docs/dotnet/parsecs.xsl"
224
  outputs.file "${buildDir}/dotnetdoc/names.xml"
225
  classpath = configurations.documentation
226
  main = "com.saxonica.Transform"
227
  args "-it:main",
228
    "-s:${projectDir}/tools/docs/dotnet/parsecs.xsl",
229
    "-xsl:${projectDir}/tools/docs/dotnet/parsecs.xsl",
230
    "-o:${buildDir}/dotnetdoc/names.xml",
231
    "inputdir=${buildDir}/n/csharp/api/Saxon.Api"
232
}
233

    
234
task dotnet_doc_merge(
235
  type: JavaExec,
236
  dependsOn: ["dotnet_doc_parsecs"],
237
  description: "Merge API docs for dotnet"
238
) {
239
  inputs.file "${buildDir}/dotnetdoc/names.xml"
240
  inputs.file "${buildDir}/n/saxon-ee-api-${saxonVersion}.xml"
241
  inputs.file "${projectDir}/tools/docs/dotnet/merge.xsl"
242
  outputs.file "${buildDir}/dotnetdoc/merged.xml"
243
  classpath = configurations.documentation
244
  main = "com.saxonica.Transform"
245
  args "-it:main",
246
    "-s:${buildDir}/dotnetdoc/names.xml",
247
    "-xsl:${projectDir}/tools/docs/dotnet/merge.xsl",
248
    "-o:${buildDir}/dotnetdoc/merged.xml",
249
    "names-file=${buildDir}/dotnetdoc/names.xml",
250
    "api-doc-file=${buildDir}/n/saxon-ee-api-${saxonVersion}.xml"
251
}
252

    
253
task dotnet_doc_css(
254
  type: Copy,
255
  description: "Copies the CSS for dotnet docs"
256
) {
257
  into "${buildDir}/dotnetdoc-html"
258
  from "${projectDir}/tools/docs/dotnet/saxon-dotnetdoc.css"
259
}
260

    
261
task dotnet_doc_html(
262
  type: JavaExec,
263
  dependsOn: ["dotnet_doc_merge", "dotnet_doc_css"],
264
  description: "Create HTML output for dotnet docs"
265
) {
266
  inputs.file "${buildDir}/dotnetdoc/merged.xml"
267
  inputs.file "${projectDir}/tools/docs/dotnet/tohtml.xsl"
268
  outputs.file "${buildDir}/dotnetdoc-html/index.html"
269
  classpath = configurations.documentation
270
  main = "com.saxonica.Transform"
271
  args "-s:${buildDir}/dotnetdoc/merged.xml",
272
    "-xsl:${projectDir}/tools/docs/dotnet/tohtml.xsl",
273
    "-o:${buildDir}/dotnetdoc-html/index.html"
274
}
275

    
276
task dotnet_doc_jel(
277
  type: JavaExec,
278
  dependsOn: ["dotnet_doc_merge"],
279
  description: "Create HTML output for dotnet docs"
280
) {
281
  inputs.file "${buildDir}/dotnetdoc/merged.xml"
282
  inputs.file "${projectDir}/tools/docs/dotnet/convert-to-jel-package.xsl"
283
  outputs.file "${buildDir}/dotnetdoc-xml/packages/Saxon.Api.xml"
284
  classpath = configurations.documentation
285
  main = "com.saxonica.Transform"
286
  args "-s:${buildDir}/dotnetdoc/merged.xml",
287
    "-xsl:${projectDir}/tools/docs/dotnet/convert-to-jel-package.xsl",
288
    "-o:${buildDir}/dotnetdoc-xml/packages/Saxon.Api.xml"
289
}
290

    
291
task app_dotnetdoc(
292
  type: Copy,
293
  dependsOn: ["dotnet_doc_jel"],
294
  description: "Copy the XML dotnet docs to the viewer app"
295
) {
296
  into "${buildDir}/userdoc/viewer_appJS/dotnetdoc-xml"
297
  from "${buildDir}/dotnetdoc-xml"
298
}
299

    
300
task app_javadoc(
301
  type: Copy,
302
  dependsOn: ["product_xsljavadoc"],
303
  description: "Copy the XML javadoc docs to the viewer app"
304
) {
305
  into "${buildDir}/userdoc/viewer_appJS/javadoc-xml"
306
  from "${buildDir}/javadoc-xml"
307
}
308

    
309
task resources_dotnetdoc(
310
  dependsOn: ["resources_dotnetdoc_css", "resources_dotnetdoc_apidoc"],
311
  description: "Copy dotnet files into the resources folder"
312
) {
313
  // nop
314
}
315

    
316
task resources_dotnetdoc_css(
317
  type: Copy,
318
  dependsOn: ["dotnet_doc_jel"],
319
  description: "Copy the dotnet CSS into the resources folder"
320
) {
321
  into "${buildDir}/resources/doc/dotnetdoc"
322
  from ("${projectDir}/tools/docs/dotnet") {
323
    include "saxon-dotnetdoc.css"
324
  }
325
}
326

    
327
task resources_dotnetdoc_apidoc(
328
  type: Copy,
329
  dependsOn: ["dotnet_doc_jel"],
330
  description: "Copy the dotnet API docs into the resources folder"
331
) {
332
  into "${buildDir}/resources/doc/dotnetdoc"
333
  from ("${buildDir}/n") {
334
    include "saxon-ee-api-${saxonVersion}.xml"
335
    rename("saxon-ee-api-${saxonVersion}.xml", "apidoc.xml")
336
  }
337
}
338

    
339
// ============================================================
340

    
341
task gen_doc(
342
  dependsOn: ["gen_doc_icu_uca", "gen_xslt_element_reference",
343
              "gen_xslt_element_reference", "element_doc", "expath_doc",
344
              "doc_FeatureKeysDoc", "doc_ConfigFileDoc"],
345
  description: "Collects up, generates and copies the documentation source into the canonical location"
346
) {
347
  // Just a place to hang dependencies
348
}  
349

    
350
task copy_userdoc_sources(
351
  type: Copy,
352
  dependsOn: ["copy_userdoc_implement"],
353
  description: "Copy the 'real', unpreprocessed sources"
354
) {
355
  into "${buildDir}/userdoc/src"
356
  from ("${projectDir}/src/userdoc") {
357
    // Excluded files are transformed by other tasks into "src" for the docbuild
358
    exclude "extensions/**"
359
    exclude "elements/**"
360
  }
361
}
362

    
363
task copy_userdoc_implement(
364
  type: Copy,
365
  description: "Copy the app implement file"
366
) {
367
  from "${projectDir}/src/viewer_appJS/doc"
368
  into "${buildDir}/userdoc/src"
369
}
370

    
371
task doc_FeatureKeysDoc(
372
  type: JavaExec,
373
  dependsOn: ["copy_userdoc_sources"],
374
  description: "Construct the documentation for feature keys"
375
) {
376
  inputs.files fileTree(dir: "${projectDir}/tools/featureKeys")
377
  outputs.file "${buildDir}/userdoc/src/featureKeys/FeatureKeysDoc.xml"
378
  classpath = configurations.preprocessor
379
  main = "net.sf.saxon.Transform"
380
  args "${projectDir}/tools/featureKeys/FeatureKeys.xml",
381
    "-xsl:${projectDir}/tools/featureKeys/FeatureKeysToDoc.xsl",
382
    "-o:${buildDir}/userdoc/src/featureKeys/FeatureKeysDoc.xml"
383
}
384

    
385
task doc_ConfigFileDoc(
386
  type: JavaExec,
387
  dependsOn: ["copy_userdoc_sources", "doc_FeatureKeysDoc"],
388
  description: "Construct the documentation for the configuration file"
389
) {
390
  inputs.files fileTree(dir: "${projectDir}/tools/featureKeys")
391
  outputs.files fileTree(dir: "${buildDir}/userdoc/src/featureKeys")
392
  classpath = configurations.preprocessor
393
  main = "net.sf.saxon.Transform"
394
  args "${projectDir}/tools/featureKeys/AdditionalFeatures.xml",
395
    "-xsl:${projectDir}/tools/featureKeys/ToConfigFileDoc.xsl",
396
    "-o:${buildDir}/userdoc/src/featureKeys/ConfigFileDoc.xml"
397
}
398

    
399
task gen_doc_icu_uca(
400
  type: JavaExec,
401
  dependsOn: ["copy_userdoc_sources"],
402
  description: "Generate the ICU/UCA documentation"
403
) {
404
  inputs.files fileTree(dir: "${projectDir}/src/userdoc")
405
  inputs.files fileTree(dir: "${projectDir}/tools/docs/userdoc")
406
  outputs.files fileTree(dir: "${buildDir}/userdoc/src/extensibility")
407
  classpath = configurations.documentation
408
  main = "com.saxonica.Transform"
409
  args "-it:go",
410
    "-s:${projectDir}/src/userdoc/catalog.xml",
411
    "-xsl:${projectDir}/tools/docs/userdoc/document-ICU.xsl",
412
    "output=${buildDir}/userdoc/src/extensibility/"
413
}
414

    
415
task gen_xslt_element_reference_preprocess(
416
  type: JavaExec,
417
  dependsOn: ["copy_userdoc_sources"],
418
  description: "Preprocess input for the XSLT Element reference documentation"
419
) {
420
  inputs.files fileTree(dir: "${projectDir}/src/userdoc/elements")
421
  inputs.files fileTree(dir: "${projectDir}/tools/docs/userdoc")
422
  outputs.file "${buildDir}/userdoc/tmp/xsl-elements-expanded.xml"
423
  classpath = configurations.documentation
424
  main = "com.saxonica.Transform"
425
  args "-s:${projectDir}/src/userdoc/elements/xsl-elements.xml",
426
    "-o:${buildDir}/userdoc/tmp/xsl-elements-expanded.xml",
427
    "-xsl:${projectDir}/tools/docs/userdoc/genElementDoc.xsl"
428
}
429

    
430
task gen_xslt_element_reference(
431
  type: JavaExec,
432
  dependsOn: ["gen_xslt_element_reference_preprocess"],
433
  description: "Generate the XSLT Element reference documentation"
434
) {
435
  inputs.file "${buildDir}/userdoc/tmp/xsl-elements-expanded.xml" 
436
  inputs.files fileTree(dir: "${projectDir}/tools/docs/userdoc")
437
  outputs.file "${buildDir}/userdoc/src/xsl-elements.xml"
438
  classpath = configurations.documentation
439
  main = "com.saxonica.Transform"
440
  args "-s:${buildDir}/userdoc/tmp/xsl-elements-expanded.xml",
441
    "-xsl:${projectDir}/tools/docs/userdoc/elements-body.xsl",
442
    "-o:${buildDir}/userdoc/src/xsl-elements.xml"
443
}
444

    
445
task element_doc() {
446
  // Just a place to hang dependencies
447
}
448

    
449
["instructions", "serialization-params"].each { target ->
450
  Task t = task "gen_element_doc_${target}"(
451
    type: JavaExec,
452
    description: "Expand element documentation for ${target}"
453
  ) {
454
    inputs.file "${projectDir}/src/userdoc/extensions/${target}.xml"
455
    inputs.files fileTree(dir: "${projectDir}/tools/docs/userdoc")
456
    outputs.file file("${buildDir}/userdoc/src/extensions/${target}.xml")
457
    classpath = configurations.documentation
458
    main = "com.saxonica.Transform"
459
    args "-s:${projectDir}/src/userdoc/extensions/${target}.xml",
460
      "-xsl:${projectDir}/tools/docs/userdoc/elements-body.xsl",
461
      "-o:${buildDir}/userdoc/src/extensions/${target}.xml"
462
  }
463
  element_doc.dependsOn t
464
}  
465

    
466
// Different from preceding because it doesn't go in extensions ¯\_(ツ)_/¯
467
["sql-extension"].each { target ->
468
  Task t = task "gen_element_doc_${target}"(
469
    type: JavaExec,
470
    description: "Expand element documentation for ${target}"
471
  ) {
472
    inputs.file "${projectDir}/src/userdoc/extensions/${target}.xml"
473
    inputs.files fileTree(dir: "${projectDir}/tools/docs/userdoc")
474
    outputs.file "${buildDir}/userdoc/src/${target}.xml"
475
    classpath = configurations.documentation
476
    main = "com.saxonica.Transform"
477
    args "-s:${projectDir}/src/userdoc/extensions/${target}.xml",
478
      "-xsl:${projectDir}/tools/docs/userdoc/elements-body.xsl",
479
      "-o:${buildDir}/userdoc/src/${target}.xml"
480
  }
481
  element_doc.dependsOn t
482
}  
483

    
484
task expath_doc() {
485
  // Just a place to hang dependencies
486
}
487
["binary", "archive", "file"].each { target ->
488
  Task t = task "expath_doc_${target}"(
489
    type: JavaExec,
490
    dependsOn: ["clone_expath_cg"],
491
    description: "Expand EXPath documentation for ${target}"
492
  ) {
493
    inputs.file "${projectDir}/src/userdoc/functions/EXPath/functions-${target}.xml"
494
    inputs.files fileTree(dir: "${projectDir}/tools/docs/userdoc")
495
    outputs.file "${buildDir}/userdoc/src/functions/EXPath/functions-${target}.xml"
496
    classpath = configurations.documentation
497
    main = "com.saxonica.Transform"
498
    args "-xi:on",
499
      "-s:${projectDir}/src/userdoc/functions/EXPath/functions-${target}.xml",
500
      "-xsl:${projectDir}/tools/docs/userdoc/genFunctionDoc.xsl",
501
      "-o:${buildDir}/userdoc/src/functions/EXPath/functions-${target}.xml",
502
      "GitHub=${projectDir}/build"
503
  }
504
  expath_doc.dependsOn t
505
}
506

    
507
task expand_userdoc_sections(
508
  type: JavaExec,
509
  dependsOn: ["gen_doc"],
510
  description: "Expand documentation sections from inclusions for app"
511
) {
512
  inputs.file "${buildDir}/userdoc/src/catalog.xml"
513
  inputs.files fileTree(dir: "${buildDir}/userdoc/src")
514
  inputs.files fileTree(dir: "${projectDir}/tools/docs/userdoc")
515
  outputs.file "${buildDir}/userdoc/expanded/catalog.xml"
516
  classpath = configurations.documentation
517
  main = "com.saxonica.Transform"
518
  args "-xi:on",
519
    "-s:${buildDir}/userdoc/src/catalog.xml",
520
    "-xsl:${projectDir}/tools/docs/userdoc/doc-include.xsl",
521
    "-o:${buildDir}/userdoc/expanded/catalog.xml",
522
    "output-uri=${buildDir}/userdoc/expanded/"
523
}
524

    
525
task userdoc_changes(
526
  type: JavaExec,
527
  dependsOn: ["expand_userdoc_sections"],
528
  description: "Preprocess the changes.xml file to turn it into a standard article"
529
) {
530
  inputs.file "${buildDir}/userdoc/expanded/changes.xml"
531
  inputs.files fileTree(dir: "${projectDir}/tools/docs/to-static")
532
  outputs.file "${buildDir}/userdoc/expanded/changes-article.xml"
533
  classpath = configurations.documentation
534
  main = "com.saxonica.Transform"
535
  args "-s:${buildDir}/userdoc/expanded/changes.xml",
536
    "-xsl:${projectDir}/tools/docs/to-static/c-changes.xsl",
537
    "-o:${buildDir}/userdoc/expanded/changes-article.xml"
538
}
539

    
540
task userdoc_functions(
541
  type: JavaExec,
542
  dependsOn: ["expand_userdoc_sections"],
543
  description: "Preprocess the functions.xml file to turn it into a standard article"
544
) {
545
  inputs.file "${buildDir}/userdoc/expanded/functions.xml"
546
  inputs.files fileTree(dir: "${projectDir}/tools/docs/to-static")
547
  outputs.file "${buildDir}/userdoc/expanded/functions-article.xml"
548
  classpath = configurations.documentation
549
  main = "com.saxonica.Transform"
550
  args "-s:${buildDir}/userdoc/expanded/functions.xml",
551
    "-xsl:${projectDir}/tools/docs/to-static/c-functions.xsl",
552
    "-o:${buildDir}/userdoc/expanded/functions-article.xml"
553
}
554

    
555
// ============================================================
556

    
557
task viewer_app_sef(
558
  type: JavaExec,
559
  description: "Compile the viewer_app stylesheet"
560
) {
561
  inputs.files fileTree(dir: "${projectDir}/src/viewer_appJS/xsl")
562
  outputs.file "${buildDir}/userdoc/viewer_appJS/xsl/viewer_app.sef.json"
563
  classpath = configurations.documentation
564
  main = "com.saxonica.Transform"
565
  args "-xsl:${projectDir}/src/viewer_appJS/xsl/viewer_app.xsl",
566
    "-export:${buildDir}/userdoc/viewer_appJS/xsl/viewer_app.sef.json",
567
    "-target:JS", "-nogo", "-relocate:on", "-ns:##html5",
568
    "--generateByteCode:off",
569
    "SEFbuildDate=${DSTAMP}"
570
}
571

    
572
// ============================================================
573

    
574
task userdoc_html(
575
  dependsOn: ["userdoc_articles"],
576
  description: "Creates the static HTML version of the user documentation"
577
) {
578
  // Just a place to hang dependencies
579
}
580

    
581
task userdoc_articles(
582
  type: JavaExec,
583
  dependsOn: ["expand_userdoc_sections", "app_javadoc", "app_dotnetdoc",
584
              "userdoc_changes", "userdoc_functions"],
585
  description: "Process all the articles"
586
) {
587
  inputs.files fileTree(dir: "${buildDir}/userdoc/expanded")
588
  inputs.files fileTree(dir: "${projectDir}/tools/docs/to-static")
589
  outputs.files fileTree(dir: "${buildDir}/userdoc/html")
590
  classpath = configurations.documentation
591
  main = "com.saxonica.Transform"
592
  args "-s:${buildDir}/userdoc/expanded/catalog.xml",
593
    "-xsl:${projectDir}/tools/docs/to-static/s-viewer_app.xsl",
594
    "-o:${buildDir}/userdoc/html/dummy.xml",
595
    "changes-article=${buildDir}/userdoc/expanded/changes-article.xml",
596
    "functions-article=${buildDir}/userdoc/expanded/functions-article.xml",
597
    "base-uri=${buildDir}/userdoc/html/"
598
}
599

    
600
task userdoc_publish_viewer_appJS(
601
  type: Copy,
602
  description: "Copy viewer_appJS to build"
603
) {
604
  into "${buildDir}/userdoc/viewer_appJS"
605
  from ("${projectDir}/src/viewer_appJS") {
606
    exclude "readme.txt"
607
  }
608
}
609

    
610
task userdoc_viewer_appJS(
611
  type: Copy,
612
  dependsOn: ["userdoc_articles", "userdoc_publish_viewer_appJS", "viewer_app_sef"],
613
  description: "Copy transformed articles to app docs"
614
) {
615
  into "${buildDir}/userdoc/viewer_appJS/doc"
616
  from ("build/userdoc/expanded") {
617
    include "*.xml"
618
    exclude "functions-article.xml"
619
    exclude "changes-article.xml"
620
  }
621
}
622

    
623
task userdoc_publish_javadoc_html(
624
  type: Copy,
625
  dependsOn: ["userdoc_html", "product_javadoc"],
626
  description: "Copy dotnet docs into HTML output"
627
) {
628
  into "${buildDir}/userdoc/html/javadoc"
629
  from "build/javadoc"
630
  doFirst {
631
    mkdir "${buildDir}/userdoc/html/javadoc"
632
  }
633
}
634

    
635
task userdoc_publish_html_images(
636
  type: Copy,
637
  description: "Copy viewer_appJS images to the html output directory"
638
) {
639
  into "${buildDir}/userdoc/html/image"
640
  from "${projectDir}/src/viewer_appJS/image"
641
}
642

    
643
task userdoc_publish_html_style(
644
  type: Copy,
645
  description: "Copy viewer_appJS CSS to the html output directory"
646
) {
647
  into "${buildDir}/userdoc/html"
648
  from "${projectDir}/src/viewer_appJS/viewer_app.css"
649
  filter { line ->
650
    line.contains("url('saxon-base.css')")
651
            ? line.replace("saxon-base.css", "../../saxon-base.css")
652
            : line
653
  }
654
}
655

    
656
task userdoc_publish_html(
657
  type: Copy,
658
  dependsOn: ["userdoc_publish_javadoc_html", "dotnet_doc_html",
659
              "userdoc_publish_html_style", "userdoc_publish_html_images"],
660
  description: "Publish the HTML documentation"
661
) {
662
  into "${buildDir}/userdoc/html/dotnetdoc"
663
  from "build/dotnetdoc-html"
664
  doFirst {
665
    mkdir "${buildDir}/userdoc/html/dotnetdoc"
666
  }
667
}
668

    
669
// ============================================================
670

    
671
task update_documentation(
672
  dependsOn: ["copy_xml_documentation", "copy_html_documentation"],
673
  description: "Update documentation from viewer app"
674
) {
675
  // Just a place to hang dependencies
676
}
677

    
678
task copy_xml_documentation(
679
  type: Copy,
680
  dependsOn: ["userdoc_viewer_appJS"],
681
  description: "Update XML version of documentation from viewer app"
682
) {
683
  into "${buildDir}/website/documentation"
684
  from "${buildDir}/userdoc/viewer_appJS"
685
}
686

    
687
task copy_html_documentation(
688
  type: Copy,
689
  dependsOn: ["userdoc_publish_html"],
690
  description: "Update HTML version of user documentation"
691
) {
692
  into "${buildDir}/website/html/documentation"
693
  from "${buildDir}/userdoc/html"
694
}
695

    
696
// ============================================================
697

    
698
task gen_contents_ref(
699
  type: JavaExec,
700
  dependsOn: ["copy_xml_documentation"],
701
  description: "Creates the contents reference file for the user documentation (used for website pages)"
702
) {
703
  inputs.file "${buildDir}/website/documentation/doc/catalog.xml"
704
  inputs.file "${projectDir}/tools/docs/userdoc/contents-builder.xsl"
705
  outputs.file "${buildDir}/website/documentation/contents.xml"
706
  classpath = configurations.documentation
707
  main = "com.saxonica.Transform"
708
  args "${buildDir}/website/documentation/doc/catalog.xml",
709
    "-xsl:${projectDir}/tools/docs/userdoc/contents-builder.xsl",
710
    "-o:${buildDir}/website/documentation/contents.xml",
711
    "version-number=${saxonMajorVersion}"
712
}
713

    
714
task gen_feature_matrix(
715
        type: JavaExec,
716
        description: "Creates the base feature matrix file for the website"
717
) {
718
  inputs.file "${projectDir}/tools/docs/feature-matrix/feature-matrix.xml"
719
  inputs.file "${projectDir}/tools/docs/feature-matrix/feature-matrix-to-overview-chart.xsl"
720
  outputs.file "${buildDir}/website/products/feature-matrix-${saxonMajorVersion}.xml"
721
  classpath = configurations.documentation
722
  main = "com.saxonica.Transform"
723
  args "${projectDir}/tools/docs/feature-matrix/feature-matrix.xml",
724
          "-xsl:${projectDir}/tools/docs/feature-matrix/feature-matrix-to-overview-chart.xsl",
725
          "-o:${buildDir}/website/products/feature-matrix-${saxonMajorVersion}.xml"
726
}
727

    
728
task gen_prod_desc(
729
        type: JavaExec,
730
        description: "Creates the base product description file"
731
) {
732
  inputs.file "${projectDir}/tools/docs/feature-matrix/feature-matrix.xml"
733
  inputs.file "${projectDir}/tools/docs/feature-matrix/feature-matrix-to-prod-desc.xsl"
734
  outputs.file "${buildDir}/proddesc/prod-desc.xml"
735
  classpath = configurations.documentation
736
  main = "com.saxonica.Transform"
737
  args "${projectDir}/tools/docs/feature-matrix/feature-matrix.xml",
738
          "-xsl:${projectDir}/tools/docs/feature-matrix/feature-matrix-to-prod-desc.xsl",
739
          "-o:${buildDir}/proddesc/prod-desc.xml"
740
}
741

    
742
task gen_prod_desc_fo(
743
        type: JavaExec,
744
        dependsOn: ["gen_prod_desc"],
745
        description: "Creates the FO and HTML versions of the product descriptions"
746
) {
747
  inputs.file "${buildDir}/proddesc/prod-desc.xml"
748
  inputs.file "${projectDir}/tools/docs/feature-matrix/PD/prod-desc-to-fo.xsl"
749
  outputs.file "${buildDir}/proddesc/PD/dummy.xml"
750
  classpath = configurations.documentation
751
  main = "com.saxonica.Transform"
752
  args "${buildDir}/proddesc/prod-desc.xml",
753
          "-xsl:${projectDir}/tools/docs/feature-matrix/PD/prod-desc-to-fo.xsl",
754
          "-o:${buildDir}/proddesc/PD/dummy.xml"
755
}
756

    
757
// TODO Next step to generate the PDFs never worked in Ant, we had to do it manually.
758
// Open each build/proddesc/PD/fo/*.fo document in Oxygen and run from there:
759
// run Apply Configuration Scenario FO PDF (default)
760
// The generated PDFs should then be copied to build/website/products/PD${saxonMajorVersion}/
(6-6/14)