diff --git a/build.gradle b/build.gradle index b5af8f43bf..6e84dae1c2 100644 --- a/build.gradle +++ b/build.gradle @@ -4,17 +4,24 @@ buildscript { } dependencies { classpath("org.springframework.build.gradle:propdeps-plugin:0.0.7") - classpath('org.asciidoctor:asciidoctor-gradle-plugin:1.5.1') + classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.16' classpath("io.spring.gradle:spring-io-plugin:0.0.6.RELEASE") } } plugins { id "org.sonarqube" version "2.1-rc1" + id 'org.asciidoctor.convert' version '1.5.10' +} + +repositories { + maven { url 'https://repo.spring.io/plugins-release' } + mavenCentral() } apply plugin: 'org.asciidoctor.gradle.asciidoctor' +ext.docResourcesVersion = '0.2.1.RELEASE' ext.GRADLE_SCRIPT_DIR = "${rootProject.projectDir}/gradle" ext.JAVA_MODULE_SCRIPT = "${GRADLE_SCRIPT_DIR}/java-module.gradle" ext.MAVEN_DEPLOYMENT_SCRIPT = "${GRADLE_SCRIPT_DIR}/maven-deployment.gradle" @@ -69,6 +76,30 @@ configure(subprojects - coreModules) { tasks.findByPath("artifactoryPublish")?.enabled = false } +asciidoctorj { + version = '1.5.5' +} + +configurations { + docs +} + +dependencies { + docs "io.spring.docresources:spring-doc-resources:${docResourcesVersion}@zip" +} + +task prepareAsciidocBuild(type: Sync) { + dependsOn configurations.docs + // copy doc resources + from { + configurations.docs.collect { zipTree(it) } + } + // and doc sources + from "src/docs/asciidoc/" + // to a build directory of your choice + into "$buildDir/asciidoc/assemble" +} + description = "Spring LDAP" configurations.archives.artifacts.clear() @@ -86,24 +117,52 @@ 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 { - 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 - ] - ] + dependsOn makePDF + backends 'html5' + sourceDir "$buildDir/asciidoc/assemble" + outputDir = new File("$buildDir/docs") + sources { + include 'index.adoc' + } + resources { + from(sourceDir) { + include 'images/*', 'css/**', 'js/**' + } + } + options doctype: 'book', eruby: 'erubis' + logDocuments = true + attributes 'docinfo': 'shared', + // use provided stylesheet + stylesdir: "css/", + stylesheet: 'spring.css', + 'linkcss': true, + 'icons': 'font', + 'sectanchors': '', + // use provided highlighter + 'source-highlighter=highlight.js', + 'highlightjsdir=js/highlight', + 'highlightjs-theme=github', + 'spring-ldap-version' : project.version, + revnumber : project.version } task api(type: Javadoc) { @@ -141,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" } } diff --git a/src/docs/asciidoc/index.adoc b/src/docs/asciidoc/index.adoc index 15e30dfbbc..fc6bb36bc0 100644 --- a/src/docs/asciidoc/index.adoc +++ b/src/docs/asciidoc/index.adoc @@ -1,5 +1,7 @@ = Spring LDAP Reference -Mattias Hellborg Arthursson; Ulrik Sandberg; Eric Dalquist; Keith Barlow; Rob Winch +:toc: left +:toc-levels: 4 +Mattias Hellborg Arthursson; Ulrik Sandberg; Eric Dalquist; Keith Barlow; Rob Winch; Jay Bryant Spring LDAP makes it easier to build Spring-based applications that use the Lightweight Directory Access Protocol.