-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
build.gradle
203 lines (182 loc) · 6.84 KB
/
build.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
import org.asciidoctor.gradle.jvm.AsciidoctorJExtension
import org.asciidoctor.gradle.jvm.pdf.AsciidoctorPdfThemesExtension
import org.firebirdsql.documentation.asciidoc.AsciidocToDocbook
import org.firebirdsql.documentation.asciidoc.FbAsciidocHtmlTask
import org.firebirdsql.documentation.asciidoc.FbAsciidocPdfTask
import org.firebirdsql.documentation.docbook.DocbookFo
import org.firebirdsql.documentation.docbook.DocbookHtml
import org.firebirdsql.documentation.fop.FoTask
import org.firebirdsql.documentation.generic.XsltTask
plugins {
id 'org.firebirdsql.documentation'
// Version controlled through buildSrc/build.gradle
id 'org.asciidoctor.jvm.base'
id 'org.asciidoctor.jvm.pdf' apply false
}
repositories {
mavenCentral()
}
extensions.create(AsciidoctorPdfThemesExtension.NAME, AsciidoctorPdfThemesExtension, project)
extensions.getByType(AsciidoctorJExtension).modules.pdf.use()
pdfThemes {
local 'firebird', {
themeDir = file('src/theme/firebird-pdf')
themeName = 'firebird'
}
}
asciidoctorj {
// asciidoctorj 3.0.0 doesn't seem to work with asciidoctor-gradle-plugin 4.0.3
version = '2.5.13'
docExtensions file('doc-extension.groovy')
}
docConfig {
configRootDir.set(file('config'))
docRoot.set(file('src/docs'))
styleDir.set(file('src/docs/xsl'))
outputRoot.set(layout.buildDirectory.dir('docs'))
defaultBaseName.set('firebirddocs')
}
def asciidocHtml = tasks.register('asciidocHtml', FbAsciidocHtmlTask) {
group 'Documentation'
description 'Generate HTML documentation from asciidoc'
baseDirFollowsSourceFile()
executionMode = OUT_OF_PROCESS
attributes 'revnumber': false, 'stylesdir': file(stylesDir), 'stylesheet': 'firebird.css',
'docinfo': 'shared', 'docinfodir': file(stylesDir.file('docinfo'))
// TODO move definitions of images to copy to the task
resources {
from(stylesDir.file('docinfo')) {
include 'images/**/*'
}
}
doFirst {
languages.each { lang ->
resources lang, {
from(sourceDirProperty.file(lang)) {
include 'images/**/*'
}
}
}
}
jvm {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
jvmArgs "--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED", "--add-opens", "java.base/java.io=ALL-UNNAMED"
}
}
}
def asciidocPdf = tasks.register('asciidocPdf', FbAsciidocPdfTask) {
group 'Documentation'
description 'Generate PDF documentation from asciidoc'
baseDirFollowsSourceFile()
executionMode = OUT_OF_PROCESS
attributes 'revnumber': false, 'source-highlighter': 'rouge', 'media': 'screen', 'toc': 'macro', 'compress': '',
'icon-set': 'fas', 'pdf-fontsdir': "${file('src/theme/fonts')},GEM_FONTS_DIR"
theme 'firebird'
asciidoctorj {
modules {
pdf {
version '2.3.18'
}
}
}
jvm {
if (JavaVersion.current() > JavaVersion.VERSION_1_8) {
jvmArgs "--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED", "--add-opens", "java.base/java.io=ALL-UNNAMED"
}
}
}
def copyXsltNgCustomizations = tasks.register('copyXsltNgCustomizations', Copy) {
from 'src/docs/xsltng'
into layout.buildDirectory.dir('docs/asciidoc/docbook')
}
def copyDocbook5Css = tasks.register('copyDocbook5Css', Copy) {
from 'src/theme/docbook5/css'
into layout.buildDirectory.dir('docs/chunk/css')
}
def copyDocbook5Js = tasks.register('copyDocbook5Js', Copy) {
from 'src/theme/docbook5/js'
into layout.buildDirectory.dir('docs/chunk/js')
}
def asciidocDocbook = tasks.register('asciidocDocbook', AsciidocToDocbook) {
dependsOn copyXsltNgCustomizations, copyDocbook5Css, copyDocbook5Js
group 'Documentation'
description 'Generate Docbook from asciidoc'
baseDirFollowsSourceFile()
executionMode = OUT_OF_PROCESS
// TODO move definitions of images to copy to the task
// resources {
// from(stylesDir.file('docinfo')) {
// include 'images/**/*'
// }
// }
doFirst {
languages.each { lang ->
resources lang, {
from(sourceDirProperty.file(lang)) {
include 'images/**/*'
duplicatesStrategy DuplicatesStrategy.EXCLUDE
}
}
}
}
jvm {
if (JavaVersion.current() > JavaVersion.VERSION_1_8) {
jvmArgs "--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED", "--add-opens", "java.base/java.io=ALL-UNNAMED"
}
}
}
task docbookHtml(type: DocbookHtml, group: 'documentation') {
description 'Generate chunked HTML documentation'
stylesheetBaseName.set('html')
outputTypeName.set('html')
imageExcludes.addAll(
'*.txt',
'firebird_logo_400x400.png')
extraFilesToOutput.set(files('src/docs/firebirddocs.css'))
}
task docbookMonohtml(type: DocbookHtml, group: 'documentation') {
description 'Generate single file HTML documentation'
stylesheetBaseName.set('monohtml')
outputTypeName.set('monohtml')
imageExcludes.addAll(
'*.txt',
'firebird_logo_400x400.png')
extraFilesToOutput.set(files('src/docs/firebirddocs.css'))
}
def docbookFoTask = tasks.register('docbookFo', DocbookFo)
def docbookPdfTask = tasks.register('docbookPdf', FoTask)
docbookPdfTask.configure { fo2pdf ->
fo2pdf.group 'documentation'
fo2pdf.description 'Generate PDF documentation from FO file'
fo2pdf.inputFoFile.set(docbookFoTask.get().mainOutputFile)
fo2pdf.dependsOn docbookFoTask
}
docbookFoTask.configure { docbookFo ->
docbookFo.group 'documentation'
docbookFo.description 'Generate FO documentation'
docbookFo.stylesheetBaseName.set('fo')
docbookFo.outputTypeName.set('fo')
docbookFo.imageExcludes.addAll(
'*.txt',
'titleblackgill.gif',
'firebirdlogo.png',
'toc-*.png',
'top-*.png',
'prev-*.png',
'next-*.png')
docbookFo.configureWith(docbookPdfTask.get())
}
task "tt-fo"(type: XsltTask, group: "tools") {
description 'Generates fo/titlepage.templates.xsl from fo/titlepage.templates.xml'
inputFile.set(docConfig.styleDir.file('fo/titlepage.templates.xml'))
styleSheetUri.set('template/titlepage.xsl')
stylesheetBase.set('http://docbook.sourceforge.net/release/xsl/current/')
outputFile.set(docConfig.styleDir.file('fo/titlepage.templates.xsl'))
}
task "tt-html"(type: XsltTask, group: "tools") {
description 'Generates html/titlepage.templates.xsl from html/titlepage.templates.xml'
inputFile.set(docConfig.styleDir.file('html/titlepage.templates.xml'))
styleSheetUri.set('template/titlepage.xsl')
stylesheetBase.set('http://docbook.sourceforge.net/release/xsl/current/')
outputFile.set(docConfig.styleDir.file('html/titlepage.templates.xsl'))
}