Skip to content

Commit 622f75d

Browse files
committed
Move Antora Tasks into DocsPlugin
All Spring projects using io.spring.convention.docs are also using Antora, so these tasks belong in the convention rather than each project's build script. Issue gh-18968
1 parent db67f36 commit 622f75d

2 files changed

Lines changed: 12 additions & 11 deletions

File tree

buildSrc/src/main/groovy/io/spring/gradle/convention/DocsPlugin.groovy

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import org.gradle.api.Project
55
import org.gradle.api.Task
66
import org.gradle.api.plugins.BasePlugin
77
import org.gradle.api.plugins.PluginManager
8+
import org.gradle.api.tasks.Sync
89
import org.gradle.api.tasks.bundling.Zip
910

1011
/**
@@ -19,6 +20,17 @@ public class DocsPlugin implements Plugin<Project> {
1920
pluginManager.apply(BasePlugin);
2021
pluginManager.apply(JavadocApiPlugin);
2122

23+
project.tasks.register("syncAntoraAttachments", Sync) { sync ->
24+
sync.group = 'Documentation'
25+
sync.description = 'Syncs the Antora attachments'
26+
sync.from(project.provider({ project.tasks.api.outputs }))
27+
sync.into(project.layout.buildDirectory.dir('generated-antora-resources/modules/ROOT/assets/attachments/api/java'))
28+
}
29+
30+
project.tasks.register("generateAntoraResources") {
31+
it.dependsOn 'generateAntoraYml', 'syncAntoraAttachments'
32+
}
33+
2234
Task docsZip = project.tasks.create('docsZip', Zip) {
2335
dependsOn 'api'
2436
group = 'Distribution'

docs/spring-security-docs.gradle

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,11 @@ antora {
2020
]
2121
}
2222

23-
tasks.register("syncAntoraAttachments", Sync) {
24-
group = 'Documentation'
25-
description = 'Syncs the Antora attachments'
26-
from project.provider( { project.tasks.api.outputs } )
27-
into project.layout.buildDirectory.dir('generated-antora-resources/modules/ROOT/assets/attachments/api/java')
28-
}
29-
3023
tasks.named("generateAntoraYml") {
3124
asciidocAttributes = project.provider( { generateAttributes() } )
3225
asciidocAttributes.putAll(providers.provider( { resolvedVersions(project.configurations.testRuntimeClasspath) }))
3326
}
3427

35-
tasks.register("generateAntoraResources") {
36-
dependsOn 'generateAntoraYml', 'syncAntoraAttachments'
37-
}
38-
3928
dependencies {
4029
testImplementation platform(project(':spring-security-dependencies'))
4130
testImplementation project(':spring-security-config')

0 commit comments

Comments
 (0)