Skip to content

Commit d84d64f

Browse files
committed
Add asciidoctor task
Issue gh-613
1 parent c6eda0f commit d84d64f

File tree

3 files changed

+41
-2
lines changed

3 files changed

+41
-2
lines changed

build.gradle

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ buildscript {
1212
}
1313
dependencies {
1414
classpath "com.github.ben-manes:gradle-versions-plugin:0.17.0"
15-
classpath('org.asciidoctor:asciidoctor-gradle-plugin:1.5.1')
1615
classpath("io.spring.gradle:spring-io-plugin:0.0.6.RELEASE")
1716
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.12.0"
1817
classpath 'org.hidetake:gradle-ssh-plugin:2.10.1'
@@ -28,4 +27,24 @@ description = "Spring LDAP"
2827
nohttp {
2928
allowlistFile = project.file("etc/nohttp/allowlist.lines")
3029
source.exclude "buildSrc/build/**"
30+
}
31+
32+
asciidoctor {
33+
outputDir = new File("$buildDir/docs")
34+
attributes([
35+
copycss : '',
36+
icons : 'font',
37+
'source-highlighter': 'prettify',
38+
sectanchors : '',
39+
toc2: '',
40+
idprefix: '',
41+
idseparator: '-',
42+
doctype: 'book',
43+
numbered: '',
44+
'spring-ldap-version' : project.version,
45+
revnumber : project.version
46+
])
47+
options = [
48+
eruby: 'erubis'
49+
]
3150
}

buildSrc/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ dependencies {
9191
implementation 'io.spring.javaformat:spring-javaformat-gradle-plugin:0.0.15'
9292
implementation 'io.spring.nohttp:nohttp-gradle:0.0.10'
9393
implementation 'net.sourceforge.htmlunit:htmlunit:2.37.0'
94+
implementation 'org.asciidoctor:asciidoctor-gradle-jvm:3.3.2'
9495
implementation 'org.hidetake:gradle-ssh-plugin:2.10.1'
9596
implementation 'org.jfrog.buildinfo:build-info-extractor-gradle:4.26.1'
9697
implementation 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.7.1'

buildSrc/src/main/groovy/io/spring/gradle/convention/DocsPlugin.groovy

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package io.spring.gradle.convention
22

3+
import org.gradle.api.Action
34
import org.gradle.api.Plugin
45
import org.gradle.api.Project
56
import org.gradle.api.Task
7+
import org.gradle.api.artifacts.dsl.RepositoryHandler
68
import org.gradle.api.plugins.BasePlugin
79
import org.gradle.api.plugins.PluginManager
810
import org.gradle.api.tasks.bundling.Zip
@@ -17,17 +19,34 @@ public class DocsPlugin implements Plugin<Project> {
1719

1820
PluginManager pluginManager = project.getPluginManager();
1921
pluginManager.apply(BasePlugin);
22+
pluginManager.apply("org.asciidoctor.jvm.convert");
2023
pluginManager.apply(DeployDocsPlugin);
2124
pluginManager.apply(JavadocApiPlugin);
2225

26+
project.getGradle().afterProject(new Action<Project>() {
27+
@Override
28+
public void execute(Project p) {
29+
RepositoryHandler repositories = p.getRepositories();
30+
if (repositories.isEmpty()) {
31+
repositories.mavenCentral();
32+
repositories.maven(repo -> {
33+
repo.setUrl(URI.create("https://repo.spring.io/release"));
34+
});
35+
}
36+
}
37+
});
38+
2339
Task docsZip = project.tasks.create('docsZip', Zip) {
2440
dependsOn 'api'
2541
group = 'Distribution'
2642
archiveBaseName = project.rootProject.name
2743
archiveClassifier = 'docs'
2844
description = "Builds -${archiveClassifier.get()} archive containing all " +
2945
"Docs for deployment at docs.spring.io"
30-
46+
from(project.tasks.asciidoctor.outputs) {
47+
into 'reference'
48+
include '**'
49+
}
3150
from(project.tasks.api.outputs) {
3251
into 'api'
3352
}

0 commit comments

Comments
 (0)