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
This commit is contained in:
@@ -5,6 +5,7 @@ import org.gradle.api.Project
|
|||||||
import org.gradle.api.Task
|
import org.gradle.api.Task
|
||||||
import org.gradle.api.plugins.BasePlugin
|
import org.gradle.api.plugins.BasePlugin
|
||||||
import org.gradle.api.plugins.PluginManager
|
import org.gradle.api.plugins.PluginManager
|
||||||
|
import org.gradle.api.tasks.Sync
|
||||||
import org.gradle.api.tasks.bundling.Zip
|
import org.gradle.api.tasks.bundling.Zip
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -19,6 +20,17 @@ public class DocsPlugin implements Plugin<Project> {
|
|||||||
pluginManager.apply(BasePlugin);
|
pluginManager.apply(BasePlugin);
|
||||||
pluginManager.apply(JavadocApiPlugin);
|
pluginManager.apply(JavadocApiPlugin);
|
||||||
|
|
||||||
|
project.tasks.register("syncAntoraAttachments", Sync) { sync ->
|
||||||
|
sync.group = 'Documentation'
|
||||||
|
sync.description = 'Syncs the Antora attachments'
|
||||||
|
sync.from(project.provider({ project.tasks.api.outputs }))
|
||||||
|
sync.into(project.layout.buildDirectory.dir('generated-antora-resources/modules/ROOT/assets/attachments/api/java'))
|
||||||
|
}
|
||||||
|
|
||||||
|
project.tasks.register("generateAntoraResources") {
|
||||||
|
it.dependsOn 'generateAntoraYml', 'syncAntoraAttachments'
|
||||||
|
}
|
||||||
|
|
||||||
Task docsZip = project.tasks.create('docsZip', Zip) {
|
Task docsZip = project.tasks.create('docsZip', Zip) {
|
||||||
dependsOn 'api'
|
dependsOn 'api'
|
||||||
group = 'Distribution'
|
group = 'Distribution'
|
||||||
|
|||||||
@@ -20,22 +20,11 @@ antora {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register("syncAntoraAttachments", Sync) {
|
|
||||||
group = 'Documentation'
|
|
||||||
description = 'Syncs the Antora attachments'
|
|
||||||
from project.provider( { project.tasks.api.outputs } )
|
|
||||||
into project.layout.buildDirectory.dir('generated-antora-resources/modules/ROOT/assets/attachments/api/java')
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.named("generateAntoraYml") {
|
tasks.named("generateAntoraYml") {
|
||||||
asciidocAttributes = project.provider( { generateAttributes() } )
|
asciidocAttributes = project.provider( { generateAttributes() } )
|
||||||
asciidocAttributes.putAll(providers.provider( { resolvedVersions(project.configurations.testRuntimeClasspath) }))
|
asciidocAttributes.putAll(providers.provider( { resolvedVersions(project.configurations.testRuntimeClasspath) }))
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register("generateAntoraResources") {
|
|
||||||
dependsOn 'generateAntoraYml', 'syncAntoraAttachments'
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
testImplementation platform(project(':spring-security-dependencies'))
|
testImplementation platform(project(':spring-security-dependencies'))
|
||||||
testImplementation project(':spring-security-config')
|
testImplementation project(':spring-security-config')
|
||||||
|
|||||||
Reference in New Issue
Block a user