Project

Profile

Help

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

he / build-doc.gradle @ d61f99bb

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 product_javadoc(
26
  type: Javadoc,
27
  dependsOn: ["eej_sources"],
28
  description: "Generate Javadoc HTML files"
29
) {
30
  inputs.files fileTree(dir: "${projectDir}/src/eej")
31
  outputs.files fileTree(dir: "${buildDir}/javadoc")
32

    
33
  classpath = configurations.documentation
34
  source = new File("${buildDir}/src/eej")
35
  destinationDir= new File("${buildDir}/javadoc")
36
  // noindex="false" notree="false"
37
  // maxmemory="512M" source="1.8"
38
  // -includeNamespace
39
  options.addStringOption("Xdoclint:none", "-quiet")
40
  include "net/**"
41
  include "com/**"
42
  include "javax/**"
43
  exclude "com/saxonica/testdriver/**"
44
  exclude "net/sf/saxon/testdriver/**"
45
  exclude "**/dotnet/**"
46
  exclude "**/DotNetVerifier.java"
47
  exclude "**/*.html"
48
}
49

    
50
task product_jeljavadoc(
51
  type: Javadoc,
52
  dependsOn: ["eej_sources"],
53
  description: "Generate Javadoc XML files"
54
) {
55
  inputs.files fileTree(dir: "${projectDir}/src/eej")
56
  inputs.file "${projectDir}/lib/jeldoc.jar"
57
  outputs.files fileTree(dir: "${buildDir}/jeljavadoc")
58

    
59
  classpath = configurations.documentation
60
  source = new File("${buildDir}/src/eej")
61
  destinationDir= new File("${buildDir}/jeljavadoc")
62
  options.doclet = "com.jeldoclet.JELDoclet"
63
  options.docletpath = configurations.jeldoclet.files.asType(List)
64
  // noindex="false" notree="false"
65
  // maxmemory="512M" source="1.8"
66
  options.addStringOption("access", "package")
67
  options.addStringOption("filename", "jeldoclet-out.xml")
68
  options.addStringOption("outputEncoding", "utf-8")
69
  // -includeNamespace
70
  include "net/**"
71
  include "com/**"
72
  include "javax/**"
73
  exclude "com/saxonica/testdriver/**"
74
  exclude "net/sf/saxon/testdriver/**"
75
  exclude "**/dotnet/**"
76
  exclude "**/DotNetVerifier.java"
77
  exclude "**/*.html"
78
}
79

    
80
task product_xsljavadoc(
81
  type: JavaExec,
82
  dependsOn: ["product_jeljavadoc"],
83
  description: "Convert javadoc XML into format for documentation"
84
) {
85
  inputs.files fileTree(dir: "${buildDir}/jeljavadoc")
86
  inputs.file "${projectDir}/tools/docs/javadoc/chunk-javadoc.xsl"
87
  outputs.files fileTree(dir: "${buildDir}/javadoc-xml")
88
  classpath = configurations.documentation
89
  main = "com.saxonica.Transform"
90
  args "-s:${buildDir}/jeljavadoc/jeldoclet-out.xml",
91
    "-xsl:${projectDir}/tools/docs/javadoc/chunk-javadoc.xsl",
92
    "-o:${buildDir}/javadoc-xml/out",
93
    "base-output=${buildDir}/javadoc-xml/"
94
}
95

    
96
task javadoc_linkchecker(
97
  type: JavaExec,
98
  dependsOn: ["product_xsljavadoc"],
99
  description: "Generate report of links"
100
) {
101
  inputs.files fileTree(dir: "${buildDir}/javadoc-xml")
102
  inputs.file "${projectDir}/tools/docs/javadoc/check-tag-links.xsl"
103
  outputs.file "${buildDir}/javadoc-tag-check.xml"
104
  classpath = configurations.documentation
105
  main = "com.saxonica.Transform"
106
  args "-s:${buildDir}/javadoc-xml/javadoc-types.xml",
107
    "-xsl:${projectDir}/tools/docs/javadoc/check-tag-links.xsl",
108
    "-o:${buildDir}/javadoc-tag-check.xml"
109
}
110

    
111
task dotnet_doc_parsecs(
112
  type: JavaExec,
113
  dependsOn: ["een_csharpApi"],
114
  description: "Parse dotnet cs files for docs"
115
) {
116
  inputs.files fileTree(dir: "${buildDir}/n/csharp/api/Saxon.Api")
117
  inputs.file "${projectDir}/tools/docs/dotnet/parsecs.xsl"
118
  outputs.file "${buildDir}/dotnetdoc/names.xml"
119
  classpath = configurations.documentation
120
  main = "com.saxonica.Transform"
121
  args "-it:main",
122
    "-s:${projectDir}/tools/docs/dotnet/parsecs.xsl",
123
    "-xsl:${projectDir}/tools/docs/dotnet/parsecs.xsl",
124
    "-o:${buildDir}/dotnetdoc/names.xml",
125
    "inputdir=${buildDir}/n/csharp/api/Saxon.Api"
126
}
127

    
128
task dotnet_doc_merge(
129
  type: JavaExec,
130
  dependsOn: ["dotnet_doc_parsecs"],
131
  description: "Merge API docs for dotnet"
132
) {
133
  inputs.file "${buildDir}/dotnetdoc/names.xml"
134
  inputs.file "${buildDir}/n/saxon-ee-api-${saxonVersion}.xml"
135
  inputs.file "${projectDir}/tools/docs/dotnet/merge.xsl"
136
  outputs.file "${buildDir}/dotnetdoc/merged.xml"
137
  classpath = configurations.documentation
138
  main = "com.saxonica.Transform"
139
  args "-it:main",
140
    "-s:${buildDir}/dotnetdoc/names.xml",
141
    "-xsl:${projectDir}/tools/docs/dotnet/merge.xsl",
142
    "-o:${buildDir}/dotnetdoc/merged.xml",
143
    "names-file=${buildDir}/dotnetdoc/names.xml",
144
    "api-doc-file=${buildDir}/n/saxon-ee-api-${saxonVersion}.xml"
145
}
146

    
147
task dotnet_doc_css(
148
  type: Copy,
149
  description: "Copies the CSS for dotnet docs"
150
) {
151
  into "${buildDir}/dotnetdoc-html"
152
  from "${projectDir}/tools/docs/dotnet/saxon-dotnetdoc.css"
153
}
154

    
155
task dotnet_doc_html(
156
  type: JavaExec,
157
  dependsOn: ["dotnet_doc_merge", "dotnet_doc_css"],
158
  description: "Create HTML output for dotnet docs"
159
) {
160
  inputs.file "${buildDir}/dotnetdoc/merged.xml"
161
  inputs.file "${projectDir}/tools/docs/dotnet/tohtml.xsl"
162
  outputs.file "${buildDir}/dotnetdoc-html/index.html"
163
  classpath = configurations.documentation
164
  main = "com.saxonica.Transform"
165
  args "-s:${buildDir}/dotnetdoc/merged.xml",
166
    "-xsl:${projectDir}/tools/docs/dotnet/tohtml.xsl",
167
    "-o:${buildDir}/dotnetdoc-html/index.html"
168
}
169

    
170
task dotnet_doc_jel(
171
  type: JavaExec,
172
  dependsOn: ["dotnet_doc_merge"],
173
  description: "Create HTML output for dotnet docs"
174
) {
175
  inputs.file "${buildDir}/dotnetdoc/merged.xml"
176
  inputs.file "${projectDir}/tools/docs/dotnet/convert-to-jel-package.xsl"
177
  outputs.file "${buildDir}/dotnetdoc-xml/packages/Saxon.Api.xml"
178
  classpath = configurations.documentation
179
  main = "com.saxonica.Transform"
180
  args "-s:${buildDir}/dotnetdoc/merged.xml",
181
    "-xsl:${projectDir}/tools/docs/dotnet/convert-to-jel-package.xsl",
182
    "-o:${buildDir}/dotnetdoc-xml/packages/Saxon.Api.xml"
183
}
184

    
185
task app_dotnetdoc(
186
  type: Copy,
187
  dependsOn: ["dotnet_doc_jel"],
188
  description: "Copy the XML dotnet docs to the viewer app"
189
) {
190
  into "${buildDir}/userdoc/viewer_appJS/dotnetdoc-xml"
191
  from "${buildDir}/dotnetdoc-xml"
192
}
193

    
194
task app_javadoc(
195
  type: Copy,
196
  dependsOn: ["product_xsljavadoc"],
197
  description: "Copy the XML javadoc docs to the viewer app"
198
) {
199
  into "${buildDir}/userdoc/viewer_appJS/javadoc-xml"
200
  from "${buildDir}/javadoc-xml"
201
}
202

    
203
task resources_dotnetdoc(
204
  dependsOn: ["resources_dotnetdoc_css", "resources_dotnetdoc_apidoc"],
205
  description: "Copy dotnet files into the resources folder"
206
) {
207
  // nop
208
}
209

    
210
task resources_dotnetdoc_css(
211
  type: Copy,
212
  dependsOn: ["dotnet_doc_jel"],
213
  description: "Copy the dotnet CSS into the resources folder"
214
) {
215
  into "${buildDir}/resources/doc/dotnetdoc"
216
  from ("${projectDir}/tools/docs/dotnet") {
217
    include "saxon-dotnetdoc.css"
218
  }
219
}
220

    
221
task resources_dotnetdoc_apidoc(
222
  type: Copy,
223
  dependsOn: ["dotnet_doc_jel"],
224
  description: "Copy the dotnet API docs into the resources folder"
225
) {
226
  into "${buildDir}/resources/doc/dotnetdoc"
227
  from ("${buildDir}/n") {
228
    include "saxon-ee-api-${saxonVersion}.xml"
229
    rename("saxon-ee-api-${saxonVersion}.xml", "apidoc.xml")
230
  }
231
}
232

    
233
// ============================================================
234

    
235
task gen_doc(
236
  dependsOn: ["gen_doc_icu_uca", "gen_xslt_element_reference",
237
              "gen_xslt_element_reference", "element_doc", "expath_doc",
238
              "doc_FeatureKeysDoc", "doc_ConfigFileDoc"],
239
  description: "Collects up, generates and copies the documentation source into the canonical location"
240
) {
241
  // Just a place to hang dependencies
242
}  
243

    
244
task copy_userdoc_sources(
245
  type: Copy,
246
  dependsOn: ["copy_userdoc_implement"],
247
  description: "Copy the 'real', unpreprocessed sources"
248
) {
249
  into "${buildDir}/userdoc/src"
250
  from ("${projectDir}/src/userdoc") {
251
    // Excluded files are transformed by other tasks into "src" for the docbuild
252
    exclude "extensions/**"
253
  }
254
}
255

    
256
task copy_userdoc_implement(
257
  type: Copy,
258
  description: "Copy the app implement file"
259
) {
260
  from "${projectDir}/src/viewer_appJS/doc"
261
  into "${buildDir}/userdoc/src"
262
}
263

    
264
task doc_FeatureKeysDoc(
265
  type: JavaExec,
266
  dependsOn: ["copy_userdoc_sources"],
267
  description: "Construct the documentation for feature keys"
268
) {
269
  inputs.files fileTree(dir: "${projectDir}/tools/featureKeys")
270
  outputs.file "${buildDir}/userdoc/src/featureKeys/FeatureKeysDoc.xml"
271
  classpath = configurations.preprocessor
272
  main = "net.sf.saxon.Transform"
273
  args "${projectDir}/tools/featureKeys/FeatureKeys.xml",
274
    "-xsl:${projectDir}/tools/featureKeys/FeatureKeysToDoc.xsl",
275
    "-o:${buildDir}/userdoc/src/featureKeys/FeatureKeysDoc.xml"
276
}
277

    
278
task doc_ConfigFileDoc(
279
  type: JavaExec,
280
  dependsOn: ["copy_userdoc_sources", "doc_FeatureKeysDoc"],
281
  description: "Construct the documentation for the configuration file"
282
) {
283
  inputs.files fileTree(dir: "${projectDir}/tools/featureKeys")
284
  outputs.files fileTree(dir: "${buildDir}/userdoc/src/featureKeys")
285
  classpath = configurations.preprocessor
286
  main = "net.sf.saxon.Transform"
287
  args "${projectDir}/tools/featureKeys/AdditionalFeatures.xml",
288
    "-xsl:${projectDir}/tools/featureKeys/ToConfigFileDoc.xsl",
289
    "-o:${buildDir}/userdoc/src/featureKeys/ConfigFileDoc.xml"
290
}
291

    
292
task gen_doc_icu_uca(
293
  type: JavaExec,
294
  dependsOn: ["copy_userdoc_sources"],
295
  description: "Generate the ICU/UCA documentation"
296
) {
297
  inputs.files fileTree(dir: "${projectDir}/src/userdoc")
298
  inputs.files fileTree(dir: "${projectDir}/tools/docs/userdoc")
299
  outputs.files fileTree(dir: "${buildDir}/userdoc/src/extensibility")
300
  classpath = configurations.documentation
301
  main = "com.saxonica.Transform"
302
  args "-it:go",
303
    "-s:${projectDir}/src/userdoc/catalog.xml",
304
    "-xsl:${projectDir}/tools/docs/userdoc/document-ICU.xsl",
305
    "output=${buildDir}/userdoc/src/extensibility/"
306
}
307

    
308
task gen_xslt_element_reference_preprocess(
309
  type: JavaExec,
310
  dependsOn: ["copy_userdoc_sources"],
311
  description: "Preprocess input for the XSLT Element reference documentation"
312
) {
313
  inputs.files fileTree(dir: "${projectDir}/src/userdoc/elements")
314
  inputs.files fileTree(dir: "${projectDir}/tools/docs/userdoc")
315
  outputs.file "${buildDir}/userdoc/tmp/xsl-elements-expanded.xml"
316
  classpath = configurations.documentation
317
  main = "com.saxonica.Transform"
318
  args "-s:${projectDir}/src/userdoc/elements/xsl-elements.xml",
319
    "-o:${buildDir}/userdoc/tmp/xsl-elements-expanded.xml",
320
    "-xsl:${projectDir}/tools/docs/userdoc/genElementDoc.xsl"
321
}
322

    
323
task gen_xslt_element_reference(
324
  type: JavaExec,
325
  dependsOn: ["gen_xslt_element_reference_preprocess"],
326
  description: "Generate the XSLT Element reference documentation"
327
) {
328
  inputs.file "${buildDir}/userdoc/tmp/xsl-elements-expanded.xml" 
329
  inputs.files fileTree(dir: "${projectDir}/tools/docs/userdoc")
330
  outputs.file "${buildDir}/userdoc/src/xsl-elements.xml"
331
  classpath = configurations.documentation
332
  main = "com.saxonica.Transform"
333
  args "-s:${buildDir}/userdoc/tmp/xsl-elements-expanded.xml",
334
    "-xsl:${projectDir}/tools/docs/userdoc/elements-body.xsl",
335
    "-o:${buildDir}/userdoc/src/xsl-elements.xml"
336
}
337

    
338
task element_doc() {
339
  // Just a place to hang dependencies
340
}
341

    
342
["instructions", "serialization-params"].each { target ->
343
  Task t = task "gen_element_doc_${target}"(
344
    type: JavaExec,
345
    description: "Expand element documentation for ${target}"
346
  ) {
347
    inputs.file "${projectDir}/src/userdoc/extensions/${target}.xml"
348
    inputs.files fileTree(dir: "${projectDir}/tools/docs/userdoc")
349
    outputs.file file("${buildDir}/userdoc/src/extensions/${target}.xml")
350
    classpath = configurations.documentation
351
    main = "com.saxonica.Transform"
352
    args "-s:${projectDir}/src/userdoc/extensions/${target}.xml",
353
      "-xsl:${projectDir}/tools/docs/userdoc/elements-body.xsl",
354
      "-o:${buildDir}/userdoc/src/extensions/${target}.xml"
355
  }
356
  element_doc.dependsOn t
357
}  
358

    
359
// Different from preceding because it doesn't go in extensions ¯\_(ツ)_/¯
360
["sql-extension"].each { target ->
361
  Task t = task "gen_element_doc_${target}"(
362
    type: JavaExec,
363
    description: "Expand element documentation for ${target}"
364
  ) {
365
    inputs.file "${projectDir}/src/userdoc/extensions/${target}.xml"
366
    inputs.files fileTree(dir: "${projectDir}/tools/docs/userdoc")
367
    outputs.file "${buildDir}/userdoc/src/${target}.xml"
368
    classpath = configurations.documentation
369
    main = "com.saxonica.Transform"
370
    args "-s:${projectDir}/src/userdoc/extensions/${target}.xml",
371
      "-xsl:${projectDir}/tools/docs/userdoc/elements-body.xsl",
372
      "-o:${buildDir}/userdoc/src/${target}.xml"
373
  }
374
  element_doc.dependsOn t
375
}  
376

    
377
task expath_doc() {
378
  // Just a place to hang dependencies
379
}
380
["binary", "archive", "file"].each { target ->
381
  Task t = task "expath_doc_${target}"(
382
    type: JavaExec,
383
    dependsOn: ["clone_expath_cg"],
384
    description: "Expand EXPath documentation for ${target}"
385
  ) {
386
    inputs.file "${projectDir}/src/userdoc/functions/EXPath/functions-${target}.xml"
387
    inputs.files fileTree(dir: "${projectDir}/tools/docs/userdoc")
388
    outputs.file "${buildDir}/userdoc/src/functions/EXPath/functions-${target}.xml"
389
    classpath = configurations.documentation
390
    main = "com.saxonica.Transform"
391
    args "-xi:on",
392
      "-s:${projectDir}/src/userdoc/functions/EXPath/functions-${target}.xml",
393
      "-xsl:${projectDir}/tools/docs/userdoc/genFunctionDoc.xsl",
394
      "-o:${buildDir}/userdoc/src/functions/EXPath/functions-${target}.xml",
395
      "GitHub=${projectDir}/build"
396
  }
397
  expath_doc.dependsOn t
398
}
399

    
400
task gen_expand_doc_sections_for_app(
401
  type: JavaExec,
402
  dependsOn: ["gen_doc", "copy_changes_dir"],
403
  description: "Expand documentation sections from inclusions for app"
404
) {
405
  inputs.file "${buildDir}/userdoc/src/catalog.xml"
406
  inputs.files fileTree(dir: "${projectDir}/tools/docs/userdoc")
407
  outputs.file "${buildDir}/userdoc/expanded/catalog.xml"
408
  classpath = configurations.documentation
409
  main = "com.saxonica.Transform"
410
  args "-xi:on",
411
    "-s:${buildDir}/userdoc/src/catalog.xml",
412
    "-xsl:${projectDir}/tools/docs/userdoc/doc-include.xsl",
413
    "-o:${buildDir}/userdoc/expanded/catalog.xml",
414
    "output-uri=${buildDir}/userdoc/expanded/"
415
}
416

    
417
task copy_changes_dir(
418
  type: Copy,
419
  description: "Copy the change logs to build hierarchy"
420
) {
421
  into "${buildDir}/userdoc/src/changes"
422
  from "${projectDir}/src/userdoc/changes"
423
  doFirst {
424
    mkdir "${buildDir}/userdoc/src/changes"
425
  }
426
}
427

    
428
task userdoc_changes(
429
  type: JavaExec,
430
  dependsOn: ["gen_expand_doc_sections_for_app"],
431
  description: "Preprocess the changes.xml file to turn it into a standard article"
432
) {
433
  inputs.file "${buildDir}/userdoc/expanded/changes.xml"
434
  inputs.files fileTree(dir: "${projectDir}/tools/docs/to-static")
435
  outputs.file "${buildDir}/userdoc/expanded/changes-article.xml"
436
  classpath = configurations.documentation
437
  main = "com.saxonica.Transform"
438
  args "-s:${buildDir}/userdoc/expanded/changes.xml",
439
    "-xsl:${projectDir}/tools/docs/to-static/c-changes.xsl",
440
    "-o:${buildDir}/userdoc/expanded/changes-article.xml"
441
}
442

    
443
task userdoc_functions(
444
  type: JavaExec,
445
  dependsOn: ["gen_expand_doc_sections_for_app"],
446
  description: "Preprocess the functions.xml file to turn it into a standard article"
447
) {
448
  inputs.file "${buildDir}/userdoc/expanded/functions.xml"
449
  inputs.files fileTree(dir: "${projectDir}/tools/docs/to-static")
450
  outputs.file "${buildDir}/userdoc/expanded/functions-article.xml"
451
  classpath = configurations.documentation
452
  main = "com.saxonica.Transform"
453
  args "-s:${buildDir}/userdoc/expanded/functions.xml",
454
    "-xsl:${projectDir}/tools/docs/to-static/c-functions.xsl",
455
    "-o:${buildDir}/userdoc/expanded/functions-article.xml"
456
}
457

    
458
// ============================================================
459

    
460
task viewer_app_sef(
461
  type: JavaExec,
462
  description: "Compile the viewer_app"
463
) {
464
  inputs.files fileTree(dir: "${projectDir}/src/viewer_appJS/xsl")
465
  outputs.file "${buildDir}/viewer_app/xsl/viewer_app.sef.json"
466
  classpath = configurations.documentation
467
  main = "com.saxonica.Transform"
468
  args "-xsl:${projectDir}/src/viewer_appJS/xsl/viewer_app.xsl",
469
    "-export:${buildDir}/viewer_app/xsl/viewer_app.sef.json",
470
    "-target:JS", "-nogo", "-relocate:on", "-ns:##html5",
471
    "--generateByteCode:off",
472
    "SEFbuildDate=${DSTAMP}"
473
}
474

    
475
// ============================================================
476

    
477
task userdoc_html(
478
  dependsOn: ["userdoc_articles"],
479
  description: "Creates the static HTML version of the user documentation"
480
) {
481
  // Just a place to hang dependencies
482
}
483

    
484
task userdoc_articles(
485
  type: JavaExec,
486
  dependsOn: ["gen_expand_doc_sections_for_app", "app_javadoc", "app_dotnetdoc",
487
              "userdoc_changes", "userdoc_functions"],
488
  description: "Process all the articles"
489
) {
490
  inputs.files fileTree(dir: "${buildDir}/userdoc/expanded")
491
  inputs.files fileTree(dir: "${projectDir}/tools/docs/to-static")
492
  outputs.files fileTree(dir: "${buildDir}/userdoc/html")
493
  classpath = configurations.documentation
494
  main = "com.saxonica.Transform"
495
  args "-s:${buildDir}/userdoc/expanded/catalog.xml",
496
    "-xsl:${projectDir}/tools/docs/to-static/s-viewer_app.xsl",
497
    "-o:${buildDir}/userdoc/html/dummy.xml",
498
    "changes-article=${buildDir}/userdoc/expanded/changes-article.xml",
499
    "functions-article=${buildDir}/userdoc/expanded/functions-article.xml",
500
    "base-uri=${buildDir}/userdoc/html/"
501
}
502

    
503
task userdoc_publish_viewer_appJS(
504
  type: Copy,
505
  description: "Copy viewer_appJS to build"
506
) {
507
  into "${buildDir}/userdoc/viewer_appJS"
508
  from ("${projectDir}/src/viewer_appJS") {
509
    exclude "readme.txt"
510
  }
511
}
512

    
513
task userdoc_viewer_appJS(
514
  type: Copy,
515
  dependsOn: ["userdoc_articles", "userdoc_publish_viewer_appJS"],
516
  description: "Copy transformed articles to app docs"
517
) {
518
  into "${buildDir}/userdoc/viewer_appJS/doc"
519
  from ("build/userdoc/expanded") {
520
    include "*.xml"
521
    exclude "functions-article.xml"
522
    exclude "changes-article.xml"
523
  }
524
}
525

    
526
task userdoc_publish_javadoc_html(
527
  type: Copy,
528
  dependsOn: ["userdoc_html", "product_javadoc"],
529
  description: "Copy dotnet docs into HTML output"
530
) {
531
  into "${buildDir}/userdoc/html/javadoc"
532
  from "build/javadoc"
533
  doFirst {
534
    mkdir "${buildDir}/userdoc/html/javadoc"
535
  }
536
}
537

    
538
task userdoc_publish_html_images(
539
  type: Copy,
540
  description: "Copy viewer_appJS images to the html output directory"
541
) {
542
  into "${buildDir}/userdoc/html/image"
543
  from "${projectDir}/src/viewer_appJS/image"
544
}
545

    
546
task userdoc_publish_html_style(
547
  type: Copy,
548
  description: "Copy viewer_appJS CSS to the html output directory"
549
) {
550
  into "${buildDir}/userdoc/html"
551
  from "${projectDir}/src/viewer_appJS/viewer_app.css"
552
  filter { line ->
553
    line.contains("url('saxon-base.css')")
554
            ? line.replace("saxon-base.css", "../../saxon-base.css")
555
            : line
556
  }
557
}
558

    
559
task userdoc_publish_html(
560
  type: Copy,
561
  dependsOn: ["userdoc_publish_javadoc_html", "dotnet_doc_html",
562
              "userdoc_publish_html_style", "userdoc_publish_html_images"],
563
  description: "Publish the HTML documentation"
564
) {
565
  into "${buildDir}/userdoc/html/dotnetdoc"
566
  from "build/dotnetdoc-html"
567
  doFirst {
568
    mkdir "${buildDir}/userdoc/html/dotnetdoc"
569
  }
570
}
571

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

    
574
task update_documentation(
575
  dependsOn: ["copy_xml_documentation", "copy_html_documentation"],
576
  description: "Update documentation from viewer app"
577
) {
578
  // Just a place to hang dependencies
579
}
580

    
581
task copy_xml_documentation(
582
  type: Copy,
583
  dependsOn: ["userdoc_viewer_appJS"],
584
  description: "Update XML version of documentation from viewer app"
585
) {
586
  into "${buildDir}/website/documentation"
587
  from "${buildDir}/userdoc/viewer_appJS"
588
}
589

    
590
task copy_html_documentation(
591
  type: Copy,
592
  dependsOn: ["userdoc_publish_html"],
593
  description: "Update HTML version of user documentation"
594
) {
595
  into "${buildDir}/website/html/documentation"
596
  from "${buildDir}/userdoc/html"
597
}
598

    
599
// ============================================================
600

    
601
task gen_contents_ref(
602
  type: JavaExec,
603
  dependsOn: ["copy_xml_documentation"],
604
  description: "Creates the contents reference file for the user documentation (used for website pages)"
605
) {
606
  inputs.file "${buildDir}/website/documentation/doc/catalog.xml"
607
  inputs.file "${projectDir}/tools/docs/userdoc/contents-builder.xsl"
608
  outputs.file "${buildDir}/website/documentation/contents.xml"
609
  classpath = configurations.documentation
610
  main = "com.saxonica.Transform"
611
  args "${buildDir}/website/documentation/doc/catalog.xml",
612
    "-xsl:${projectDir}/tools/docs/userdoc/contents-builder.xsl",
613
    "-o:${buildDir}/website/documentation/contents.xml",
614
    "version-number=${saxonMajorVersion}"
615
}
616

    
617
task gen_feature_matrix(
618
        type: JavaExec,
619
        description: "Creates the base feature matrix file for the website"
620
) {
621
  inputs.file "${projectDir}/tools/docs/feature-matrix/feature-matrix.xml"
622
  inputs.file "${projectDir}/tools/docs/feature-matrix/feature-matrix-to-overview-chart.xsl"
623
  outputs.file "${buildDir}/website/products/feature-matrix-${saxonMajorVersion}.xml"
624
  classpath = configurations.documentation
625
  main = "com.saxonica.Transform"
626
  args "${projectDir}/tools/docs/feature-matrix/feature-matrix.xml",
627
          "-xsl:${projectDir}/tools/docs/feature-matrix/feature-matrix-to-overview-chart.xsl",
628
          "-o:${buildDir}/website/products/feature-matrix-${saxonMajorVersion}.xml"
629
}
630

    
631
task gen_prod_desc(
632
        type: JavaExec,
633
        description: "Creates the base product description file"
634
) {
635
  inputs.file "${projectDir}/tools/docs/feature-matrix/feature-matrix.xml"
636
  inputs.file "${projectDir}/tools/docs/feature-matrix/feature-matrix-to-prod-desc.xsl"
637
  outputs.file "${buildDir}/proddesc/prod-desc.xml"
638
  classpath = configurations.documentation
639
  main = "com.saxonica.Transform"
640
  args "${projectDir}/tools/docs/feature-matrix/feature-matrix.xml",
641
          "-xsl:${projectDir}/tools/docs/feature-matrix/feature-matrix-to-prod-desc.xsl",
642
          "-o:${buildDir}/proddesc/prod-desc.xml"
643
}
644

    
645
task gen_prod_desc_fo(
646
        type: JavaExec,
647
        dependsOn: ["gen_prod_desc"],
648
        description: "Creates the FO and HTML versions of the product descriptions"
649
) {
650
  inputs.file "${buildDir}/proddesc/prod-desc.xml"
651
  inputs.file "${projectDir}/tools/docs/feature-matrix/PD/prod-desc-to-fo.xsl"
652
  outputs.file "${buildDir}/proddesc/PD/dummy.xml"
653
  classpath = configurations.documentation
654
  main = "com.saxonica.Transform"
655
  args "${buildDir}/proddesc/prod-desc.xml",
656
          "-xsl:${projectDir}/tools/docs/feature-matrix/PD/prod-desc-to-fo.xsl",
657
          "-o:${buildDir}/proddesc/PD/dummy.xml"
658
}
659

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