Skip to content

Commit 51d0ea8

Browse files
author
Jay Bryant
committed
Added a PDF task and updated docsZip
I added a separate task for PDF generation, so that we can get good code formatting in the PDF. I also updated the docsZip task to pick up both the PDF output and the CSS and JS files (and images, if we ever have images in this project) that the HTML output needs.
1 parent 6906b00 commit 51d0ea8

File tree

1 file changed

+28
-24
lines changed

1 file changed

+28
-24
lines changed

build.gradle

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,27 @@ sonarqube {
117117
}
118118
}
119119

120+
task('makePDF', type: org.asciidoctor.gradle.AsciidoctorTask){
121+
dependsOn prepareAsciidocBuild
122+
backends 'pdf'
123+
sourceDir "$buildDir/asciidoc/assemble"
124+
outputDir = new File("$buildDir/docs")
125+
sources {
126+
include 'index.adoc'
127+
}
128+
options doctype: 'book', eruby: 'erubis'
129+
logDocuments = true
130+
attributes 'docinfo': 'shared',
131+
'icons': 'font',
132+
'sectanchors': '',
133+
'source-highlighter' : 'coderay',
134+
'spring-ldap-version' : project.version,
135+
revnumber : project.version
136+
}
137+
120138
asciidoctor {
121-
dependsOn prepareAsciidocBuild
122-
backends 'html5', 'pdf'
139+
dependsOn makePDF
140+
backends 'html5'
123141
sourceDir "$buildDir/asciidoc/assemble"
124142
outputDir = new File("$buildDir/docs")
125143
sources {
@@ -142,30 +160,11 @@ asciidoctor {
142160
// use provided highlighter
143161
'source-highlighter=highlight.js',
144162
'highlightjsdir=js/highlight',
145-
'highlightjs-theme=atom-one-dark-reasonable'
163+
'highlightjs-theme=atom-one-dark-reasonable',
164+
'spring-ldap-version' : project.version,
165+
revnumber : project.version
146166
}
147167

148-
149-
/* asciidoctor {
150-
outputDir = new File("$buildDir/docs")
151-
options = [
152-
eruby: 'erubis',
153-
attributes: [
154-
copycss : '',
155-
icons : 'font',
156-
'source-highlighter': 'prettify',
157-
sectanchors : '',
158-
toc2: '',
159-
idprefix: '',
160-
idseparator: '-',
161-
doctype: 'book',
162-
numbered: '',
163-
'spring-ldap-version' : project.version,
164-
revnumber : project.version
165-
]
166-
]
167-
} */
168-
169168
task api(type: Javadoc) {
170169
group = "Documentation"
171170
description = "Generates aggregated Javadoc API documentation."
@@ -201,6 +200,11 @@ task docsZip(type: Zip, dependsOn: asciidoctor) {
201200

202201
from (new File(asciidoctor.outputDir, "html5")) {
203202
include "*.html"
203+
include 'images/*', 'css/**', 'js/**'
204+
into "reference"
205+
}
206+
from (new File(asciidoctor.outputDir, "pdf")) {
207+
include "*.pdf"
204208
into "reference"
205209
}
206210
}

0 commit comments

Comments
 (0)