Skip to content

Commit eb6ddfe

Browse files
authored
Migrate to Antora Documentation
* Use `providers.provider` for `modifiedFiles`. This defers the looking up of `modifiedFiles` until it is used. It also allows other tasks to be ran from the non-primary work tree. Working in another work tree is essential for Antora which will clone each branch/tag into a new work tree to process it. * Migrate Structure * Insert explicit ids for headers * Fix image::image * Copy default antora files * Fix indentation for all pages * Split files * Generate a default navigation * Remove includes * Fix cross references * Enable Section Summary TOC for small pages * Polish nav.adoc * Fix duplicate ids * Escape {firstname} and {lastname} * Remove links to htmlsingle and pdf Formats * Fix broken links * Disable attributes for ${debezium-version} * Migrate to Asciidoctor Tabs * Move to src/reference/antora * Remove Asciidoctor Build * deploy-docs only spring-projects
1 parent f9dc75c commit eb6ddfe

File tree

319 files changed

+21512
-22487
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

319 files changed

+21512
-22487
lines changed

.github/workflows/deploy-docs.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Deploy Docs
2+
on:
3+
push:
4+
branches-ignore: [ gh-pages ]
5+
tags: '**'
6+
repository_dispatch:
7+
types: request-build-reference # legacy
8+
#schedule:
9+
#- cron: '0 10 * * *' # Once per day at 10am UTC
10+
workflow_dispatch:
11+
permissions:
12+
actions: write
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
if: github.repository_owner == 'spring-projects'
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v3
20+
with:
21+
ref: docs-build
22+
fetch-depth: 1
23+
- name: Dispatch (partial build)
24+
if: github.ref_type == 'branch'
25+
env:
26+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
run: gh workflow run deploy-docs.yml -r $(git rev-parse --abbrev-ref HEAD) -f build-refname=${{ github.ref_name }}
28+
- name: Dispatch (full build)
29+
if: github.ref_type == 'tag'
30+
env:
31+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
run: gh workflow run deploy-docs.yml -r $(git rev-parse --abbrev-ref HEAD)

.github/workflows/pr-build-workflow.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
debug: false
3737
concurrent: true
3838
gradle-build-scan-report: false
39-
arguments: checkAsciidocLinks check
39+
arguments: check
4040

4141
- name: Capture Test Results
4242
if: failure()

CONTRIBUTING.adoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ To build api Javadoc (results will be in `build/api`):
9696
./gradlew api
9797
----
9898

99-
To build the reference documentation (results will be in `build/docs/asciidoc` and `build/docs/asciidocPdf`):
99+
To build the reference documentation (results will be in `build/site`):
100100

101101
----
102-
./gradlew reference
102+
./gradlew antora
103103
----
104104

105105
To build complete distribution including `-dist`, `-docs`, and `-schema` zip files (results will be in `build/distributions`):

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Please see our [Security policy](https://github.com/spring-projects/spring-integ
5858

5959
# Documentation
6060

61-
The Spring Integration maintains reference documentation ([published](https://docs.spring.io/spring-integration/docs/current/reference/html/) and [source](src/reference/asciidoc)), GitHub [wiki pages](https://github.com/spring-projects/spring-integration/wiki), and an [API reference](https://docs.spring.io/spring-integration/docs/current/api/).
61+
The Spring Integration maintains reference documentation ([published](https://docs.spring.io/spring-integration/reference/) and [source](src/reference/antora)), GitHub [wiki pages](https://github.com/spring-projects/spring-integration/wiki), and an [API reference](https://docs.spring.io/spring-integration/docs/current/api/).
6262
There are also [guides and tutorials](https://spring.io/guides) across Spring projects.
6363

6464

@@ -90,9 +90,9 @@ To build api Javadoc (results will be in `build/api`):
9090

9191
./gradlew api
9292

93-
To build the reference documentation (results will be in `build/docs/asciidoc` and `build/docs/asciidocPdf`):
93+
To build the reference documentation (results will be in `build/site`):
9494

95-
./gradlew reference
95+
./gradlew antora
9696

9797
To build complete distribution including `-dist`, `-docs`, and `-schema` zip files (results will be in `build/distributions`):
9898

build.gradle

+8-17
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ buildscript {
1515
}
1616

1717
plugins {
18+
id 'base'
1819
id 'org.sonarqube' version '4.3.0.3225'
1920
id 'io.spring.nohttp' version '0.0.11' apply false
2021
id 'org.ajoberstar.grgit' version '4.1.1'
2122
id 'io.spring.dependency-management' version '1.1.2'
2223
id 'com.jfrog.artifactory' version '4.33.1' apply false
2324
id 'org.jetbrains.dokka' version "1.8.20"
24-
id 'org.asciidoctor.jvm.pdf' version '3.3.2'
25-
id 'org.asciidoctor.jvm.convert' version '3.3.2'
25+
id 'org.antora' version '1.0.0'
26+
id 'io.spring.antora.generate-antora-yml' version '0.0.1'
2627
}
2728

2829
if (isCI) {
@@ -44,8 +45,8 @@ ext {
4445
linkScmConnection = 'scm:git:git://github.com/spring-projects/spring-integration.git'
4546
linkScmDevConnection = 'scm:git:ssh://[email protected]:spring-projects/spring-integration.git'
4647

47-
modifiedFiles =
48-
files(grgit.status().unstaged.modified).filter { f -> f.name.endsWith('.java') || f.name.endsWith('.kt') }
48+
modifiedFiles = providers.provider {
49+
files(grgit.status().unstaged.modified).filter { f -> f.name.endsWith('.java') || f.name.endsWith('.kt') } }
4950

5051
apacheSshdVersion = '2.10.0'
5152
artemisVersion = '2.29.0'
@@ -289,7 +290,7 @@ configure(javaProjects) { subproject ->
289290

290291
task updateCopyrights {
291292
onlyIf { !isCI }
292-
inputs.files(modifiedFiles.filter { f -> f.path.contains(subproject.name) })
293+
inputs.files(modifiedFiles.map(files -> files.filter { f -> f.path.contains(subproject.name) }))
293294
outputs.dir('build/classes')
294295

295296
doLast {
@@ -337,7 +338,7 @@ configure(javaProjects) { subproject ->
337338
}
338339
}
339340

340-
task testAll(type: Test, dependsOn: [':checkAsciidocLinks', 'check'])
341+
task testAll(type: Test, dependsOn: ['check'])
341342

342343
gradle.taskGraph.whenReady { graph ->
343344
if (graph.hasTask(testAll)) {
@@ -1237,7 +1238,7 @@ task schemaZip(type: Zip) {
12371238
}
12381239
}
12391240

1240-
task docsZip(type: Zip, dependsOn: [reference, dokkaHtmlMultiModule]) {
1241+
task docsZip(type: Zip, dependsOn: [dokkaHtmlMultiModule]) {
12411242
group = 'Distribution'
12421243
archiveClassifier = 'docs'
12431244
description = "Builds -${archiveClassifier} archive containing api and reference " +
@@ -1251,16 +1252,6 @@ task docsZip(type: Zip, dependsOn: [reference, dokkaHtmlMultiModule]) {
12511252
into 'api'
12521253
}
12531254

1254-
from('build/docs/asciidoc') {
1255-
into 'reference/html'
1256-
}
1257-
1258-
from('build/docs/asciidocPdf') {
1259-
include 'index-single.pdf'
1260-
rename 'index-single.pdf', 'spring-integration-reference.pdf'
1261-
into 'reference/pdf'
1262-
}
1263-
12641255
from(dokkaHtmlMultiModule.outputDirectory) {
12651256
into 'kdoc-api'
12661257
}

gradle/docs.gradle

+32-120
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,46 @@
11
ext {
2-
backendVersion = '0.0.5'
32
micrometerDocsVersion='1.0.1'
43
}
54

5+
6+
antora {
7+
version = '3.2.0-alpha.2'
8+
playbook = file('src/reference/antora/antora-playbook.yml')
9+
options = ['to-dir' : project.layout.buildDirectory.dir('site').get().toString(), clean: true, fetch: !project.gradle.startParameter.offline, stacktrace: true]
10+
dependencies = [
11+
'@antora/atlas-extension': '1.0.0-alpha.1',
12+
'@antora/collector-extension': '1.0.0-alpha.3',
13+
'@asciidoctor/tabs': '1.0.0-beta.3',
14+
'@springio/antora-extensions': '1.4.2',
15+
'@springio/asciidoctor-extensions': '1.0.0-alpha.8',
16+
]
17+
}
18+
19+
tasks.named("generateAntoraYml") {
20+
asciidocAttributes = project.provider( {
21+
return ['project-version' : project.version ]
22+
} )
23+
baseAntoraYmlFile = file('src/reference/antora/antora.yml')
24+
}
25+
26+
tasks.create(name: 'createAntoraPartials', type: Sync) {
27+
from { tasks.filterMetricsDocsContent.outputs }
28+
into layout.buildDirectory.dir('generated-antora-resources/modules/ROOT/partials')
29+
}
30+
31+
tasks.create('generateAntoraResources') {
32+
dependsOn 'createAntoraPartials'
33+
dependsOn 'generateAntoraYml'
34+
}
35+
636
configurations {
7-
asciidoctorExtensions
837
micrometerDocs
938
}
1039

1140
dependencies {
12-
asciidoctorExtensions "io.spring.asciidoctor.backends:spring-asciidoctor-backends:$backendVersion"
1341
micrometerDocs "io.micrometer:micrometer-docs-generator:$micrometerDocsVersion"
1442
}
1543

16-
task checkAsciidocLinks {
17-
inputs.dir('src/reference/asciidoc')
18-
doLast {
19-
def errors = new ArrayList<>();
20-
errors.add('*** Anchor reference errors found:')
21-
inputs.files.filter{ f -> f.path.endsWith('.adoc') }.each { file ->
22-
def doc = file.text
23-
def anchors = new HashSet<>()
24-
def matcher = (doc =~ /\[\[([^]]+)]]/)
25-
while (matcher.find()) {
26-
anchors.add(matcher.group(1))
27-
}
28-
matcher = (doc =~ /<<([^>]+)>>/)
29-
while (matcher.find()) {
30-
def anchor = matcher.group(1);
31-
def hasComma = anchor.contains(',')
32-
if (!anchor.startsWith('./')) {
33-
if (hasComma) {
34-
anchor = anchor.substring(0, anchor.indexOf(","));
35-
}
36-
if (!anchors.contains(anchor)) {
37-
errors.add("\nAnchor '$anchor' not found in '${file.name}', " +
38-
"if in another file, it needs to be qualified with './fileName.adoc#'")
39-
}
40-
}
41-
else {
42-
if (!hasComma) {
43-
errors.add("\nExternal anchor '$anchor' in '${file.name}' should have a textual description (,...)")
44-
}
45-
}
46-
}
47-
}
48-
if (errors.size() > 1) {
49-
throw new InvalidUserDataException(errors.toString())
50-
}
51-
}
52-
}
53-
5444
def observationInputDir = file('spring-integration-core/src/main/java/org/springframework/integration/support/management/observation').absolutePath
5545
def generatedDocsDir = file("$buildDir/reference/generated").absolutePath
5646

@@ -69,82 +59,4 @@ task filterMetricsDocsContent(type: Copy) {
6959
into generatedDocsDir
7060
rename { filename -> filename.replace '_', '' }
7161
filter { line -> line.replaceAll('org.springframework.integration', 'o.s.i') }
72-
}
73-
74-
task prepareDocs(type: Copy) {
75-
dependsOn checkAsciidocLinks, filterMetricsDocsContent
76-
from 'src/reference/asciidoc'
77-
into "$buildDir/reference"
78-
}
79-
80-
asciidoctorPdf {
81-
dependsOn prepareDocs
82-
83-
forkOptions {
84-
jvmArgs '--add-opens', 'java.base/sun.nio.ch=ALL-UNNAMED', '--add-opens', 'java.base/java.io=ALL-UNNAMED'
85-
}
86-
87-
baseDirFollowsSourceFile()
88-
89-
asciidoctorj {
90-
sourceDir "$buildDir/reference"
91-
sources {
92-
include 'index-single.adoc'
93-
}
94-
options doctype: 'book'
95-
attributes 'icons': 'font',
96-
'sectanchors': '',
97-
'sectnums': '',
98-
'toc': '',
99-
'source-highlighter' : 'coderay',
100-
revnumber: project.version,
101-
'project-version': project.version
102-
}
103-
}
104-
105-
asciidoctor {
106-
dependsOn asciidoctorPdf
107-
108-
forkOptions {
109-
jvmArgs '--add-opens', 'java.base/sun.nio.ch=ALL-UNNAMED', '--add-opens', 'java.base/java.io=ALL-UNNAMED'
110-
}
111-
112-
baseDirFollowsSourceFile()
113-
114-
configurations 'asciidoctorExtensions'
115-
sourceDir "$buildDir/reference"
116-
outputOptions {
117-
backends 'spring-html'
118-
}
119-
resources {
120-
from(sourceDir) {
121-
include 'images/*', 'css/**', 'js/**'
122-
}
123-
}
124-
125-
options doctype: 'book', eruby: 'erubis'
126-
attributes 'docinfo': 'shared',
127-
stylesdir: 'css/',
128-
stylesheet: 'stylesheet.css',
129-
'linkcss': true,
130-
'copycss': false,
131-
'icons': 'font',
132-
'sectanchors': '',
133-
'source-highlighter': 'highlight.js',
134-
'highlightjsdir': 'js/highlight',
135-
'highlightjs-theme': 'github',
136-
'idprefix': '',
137-
'idseparator': '-',
138-
'allow-uri-read': '',
139-
'toc': 'left',
140-
'toclevels': '4',
141-
revnumber: project.version,
142-
'project-version': project.version
143-
}
144-
145-
task reference(dependsOn: asciidoctor) {
146-
group = 'Documentation'
147-
description = 'Generate the reference documentation'
148-
}
149-
150-
reference.onlyIf { 'true' != System.env['NO_REFERENCE_TASK'] || project.hasProperty('ignoreEnvToStopReference') }
62+
}
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# PACKAGES [email protected] @antora/atlas-extension:1.0.0-alpha.1 @antora/[email protected] @springio/[email protected] @asciidoctor/[email protected] @opendevise/[email protected]
2+
#
3+
# The purpose of this Antora playbook is to build the docs in the current branch.
4+
antora:
5+
extensions:
6+
- '@springio/antora-extensions/partial-build-extension'
7+
- require: '@springio/antora-extensions/latest-version-extension'
8+
- require: '@springio/antora-extensions/inject-collector-cache-config-extension'
9+
- '@antora/collector-extension'
10+
- '@antora/atlas-extension'
11+
- require: '@springio/antora-extensions/root-component-extension'
12+
root_component_name: 'integration'
13+
site:
14+
title: Spring Integration
15+
url: https://docs.spring.io/spring-integration/reference/
16+
content:
17+
sources:
18+
- url: ./../../..
19+
branches: HEAD
20+
worktrees: true
21+
start_path: src/reference/antora
22+
asciidoc:
23+
attributes:
24+
page-stackoverflow-url: https://stackoverflow.com/tags/spring-integration
25+
page-pagination: ''
26+
hide-uri-scheme: '@'
27+
tabs-sync-option: '@'
28+
chomp: 'all'
29+
extensions:
30+
- '@asciidoctor/tabs'
31+
- '@springio/asciidoctor-extensions'
32+
sourcemap: true
33+
urls:
34+
latest_version_segment: ''
35+
runtime:
36+
log:
37+
failure_level: warn
38+
format: pretty
39+
ui:
40+
bundle:
41+
url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.3.4/ui-bundle.zip

src/reference/antora/antora.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: integration
2+
version: true
3+
title: Spring Integration
4+
nav:
5+
- modules/ROOT/nav.adoc
6+
ext:
7+
collector:
8+
run:
9+
command: gradlew -q "-Dorg.gradle.jvmargs=-Xmx3g -XX:+HeapDumpOnOutOfMemoryError" :generateAntoraResources
10+
local: true
11+
scan:
12+
dir: build/generated-antora-resources
13+
14+
asciidoc:
15+
attributes:
16+
attribute-missing: 'warn'
17+
# FIXME: the copyright is not removed
18+
# FIXME: The package is not renamed
19+
chomp: 'all'
20+
snippets: example$docs-src/test/java/org/springframework/integration/docs

0 commit comments

Comments
 (0)