Rewrite process for documenting managed dependencies

Previously, managed dependencies were documented using Gradle's
dependency constraints. This has proven to be non-deterministic for
reasons that are not fully understood. The working theory is that
the constraints that are documented vary depending on the tasks
that the build has run at the point at which the constraints are
being examined and documented.

This commit replaces approach with one that builds a model of a
resolved bom by examining the configured bom extension and the
XML of the Maven boms that it imports. This model is written to
disk from where it can then be consumed as a dependency on other
projects. The existing tasks for documenting the constrained
versions and version properties have been rewritten to use the
resolved bom model instead.

Closes gh-44855
This commit is contained in:
Andy Wilkinson
2025-03-25 14:44:34 +00:00
parent b67a6551f9
commit 7b2d90811d
9 changed files with 631 additions and 80 deletions

View File

@@ -14,6 +14,7 @@ configurations {
autoConfiguration
configurationProperties
remoteSpringApplicationExample
resolvedBom
springApplicationExample
testSlices
all {
@@ -177,6 +178,8 @@ dependencies {
remoteSpringApplicationExample(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-logging"))
remoteSpringApplicationExample("org.springframework:spring-web")
resolvedBom(project(path: ":spring-boot-project:spring-boot-dependencies", configuration: "resolvedBom"))
springApplicationExample(platform(project(":spring-boot-project:spring-boot-dependencies")))
springApplicationExample(project(path: ":spring-boot-project:spring-boot-starters:spring-boot-starter-web"))
@@ -254,16 +257,14 @@ task documentAutoConfigurationClasses(type: org.springframework.boot.build.autoc
outputDir = layout.buildDirectory.dir("generated/docs/auto-configuration-classes/documented-auto-configuration-classes/")
}
task documentDependencyVersionCoordinates(type: org.springframework.boot.build.constraints.DocumentConstrainedVersions) {
dependsOn dependencyVersions
constrainedVersions.set(providers.provider { dependencyVersions.constrainedVersions })
task documentDependencyVersionCoordinates(type: org.springframework.boot.build.docs.DocumentManagedDependencies) {
outputFile = layout.buildDirectory.file("generated/docs/dependency-versions/documented-coordinates.adoc")
resolvedBoms = configurations.resolvedBom
}
task documentDependencyVersionProperties(type: org.springframework.boot.build.constraints.DocumentVersionProperties) {
dependsOn dependencyVersions
versionProperties.set(providers.provider { dependencyVersions.versionProperties})
task documentDependencyVersionProperties(type: org.springframework.boot.build.docs.DocumentVersionProperties) {
outputFile = layout.buildDirectory.file("generated/docs/dependency-versions/documented-properties.adoc")
resolvedBoms = configurations.resolvedBom
}
task documentConfigurationProperties(type: org.springframework.boot.build.context.properties.DocumentConfigurationProperties) {