eliminate the dependency on the generated-docs repository

- add and register Antora Collector
- configure Antora Collection at runtime using another extension
This commit is contained in:
Dan Allen 2022-09-07 18:34:22 -06:00 committed by Steve Riesenberg
parent 6bd10b4056
commit f2f7eb7482
4 changed files with 36 additions and 7 deletions

View File

@ -1,6 +1,8 @@
antora:
extensions:
- ./lib/antora/extensions/antora-linked-worktree-patch.js
- ./lib/antora/extensions/inject-collector-config.js
- '@antora/collector-extension'
- ./lib/antora/extensions/version-fix.js
- ./lib/antora/extensions/major-minor-segment.js
runtime:
@ -14,12 +16,10 @@ git:
ensure_git_suffix: false
content:
sources:
- url: https://github.com/spring-io/spring-generated-docs
branches: 'spring-projects/spring-security/{main,5.{{6..9},{1..9}+({0..9})}.{x,+({0..9})}}'
- url: .
branches: '{main,5.{{6..9},{1..9}+({0..9})}.x}'
branches: [main, '5.{{6..9},{1..9}+({0..9})}.x']
worktrees: true # will automatically discover worktrees if they are set up; otherwise, will use git tree
tags: '5.{{6..9},{1..9}+({0..9})}.+({0..9})'
tags: '5.{{6..9},{1..9}+({0..9})}.+({0..9})?(-RC{1..9})'
start_path: docs
asciidoc:
attributes:

View File

@ -1,5 +1,7 @@
antora:
extensions:
- ./lib/antora/extensions/inject-collector-config.js
- '@antora/collector-extension'
- ./lib/antora/extensions/version-fix.js
- ./lib/antora/extensions/major-minor-segment.js
runtime:
@ -13,8 +15,6 @@ git:
ensure_git_suffix: false
content:
sources:
- url: https://github.com/spring-io/spring-generated-docs
branches: 'spring-projects/spring-security/{main,5.{{6..9},{1..9}+({0..9})}.{x,+({0..9}?(-RC{1..9}))}}'
- url: https://github.com/spring-projects/spring-security
branches: [main, '5.{{6..9},{1..9}+({0..9})}.x']
tags: '5.{{6..9},{1..9}+({0..9})}.+({0..9})?(-RC{1..9})'

View File

@ -0,0 +1,28 @@
'use strict'
const BASE_COMMAND = 'gradlew -PbuildSrc.skipTests=true'
const JVM_ARGS='-Xmx3g -XX:+HeapDumpOnOutOfMemoryError'
const REPO_URL = 'https://github.com/spring-projects/spring-security'
const TASK_NAME=':spring-security-docs:generateAntora'
module.exports.register = function () {
this.once('contentAggregated', ({ contentAggregate }) => {
for (const { origins } of contentAggregate) {
for (const origin of origins) {
if (origin.url === REPO_URL && origin.descriptor.ext?.collector === undefined) {
origin.descriptor.ext = {
collector: {
run: {
command: `${BASE_COMMAND} "-Dorg.gradle.jvmargs=${JVM_ARGS}" ${TASK_NAME}`,
local: true,
},
scan: {
dir: './build/generateAntora',
},
}
}
}
}
}
})
}

View File

@ -4,7 +4,8 @@
"private": true,
"dependencies": {
"@antora/cli": "^3.1.0",
"@antora/site-generator-default": "^3.1.0"
"@antora/site-generator-default": "^3.1.0",
"@antora/collector-extension": "1.0.0-alpha.2"
},
"overrides": {
"vinyl-fs": {