Skip to content

Commit

Permalink
Update Antora
Browse files Browse the repository at this point in the history
- Use org.gradle 1.0.0
- Need to use JDK 17 for latest plugin
- Use io.spring.antora.generate-antora-yml
- Use collector extension
- Use name: session

Closes gh-2327
  • Loading branch information
rwinch committed Jun 22, 2023
1 parent 9f7a969 commit fcf0064
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 61 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/continuous-integration-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
if: github.repository == 'spring-projects/spring-session'
strategy:
matrix:
jdk: [8, 11]
jdk: [17]
fail-fast: false
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: '8'
java-version: '17'
- name: Setup gradle user name
run: |
mkdir -p ~/.gradle
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-build-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
if: github.repository == 'spring-projects/spring-session'
strategy:
matrix:
jdk: [8, 11]
jdk: [17]
fail-fast: false
steps:
- uses: actions/checkout@v2
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ out
!etc/eclipse/.checkstyle
!**/src/**/build
.DS_Store
cached-antora-playbook.yml
6 changes: 6 additions & 0 deletions .sdkmanrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Use sdkman to run "sdk env" to initialize with correct JDK version
# Enable auto-env through the sdkman_auto_env config
# See https://sdkman.io/usage#config
# A summary is to add the following to ~/.sdkman/etc/config
# sdkman_auto_env=true
java=17.0.2-tem
28 changes: 25 additions & 3 deletions spring-session-docs/antora.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
name: ROOT
version: '2.6.4'
prerelease: '-SNAPSHOT'
name: session
version: true
title: Spring Session
start_page: ROOT:index.adoc
nav:
- modules/ROOT/nav.adoc
ext:
collector:
run:
command: gradlew -q -PbuildSrc.skipTests=true "-Dorg.gradle.jvmargs=-Xmx3g -XX:+HeapDumpOnOutOfMemoryError" :spring-session-docs:generateAntoraYml
local: true
scan:
dir: ./build/generated-antora-resources
asciidoc:
attributes:
gh-url: "https://github.com/spring-projects/spring-session/tree/{gh-tag}"
download-url: "https://github.com/spring-projects/spring-session/archive/{gh-tag}.zip"
gh-samples-url: "{gh-url}/spring-session-samples/"
samples-dir: "example$spring-session-samples/"
session-jdbc-main-resources-dir: "example$session-jdbc-main-resources-dir/"
spring-session-data-mongodb-dir: "example$spring-session-data-mongodb-dir/"
docs-test-dir: "example$java/"
websocketdoc-test-dir: 'example$java/docs/websocket/'
docs-test-resources-dir: "example$resources/"
indexdoc-tests: "example$java/docs/IndexDocTests.java"
79 changes: 24 additions & 55 deletions spring-session-docs/spring-session-docs.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id "io.github.rwinch.antora" version "0.0.2"
id 'org.antora' version '1.0.0'
id 'io.spring.antora.generate-antora-yml' version '0.0.1'
}

apply plugin: 'io.spring.convention.docs'
Expand Down Expand Up @@ -27,17 +28,30 @@ dependencies {
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
}


antora {
antoraVersion = "3.0.0-alpha.8"
arguments = ["--fetch"]
playbook = 'cached-antora-playbook.yml'
playbookProvider {
repository = 'spring-projects/spring-session'
branch = 'docs-build'
path = 'lib/antora/templates/per-branch-antora-playbook.yml'
checkLocalBranch = true
}
options = [clean: true, fetch: !project.gradle.startParameter.offline, stacktrace: true]
}

tasks.named("generateAntoraYml") {
asciidocAttributes = project.provider( { generateAttributes() } )
asciidocAttributes.putAll(providers.provider( { resolvedVersions(project.configurations.testRuntimeClasspath) }))
}

tasks.antora {
environment = [
"ALGOLIA_API_KEY" : "82c7ead946afbac3cf98c32446154691",
"ALGOLIA_APP_ID" : "244V8V9FGG",
"ALGOLIA_INDEX_NAME" : "session-docs"
]

def generateAttributes() {
def ghTag = snapshotBuild ? 'main' : project.version

return ['gh-tag':ghTag,
'spring-boot-version': springBootVersion,
'spring-session-version': project.version]
}

sourceSets {
Expand All @@ -51,58 +65,13 @@ sourceSets {
}
}

tasks.register("generateAntora") {
group = "Documentation"
description = "Generates the antora.yml for dynamic properties"
doLast {
def dollar = '$'
def ghTag = snapshotBuild ? 'main' : project.version
def ghUrl = "https://github.com/spring-projects/spring-session/tree/$ghTag"
def versions = resolvedVersions(project.configurations.testRuntimeClasspath)
def ymlVersions = ""
versions.call().each { name, version ->
ymlVersions += """
${name}: ${version}"""
}
def outputFile = new File("$buildDir/generateAntora/antora.yml")
outputFile.getParentFile().mkdirs()
outputFile.createNewFile()
def antoraYmlText = file("antora.yml").getText()
outputFile.setText("""$antoraYmlText
title: Spring Session
start_page: ROOT:index.adoc
nav:
- modules/ROOT/nav.adoc
asciidoc:
attributes:
download-url: "https://github.com/spring-projects/spring-session/archive/${ghTag}.zip"
gh-samples-url: "$ghUrl/spring-session-samples/"
samples-dir: "example${dollar}spring-session-samples/"
session-jdbc-main-resources-dir: "example${dollar}session-jdbc-main-resources-dir/"
spring-session-data-mongodb-dir: "example${dollar}spring-session-data-mongodb-dir/"
docs-test-dir: "example${dollar}java/"
websocketdoc-test-dir: 'example${dollar}java/docs/websocket/'
docs-test-resources-dir: "example${dollar}resources/"
indexdoc-tests: "example${dollar}java/docs/IndexDocTests.java"
spring-session-version: ${project.version}
version-milestone: $milestoneBuild
version-release: $releaseBuild
version-snapshot: $snapshotBuild
spring-boot-version: ${springBootVersion}
${ymlVersions}
""")
}
}

repositories {
maven { url "https://repo.spring.io/release" }
}

def resolvedVersions(Configuration configuration) {
return {
configuration.resolvedConfiguration
return configuration.resolvedConfiguration
.resolvedArtifacts
.collectEntries { [(it.name + "-version"): it.moduleVersion.id.version] }
}
}

0 comments on commit fcf0064

Please sign in to comment.