From 51d0ea8ee975d5a3d99fd00a99f91a530e1ff0cd Mon Sep 17 00:00:00 2001 From: Jay Bryant Date: Mon, 4 Mar 2019 11:56:40 -0600 Subject: [PATCH] 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. --- build.gradle | 52 ++++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/build.gradle b/build.gradle index 7d6f7ed2d5..34dd199c5c 100644 --- a/build.gradle +++ b/build.gradle @@ -117,9 +117,27 @@ sonarqube { } } +task('makePDF', type: org.asciidoctor.gradle.AsciidoctorTask){ +dependsOn prepareAsciidocBuild + backends 'pdf' + sourceDir "$buildDir/asciidoc/assemble" + outputDir = new File("$buildDir/docs") + sources { + include 'index.adoc' + } + options doctype: 'book', eruby: 'erubis' + logDocuments = true + attributes 'docinfo': 'shared', + 'icons': 'font', + 'sectanchors': '', + 'source-highlighter' : 'coderay', + 'spring-ldap-version' : project.version, + revnumber : project.version +} + asciidoctor { - dependsOn prepareAsciidocBuild - backends 'html5', 'pdf' + dependsOn makePDF + backends 'html5' sourceDir "$buildDir/asciidoc/assemble" outputDir = new File("$buildDir/docs") sources { @@ -142,30 +160,11 @@ asciidoctor { // use provided highlighter 'source-highlighter=highlight.js', 'highlightjsdir=js/highlight', - 'highlightjs-theme=atom-one-dark-reasonable' + 'highlightjs-theme=atom-one-dark-reasonable', + 'spring-ldap-version' : project.version, + revnumber : project.version } - -/* asciidoctor { - outputDir = new File("$buildDir/docs") - options = [ - eruby: 'erubis', - attributes: [ - copycss : '', - icons : 'font', - 'source-highlighter': 'prettify', - sectanchors : '', - toc2: '', - idprefix: '', - idseparator: '-', - doctype: 'book', - numbered: '', - 'spring-ldap-version' : project.version, - revnumber : project.version - ] - ] -} */ - task api(type: Javadoc) { group = "Documentation" description = "Generates aggregated Javadoc API documentation." @@ -201,6 +200,11 @@ task docsZip(type: Zip, dependsOn: asciidoctor) { from (new File(asciidoctor.outputDir, "html5")) { include "*.html" + include 'images/*', 'css/**', 'js/**' + into "reference" + } + from (new File(asciidoctor.outputDir, "pdf")) { + include "*.pdf" into "reference" } }