From 2ac57443235238394d369aafbdb5fa01219aec3f Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 16 Dec 2019 09:03:40 +0000 Subject: [PATCH] Upgrade to Asciidoctor Gradle Plugin 2.4 This commit updates the build to use the latest version of the Asciidoctor Gradle Plugin. One significant new feature is that the plugin's tasks are now cacheable. Closes gh-24216 --- build.gradle | 13 +------------ gradle/docs.gradle | 32 +++++++++++++++++++++++++------- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/build.gradle b/build.gradle index f0e407dce1..b375eec539 100644 --- a/build.gradle +++ b/build.gradle @@ -1,15 +1,8 @@ -buildscript { - dependencies { - classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.16' - classpath 'io.spring.asciidoctor:spring-asciidoctor-extensions:0.1.3.RELEASE' - } -} - plugins { id 'io.spring.dependency-management' version '1.0.8.RELEASE' apply false id 'org.jetbrains.kotlin.jvm' version '1.3.61' apply false id 'org.jetbrains.dokka' version '0.9.18' apply false - id 'org.asciidoctor.convert' version '1.5.8' + id 'org.asciidoctor.jvm.convert' version '2.4.0' id 'io.spring.nohttp' version '0.0.4.RELEASE' id 'de.undercouch.download' version '4.0.0' id 'com.gradle.build-scan' version '3.1.1' @@ -413,10 +406,6 @@ configure(rootProject) { } } - dependencies { - asciidoctor("io.spring.asciidoctor:spring-asciidoctor-extensions:0.1.3.RELEASE") - } - publishing { publications { mavenJava(MavenPublication) { diff --git a/gradle/docs.gradle b/gradle/docs.gradle index fd83d77f5f..934015c261 100644 --- a/gradle/docs.gradle +++ b/gradle/docs.gradle @@ -1,3 +1,11 @@ +configurations { + asciidoctorExt +} + +dependencies { + asciidoctorExt("io.spring.asciidoctor:spring-asciidoctor-extensions:0.2.0.RELEASE") +} + /** * Produce Javadoc for all Spring Framework modules in "build/docs/javadoc" */ @@ -93,11 +101,21 @@ task extractDocResources(type: Copy, dependsOn: downloadResources) { into "$buildDir/docs/spring-docs-resources/" } +asciidoctorj { + modules { + pdf { + version '1.5.0-beta.8' + } + } +} + /** * Produce the Spring Framework Reference documentation * from "src/docs/asciidoc" into "build/asciidoc/html5" */ asciidoctor { + baseDirFollowsSourceDir() + configurations 'asciidoctorExt' sources { include '*.adoc' } @@ -106,13 +124,15 @@ asciidoctor { from(sourceDir) { include 'images/*', 'css/**', 'js/**' } - from "$buildDir/docs/spring-docs-resources/" + from extractDocResources } logDocuments = true - backends = ["html5"] - // only ouput PDF documentation for non-SNAPSHOT builds - if (!project.getVersion().toString().contains("BUILD-SNAPSHOT")) { - backends += "pdf" + outputOptions { + backends = ["html5"] + // only ouput PDF documentation for non-SNAPSHOT builds + if (!project.getVersion().toString().contains("BUILD-SNAPSHOT")) { + backends += "pdf" + } } options doctype: 'book', eruby: 'erubis' attributes([ @@ -132,8 +152,6 @@ asciidoctor { ]) } -asciidoctor.dependsOn extractDocResources - /** * Zip all docs (API and reference) into a single archive */