Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions docs/antora.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
name: 'ROOT'
version: '5.6.8'
prerelease: '-SNAPSHOT'
name: ROOT
version: true
title: Documentation
nav:
- modules/ROOT/nav.adoc
ext:
collector:
run:
command: gradlew -q -PbuildSrc.skipTests=true "-Dorg.gradle.jvmargs=-Xmx3g -XX:+HeapDumpOnOutOfMemoryError" :spring-security-docs:generateAntora
local: true
scan:
dir: ./build/generateAntora
3 changes: 2 additions & 1 deletion docs/local-antora-playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
antora:
extensions:
- ./antora-linked-worktree-patch.js
- '@antora/collector-extension'
site:
title: Spring Security
url: https://docs.spring.io/spring-security/reference
content:
sources:
- url: ./..
branches: HEAD
start_paths: [docs, 'docs/build/generateAntora*']
start_path: docs
worktrees: true
asciidoc:
attributes:
Expand Down
39 changes: 20 additions & 19 deletions docs/spring-security-docs.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugins {
id 'org.antora' version '1.0.0-alpha.3'
id 'org.springframework.antora.check-version'
}

apply plugin: 'io.spring.convention.docs'
Expand All @@ -15,10 +14,11 @@ antora {
'ALGOLIA_APP_ID': '244V8V9FGG',
'ALGOLIA_INDEX_NAME': 'security-docs'
]
dependencies = [
'@antora/collector-extension': '1.0.0-alpha.2'
]
}

tasks.antora.dependsOn 'generateAntora'

tasks.register('generateAntora') {
group = 'Documentation'
description = 'Generates the antora.yml for dynamic properties'
Expand All @@ -33,21 +33,22 @@ tasks.register('generateAntora') {
def securityReferenceUrl = "$securityDocsUrl/reference/html5/"
def springFrameworkApiUrl = "https://docs.spring.io/spring-framework/docs/$springFrameworkVersion/javadoc-api/"
def springFrameworkReferenceUrl = "https://docs.spring.io/spring-framework/docs/$springFrameworkVersion/reference/html/"
def versions = resolvedVersions(project.configurations.testRuntimeClasspath)
def ymlVersions = ''
versions.call().each { name, version ->
ymlVersions += """
${name}: ${version}"""
}
def outputFile = layout.buildDirectory.file('generateAntora/antora.yml').orNull.asFile
outputFile.getParentFile().mkdirs()
outputFile.createNewFile()
def antoraYmlText = file('antora.yml').text.trim()
outputFile.setText("""$antoraYmlText
title: Spring Security
start_page: ROOT:index.adoc
nav:
- modules/ROOT/nav.adoc
def ymlVersions = resolvedVersions(project.configurations.testRuntimeClasspath).call()
.collect(v -> " ${v.getKey()}: ${v.getValue()}")
.join('\n')
def outputFile = layout.buildDirectory.file('generateAntora/antora.yml').get().asFile
mkdir(outputFile.getParentFile())
def (mainVersion, prerelease) = project.version.split(/(?=-)/, 2)
def antoraYmlText = file('antora.yml').text
layout.buildDirectory.file('.antora.yml').get().asFile.text = antoraYmlText
antoraYmlText = antoraYmlText.lines().collect { l ->
if (l.startsWith('version: ')) {
return prerelease == null ? "version: '${mainVersion}'" : "version: '${mainVersion}'\nprerelease: '${prerelease}'"
}
if (l.startsWith('title: ')) return "title: ${project.parent.description}"
return l == 'ext:' || l.getAt(0) == ' ' ? null : l
}.findAll(Objects::nonNull).join('\n')
outputFile.text = """$antoraYmlText
asciidoc:
attributes:
icondir: icons
Expand All @@ -60,7 +61,7 @@ asciidoc:
spring-framework-reference-url: $springFrameworkReferenceUrl
spring-security-version: ${project.version}
${ymlVersions}
""")
"""
}
}

Expand Down