Skip to content

Commit f6caf5b

Browse files
Jay Bryantartembilan
authored andcommitted
Update to the build file to modernize the docs
This commit throws out Docbook and gives us the modern look and feel for the docs. It uses Asciidoctor to generate the PDF. * Polishing for `build.gradle` in regards to asciidoc * Upgrade to the latest Asciidoc and its plugins * Combine Asciidoc backends into a single Gradle task * Fix issues with section levels, duplicated ids and project version in the docs * Remove obsolete files: not used by Asciidoc
1 parent 065c901 commit f6caf5b

File tree

6 files changed

+73
-752
lines changed

6 files changed

+73
-752
lines changed

build.gradle

Lines changed: 53 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ buildscript {
44
maven { url 'https://repo.spring.io/plugins-release' }
55
}
66
dependencies {
7-
classpath 'io.spring.gradle:docbook-reference-plugin:0.3.1'
8-
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.8'
7+
classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.16'
98
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
109
classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlinVersion"
1110
}
@@ -16,6 +15,7 @@ plugins {
1615
id 'base'
1716
id 'project-report'
1817
id 'idea'
18+
id 'org.asciidoctor.convert' version '1.5.9.2'
1919
}
2020

2121
description = 'Spring Kafka'
@@ -29,7 +29,7 @@ ext {
2929
linkScmUrl = 'https://github.com/spring-projects/spring-kafka'
3030
linkScmConnection = 'https://github.com/spring-projects/spring-kafka.git'
3131
linkScmDevConnection = '[email protected]:spring-projects/spring-kafka.git'
32-
32+
docResourcesVersion = '0.1.0.RELEASE'
3333
}
3434

3535
allprojects {
@@ -234,45 +234,58 @@ project ('spring-kafka-test') {
234234
}
235235
}
236236

237-
apply plugin: 'org.asciidoctor.convert'
237+
configurations {
238+
docs
239+
}
240+
241+
dependencies {
242+
docs "io.spring.docresources:spring-doc-resources:${docResourcesVersion}@zip"
243+
}
244+
245+
task prepareAsciidocBuild(type: Sync) {
246+
dependsOn configurations.docs
247+
from {
248+
configurations.docs.collect { zipTree(it) }
249+
}
250+
from 'src/reference/asciidoc/'
251+
into "$buildDir/asciidoc"
252+
}
238253

239254
asciidoctor {
240-
sourceDir = file("$docsDir")
255+
dependsOn 'prepareAsciidocBuild'
256+
sourceDir "$buildDir/asciidoc"
241257
sources {
242258
include 'index.adoc'
243259
}
244-
backends = ['html5', 'docbook']
245-
logDocuments = true
246-
options = [
247-
doctype: 'book',
248-
]
249-
attributes = [
250-
docinfo: '',
251-
toc2: '',
252-
'compat-mode': '',
253-
imagesdir: '',
254-
stylesdir: "stylesheets/",
255-
stylesheet: 'golo.css',
256-
'spring-kafka-version': "$version",
257-
'source-highlighter': 'highlightjs'
258-
]
260+
resources {
261+
from(sourceDir) {
262+
include 'images/*', 'css/*', 'js/**'
263+
}
264+
}
265+
backends = ['html5', 'pdf']
266+
options doctype: 'book', eruby: 'erubis'
267+
attributes 'icons': 'font',
268+
'idprefix': '',
269+
'idseparator': '-',
270+
docinfo: 'shared',
271+
sectanchors: '',
272+
sectnums: '',
273+
stylesdir: 'css/',
274+
stylesheet: 'spring.css',
275+
'linkcss': true,
276+
'source-highlighter=highlight.js',
277+
'highlightjsdir=js/highlight',
278+
'highlightjs-theme=atom-one-dark-reasonable',
279+
'project-version': project.version,
280+
'allow-uri-read': ''
259281
}
260282

261-
262-
apply plugin: DocbookReferencePlugin
263-
264-
reference {
265-
sourceFileName = 'index.xml'
266-
sourceDir = file("$buildDir/asciidoc/docbook")
267-
pdfFilename = 'spring-kafka-reference.pdf'
268-
expandPlaceholders = ''
283+
task reference(dependsOn: asciidoctor) {
284+
group = 'Documentation'
285+
description = 'Generate the reference documentation'
269286
}
270287

271-
reference.dependsOn asciidoctor
272-
273-
[asciidoctor, reference, referenceEpub, referenceHtmlMulti, referenceHtmlSingle, referencePdf].each {
274-
it.onlyIf { "$System.env.NO_REFERENCE_TASK" != 'true' || project.hasProperty('ignoreEnvToStopReference') }
275-
}
288+
reference.onlyIf { "$System.env.NO_REFERENCE_TASK" != 'true' || project.hasProperty('ignoreEnvToStopReference') }
276289

277290
sonarqube {
278291
properties {
@@ -305,7 +318,7 @@ task api(type: Javadoc) {
305318
destinationDir = new File(buildDir, "api")
306319
}
307320

308-
task docsZip(type: Zip) {
321+
task docsZip(type: Zip, dependsOn: [reference]) {
309322
group = 'Distribution'
310323
classifier = 'docs'
311324
description = "Builds -${classifier} archive containing api and reference " +
@@ -319,7 +332,12 @@ task docsZip(type: Zip) {
319332
into 'api'
320333
}
321334

322-
from (reference) {
335+
from ('build/asciidoc/html5') {
336+
into 'reference'
337+
}
338+
339+
from ('build/asciidoc/pdf') {
340+
include 'index.pdf'
323341
into 'reference'
324342
}
325343
}

src/reference/asciidoc/index-docinfo.xml

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/reference/asciidoc/index.adoc

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
[[spring-kafka-reference]]
22
= Spring for Apache Kafka
3-
:toc:
3+
:toc: left
4+
:toclevels: 4
5+
:numbered:
6+
:icons: font
7+
:hide-uri-scheme:
8+
Gary Russell; Artem Bilan; Biju Kunjummen; Jay Bryant
9+
10+
*{project-version}*
11+
12+
(C) 2016 - 2019 by Pivotal Software, Inc.
13+
14+
Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically.
415

516
== Preface
617

@@ -15,8 +26,7 @@ include::./whats-new.adoc[]
1526

1627
== Introduction
1728

18-
This first part of the reference documentation is a high-level overview of Spring for Apache Kafka and the underlying
19-
concepts and some code snippets that can help you get up and running as quickly as possible.
29+
This first part of the reference documentation is a high-level overview of Spring for Apache Kafka and the underlying concepts and some code snippets that can help you get up and running as quickly as possible.
2030

2131
include::quick-tour.adoc[]
2232

@@ -41,8 +51,7 @@ include::si-kafka.adoc[]
4151

4252
== Other Resources
4353

44-
In addition to this reference documentation, we recommend a number of other resources that may help you learn about
45-
Spring and Apache Kafka.
54+
In addition to this reference documentation, we recommend a number of other resources that may help you learn about Spring and Apache Kafka.
4655

4756
- https://kafka.apache.org/[Apache Kafka Project Home Page]
4857
- http://projects.spring.io/spring-kafka/[Spring for Apache Kafka Home Page]
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
[[preface]]
21
The Spring for Apache Kafka project applies core Spring concepts to the development of Kafka-based messaging solutions.
32
We provide a "`template`" as a high-level abstraction for sending messages.
43
We also provide support for Message-driven POJOs.

src/reference/asciidoc/quick-tour.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The following example shows how to do so with Maven:
1414
<dependency>
1515
<groupId>org.springframework.kafka</groupId>
1616
<artifactId>spring-kafka</artifactId>
17-
<version>{spring-kafka-version}</version>
17+
<version>{project-version}</version>
1818
</dependency>
1919
----
2020
====
@@ -24,20 +24,20 @@ The following example shows how to do so with Gradle:
2424
====
2525
[source,groovy,subs="+attributes"]
2626
----
27-
compile 'org.springframework.kafka:spring-kafka:{spring-kafka-version}'
27+
compile 'org.springframework.kafka:spring-kafka:{project-version}'
2828
----
2929
====
3030

3131
[[compatibility]]
32-
===== Compatibility
32+
==== Compatibility
3333

3434
This quick tour works with the following versions:
3535

3636
* Apache Kafka Clients 2.0.0
3737
* Spring Framework 5.1.x
3838
* Minimum Java version: 8
3939

40-
===== A Very, Very Quick Example
40+
==== A Very, Very Quick Example
4141

4242
As the following example shows, you can use plain Java to send and receive a message:
4343

@@ -122,7 +122,7 @@ private Map<String, Object> senderProps() {
122122
----
123123
====
124124

125-
===== With Java Configuration
125+
==== With Java Configuration
126126

127127
You can do the same work as appears in the previous example with Spring configuration in Java.
128128
The following example shows how to do so:
@@ -210,7 +210,7 @@ public class Listener {
210210
----
211211
====
212212

213-
===== Even Quicker, with Spring Boot
213+
==== Even Quicker, with Spring Boot
214214

215215
Spring Boot can make things even simpler.
216216
The following Spring Boot application sends three messages to a topic, receives them, and stops:

0 commit comments

Comments
 (0)