From 5df8c3bc807ab72f222b88b0d2e0cd14290fd4a7 Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Tue, 2 Sep 2014 17:09:16 +0200 Subject: [PATCH] DATAREDIS-336 - Polished Asciidoctor setup. Simplified tasks into single asciidoctor task. Wipe out expandPlaceholders to avoid needing the hack to in turn avoid the issue with file expansion. Removed obsolete baseDir prefix from index.adoc. Original pull request: #94. --- build.gradle | 69 ++++++++++++++++------------------------- src/asciidoc/index.adoc | 20 ++++++------ 2 files changed, 36 insertions(+), 53 deletions(-) diff --git a/build.gradle b/build.gradle index 62b5240f8..89d42389a 100644 --- a/build.gradle +++ b/build.gradle @@ -135,11 +135,34 @@ javadoc { } reference { - sourceDir = file("$buildDir/asciidoc/docbook") + // Avoid copy with expansions + expandPlaceholders = ''; } referencePdf { - sourceDir = file("$buildDir/asciidoc/docbook") + dependsOn = [ 'asciidoctor' ] + sourceDir = asciidoctor.outputDir +} + +asciidoctor { + dependsOn = [ 'extractSharedResources' ] + backends = [ 'html5', 'docbook' ] + options = [ + doctype: 'book', + eruby: 'erubis', + attributes: [ + linkcss: true, + copycss : "$buildDir/shared-resources/asciidoc/spring.css", + icons : 'font', + 'source-highlighter': 'prettify', + sectanchors : true, + toclevels: '3', + sectids: false, + numbered: true, + version: project.version, + stylesheet: "spring.css", + ] + ] } bundlor { @@ -175,7 +198,7 @@ task javadocJar(type: Jar) { from javadoc } -task docsZip(type: Zip, dependsOn:['generateDocbook', 'generateHTML', 'referencePdf' ]) { +task docsZip(type: Zip, dependsOn:['asciidoctor', 'referencePdf' ]) { group = 'Distribution' classifier = 'docs' @@ -284,46 +307,6 @@ task wrapper(type: Wrapper) { gradleVersion = '1.11' } -tasks.withType(org.asciidoctor.gradle.AsciidoctorTask) { docTask -> - options = [ - logDocuments: true, - doctype: 'book', - attributes: [ - linkcss: true, - copycss : "$buildDir/shared-resources/asciidoc/spring.css", - stylesheet: 'spring.css', - icons : 'font', - 'source-highlighter': 'prettify', - toclevels: '4', - idprefix: '', - idseparator: '-', - sectanchors : true, - version: project.version, - baseDir: "$sourceDir", - resourcesDir: "$rootDir/src/main/resources", - referenceDir: "$sourceDir/reference" - ] - ] - - dependsOn = [ 'extractSharedResources','createEmptyDocbookSourceDirToCheatThePlugin' ] -} - -task generateHTML (type: org.asciidoctor.gradle.AsciidoctorTask, description: 'Generates single and multiple HTML documentation.', group: 'Documentation') { - backends = [ 'html5' ] - outputDir = new File("$buildDir/reference/html") -} - -task generateDocbook (type: org.asciidoctor.gradle.AsciidoctorTask, description: 'Generates DOCBOOK documentation.', group: 'Documentation') { - backends = [ 'docbook' ] - outputDir = new File("$buildDir/reference-work") - options.attributes.chunkedOutput = 'true' - options.attributes.stylesheet = 'chunked' -} - -task createEmptyDocbookSourceDirToCheatThePlugin << { - new File("$buildDir/asciidoc/docbook").mkdirs() -} - task extractSharedResources(type: Copy) { from { // use of closure defers evaluation until execution time diff --git a/src/asciidoc/index.adoc b/src/asciidoc/index.adoc index f36e972e1..ea749ad00 100644 --- a/src/asciidoc/index.adoc +++ b/src/asciidoc/index.adoc @@ -13,24 +13,24 @@ NOTE: Copies of this document may be made for your own use and for distribution toc::[] -include::{baseDir}/preface.adoc[] +include::preface.adoc[] [[introduction]] = Introduction :leveloffset: +1 -include::{baseDir}/introduction/introduction.adoc[] -include::{baseDir}/introduction/why-sdr.adoc[] -include::{baseDir}/introduction/requirements.adoc[] -include::{baseDir}/introduction/getting-started.adoc[] +include::introduction/introduction.adoc[] +include::introduction/why-sdr.adoc[] +include::introduction/requirements.adoc[] +include::introduction/getting-started.adoc[] :leveloffset: -1 [[reference]] = Reference Documentation :leveloffset: +1 -include::{baseDir}/reference/introduction.adoc[] -include::{baseDir}/reference/redis.adoc[] +include::reference/introduction.adoc[] +include::reference/redis.adoc[] :leveloffset: -1 [[appendixes]] @@ -38,6 +38,6 @@ include::{baseDir}/reference/redis.adoc[] :numbered!: :leveloffset: +1 -include::{baseDir}/appendix/introduction.adoc[] -include::{baseDir}/appendix/appendix-schema.adoc[] -include::{baseDir}/appendix/appendix-command-reference.adoc[] +include::appendix/introduction.adoc[] +include::appendix/appendix-schema.adoc[] +include::appendix/appendix-command-reference.adoc[]