This repository has been archived by the owner on Apr 5, 2022. It is now read-only.
/
build-docs.gradle
124 lines (105 loc) · 3.43 KB
/
build-docs.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*
* Tasks related to building the Spring XD documentation
*/
buildscript {
repositories {
maven { url "http://repo.spring.io/plugins-snapshot" }
jcenter()
}
dependencies {
classpath 'io.spring.gradle:docbook-reference-plugin:0.3.0'
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.0'
//classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.6' // asciidoctor pdf still has issues with callouts, etc. Still relying on docbook+pdf for now
}
}
def docsDir = rootProject.file('src/docs/asciidoc') // Will be default with newer asciidoctor plugin
project('documentation-toolchain') {
startScripts.enabled = false
description = 'Utilities for generating/verifying documentation'
dependencies {
compile project(':spring-xd-dirt')
testCompile project(':spring-xd-shell')
}
tasks['findMainClass'].enabled = false
task shellReferenceDoc(type: JavaExec) {
classpath = sourceSets.test.runtimeClasspath
main = 'org.springframework.xd.documentation.ShellReferenceDoc'
workingDir = rootProject.file('.')
args = [
"$docsDir/ShellReference.asciidoc"
]
}
task moduleOptionsReferenceDoc(type: JavaExec, dependsOn: ':spring-xd-dirt:build') {
classpath = sourceSets.main.runtimeClasspath
main = 'org.springframework.xd.documentation.ModuleOptionsReferenceDoc'
workingDir = rootProject.file('.')
args = [
"$docsDir/Sources.asciidoc",
"$docsDir/Processors.asciidoc",
"$docsDir/Sinks.asciidoc",
"$docsDir/Jobs.asciidoc",
"$docsDir/Counters-and-Gauges.asciidoc",
]
}
task checkDocsLinks(type: JavaExec, dependsOn: [compileJava, shellReferenceDoc, moduleOptionsReferenceDoc]) {
classpath = sourceSets.main.runtimeClasspath
main = 'org.springframework.xd.documentation.AsciidocLinkChecker'
args = [
"file:$docsDir/*.asciidoc"
]
}
}
apply plugin: org.asciidoctor.gradle.AsciidoctorPlugin
asciidoctor {
sourceDir file("$docsDir")
sourceDocumentNames = files("$docsDir/index.asciidoc") // Change in >= 1.5.1
outputDir file("$buildDir/html")
backends = ['html5', 'docbook']
logDocuments = true
options = [
doctype: 'book',
attributes: [
docinfo: '',
toc2: '',
'compat-mode': '',
imagesdir: '',
stylesdir: "stylesheets/",
stylesheet: 'golo.css',
appversion: "$version",
'source-highlighter': 'highlightjs'
]
]
}
asciidoctor.dependsOn ([':documentation-toolchain:checkDocsLinks', ':documentation-toolchain:shellReferenceDoc', ':documentation-toolchain:moduleOptionsReferenceDoc'])
apply plugin: DocbookReferencePlugin
reference {
sourceFileName = 'index.xml'
sourceDir = file("$buildDir/html")
pdfFilename = 'spring-xd-reference.pdf'
expandPlaceholders = ''
}
reference.dependsOn asciidoctor
task api(type: Javadoc) {
group = 'Documentation'
description = 'Generates aggregated Javadoc API documentation.'
title = "${rootProject.description} ${version} API"
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
options.author = true
options.header = rootProject.description
options.links(javadocLinks)
options.overview = 'src/api/overview.html'
source rootProject.javaProjects.collect { project ->
project.sourceSets.main.allJava
}
destinationDir = new File(buildDir, "api")
classpath = files(rootProject.javaProjects.collect { project ->
project.sourceSets.main.compileClasspath
})
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
}