Merge branch '3.2.x' into 3.3.x

Closes gh-42772
This commit is contained in:
Moritz Halbritter 2024-10-17 17:52:55 +02:00
commit 73150b799a
17 changed files with 75 additions and 73 deletions

View File

@ -30,8 +30,8 @@ import java.util.stream.Collectors;
import org.gradle.api.DefaultTask;
import org.gradle.api.Task;
import org.gradle.api.file.DirectoryProperty;
import org.gradle.api.file.FileCollection;
import org.gradle.api.file.RegularFileProperty;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.OutputDirectory;
import org.gradle.api.tasks.TaskAction;
@ -57,7 +57,7 @@ public abstract class DocumentAutoConfigurationClasses extends DefaultTask {
}
@OutputDirectory
public abstract RegularFileProperty getOutputDir();
public abstract DirectoryProperty getOutputDir();
@TaskAction
void documentAutoConfigurationClasses() throws IOException {

View File

@ -207,7 +207,7 @@ def documentationTest = tasks.register("documentationTest", Test) {
filter {
includeTestsMatching("org.springframework.boot.actuate.autoconfigure.endpoint.web.documentation.*")
}
outputs.dir("${buildDir}/generated-snippets")
outputs.dir(layout.buildDirectory.dir("generated-snippets"))
develocity {
predictiveTestSelection {
enabled = false
@ -225,12 +225,12 @@ def antoraActuatorRestApiLocalAggregateContent = tasks.register("antoraActuator
def antoraActuatorRestApiAggregateContent = tasks.register("antoraActuatorRestApiAggregateContent", Zip) {
dependsOn documentationTest
inputs.dir("${buildDir}/generated-snippets")
inputs.dir(layout.buildDirectory.dir("generated-snippets"))
.withPathSensitivity(PathSensitivity.RELATIVE)
.withPropertyName("generatedSnippets")
destinationDirectory = layout.buildDirectory.dir('generated/docs/antora-content')
archiveClassifier = "actuator-rest-api-aggregate-content"
from("${buildDir}/generated-snippets") {
from(layout.buildDirectory.dir("generated-snippets")) {
into "modules/api/partials/rest/actuator"
}
}

View File

@ -84,7 +84,7 @@ dependencies {
}
task syncIntTestDependencies(type: Sync) {
destinationDir = file("${buildDir}/dependencies")
destinationDir = file(layout.buildDirectory.dir("dependencies"))
from {
configurations.intTestDependencies
}

View File

@ -211,7 +211,7 @@ task aggregatedJavadoc(type: Javadoc) {
dependsOn publishedProjects.javadoc
source publishedProjects.javadoc.source
classpath = project.files(publishedProjects.javadoc.classpath)
destinationDir = project.file "${buildDir}/docs/javadoc"
destinationDir = project.file(project.layout.buildDirectory.dir("docs/javadoc"))
options {
author = true
docTitle = "Spring Boot ${project.version} API"
@ -244,33 +244,33 @@ task aggregatedJavadoc(type: Javadoc) {
task documentTestSlices(type: org.springframework.boot.build.test.autoconfigure.DocumentTestSlices) {
testSlices = configurations.testSlices
outputFile = file("${buildDir}/generated/docs/test-auto-configuration/documented-slices.adoc")
outputFile = layout.buildDirectory.file("generated/docs/test-auto-configuration/documented-slices.adoc")
}
task documentStarters(type: org.springframework.boot.build.starters.DocumentStarters) {
outputDir = file("${buildDir}/generated/docs/using/starters/")
outputDir = layout.buildDirectory.dir("generated/docs/using/starters/")
}
task documentAutoConfigurationClasses(type: org.springframework.boot.build.autoconfigure.DocumentAutoConfigurationClasses) {
autoConfiguration = configurations.autoConfiguration
outputDir = file("${buildDir}/generated/docs/auto-configuration-classes/documented-auto-configuration-classes/")
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 })
outputFile = file("${buildDir}/generated/docs/dependency-versions/documented-coordinates.adoc")
outputFile = layout.buildDirectory.file("generated/docs/dependency-versions/documented-coordinates.adoc")
}
task documentDependencyVersionProperties(type: org.springframework.boot.build.constraints.DocumentVersionProperties) {
dependsOn dependencyVersions
versionProperties.set(providers.provider { dependencyVersions.versionProperties})
outputFile = file("${buildDir}/generated/docs/dependency-versions/documented-properties.adoc")
outputFile = layout.buildDirectory.file("generated/docs/dependency-versions/documented-properties.adoc")
}
task documentConfigurationProperties(type: org.springframework.boot.build.context.properties.DocumentConfigurationProperties) {
configurationPropertyMetadata = configurations.configurationProperties
outputDir = file("${buildDir}/generated/docs/application-properties")
outputDir = layout.buildDirectory.dir("generated/docs/application-properties")
}
task documentDevtoolsPropertyDefaults(type: org.springframework.boot.build.devtools.DocumentDevtoolsPropertyDefaults) {}
@ -279,7 +279,7 @@ task runRemoteSpringApplicationExample(type: org.springframework.boot.build.docs
classpath = configurations.remoteSpringApplicationExample
mainClass = "org.springframework.boot.devtools.RemoteSpringApplication"
args = ["https://myapp.example.com", "--spring.devtools.remote.secret=secret", "--spring.devtools.livereload.port=0"]
output = file("$buildDir/example-output/remote-spring-application.txt")
output = layout.buildDirectory.file("example-output/remote-spring-application.txt")
expectedLogging = "Started RemoteSpringApplication in "
applicationJar = "/Users/myuser/.m2/repository/org/springframework/boot/spring-boot-devtools/${project.version}/spring-boot-devtools-${project.version}.jar"
normalizeLiveReloadPort()
@ -289,7 +289,7 @@ task runSpringApplicationExample(type: org.springframework.boot.build.docs.Appli
classpath = configurations.springApplicationExample + sourceSets.main.output
mainClass = "org.springframework.boot.docs.features.logexample.MyApplication"
args = ["--server.port=0"]
output = file("$buildDir/example-output/spring-application.txt")
output = layout.buildDirectory.file("example-output/spring-application.txt")
expectedLogging = "Started MyApplication in "
normalizeTomcatPort()
}
@ -298,7 +298,7 @@ task runLoggingFormatExample(type: org.springframework.boot.build.docs.Applicati
classpath = configurations.springApplicationExample + sourceSets.main.output
mainClass = "org.springframework.boot.docs.features.logexample.MyApplication"
args = ["--spring.main.banner-mode=off", "--server.port=0", "--spring.application.name=myapp"]
output = file("$buildDir/example-output/logging-format.txt")
output = layout.buildDirectory.file("example-output/logging-format.txt")
expectedLogging = "Started MyApplication in "
normalizeTomcatPort()
}

View File

@ -131,5 +131,5 @@ test {
task testSliceMetadata(type: org.springframework.boot.build.test.autoconfigure.TestSliceMetadata) {
sourceSet = sourceSets.main
outputFile = file("${buildDir}/test-slice-metadata.properties")
outputFile = layout.buildDirectory.file("test-slice-metadata.properties")
}

View File

@ -26,7 +26,7 @@ dependencies {
}
task syncIntegrationTestSources(type: Sync) {
destinationDir file("${buildDir}/it")
destinationDir file(layout.buildDirectory.dir("it"))
from file("src/it")
filter(springRepositoryTransformers.ant())
}
@ -40,7 +40,7 @@ processResources {
task integrationTest {
dependsOn syncIntegrationTestSources, jar
def resultsDir = file("${buildDir}/test-results/integrationTest")
def resultsDir = file(layout.buildDirectory.dir("test-results/integrationTest"))
inputs.dir(file("src/it")).withPathSensitivity(PathSensitivity.RELATIVE).withPropertyName("source")
inputs.files(sourceSets.main.runtimeClasspath).withNormalizer(ClasspathNormalizer).withPropertyName("classpath")
outputs.dirs resultsDir
@ -62,9 +62,9 @@ task integrationTest {
ant.propertyref(name: "ivy.class.path")
}
plainlistener()
file("${buildDir}/test-results/integrationTest").mkdirs()
file(layout.buildDirectory.dir("test-results/integrationTest")).mkdirs()
xmllistener(toDir: resultsDir)
fileset(dir: "${buildDir}/it", includes: "**/build.xml")
fileset(dir: layout.buildDirectory.dir("it").get().asFile.toString(), includes: "**/build.xml")
}
}
}

View File

@ -106,12 +106,12 @@ task tar(type: Tar) {
task homebrewFormula(type: org.springframework.boot.build.cli.HomebrewFormula) {
dependsOn tar
outputDir = file("${buildDir}/homebrew")
outputDir = layout.buildDirectory.dir("homebrew")
template = file("src/main/homebrew/spring-boot.rb")
archive = tar.archiveFile
}
def homebrewFormulaArtifact = artifacts.add("archives", file("${buildDir}/homebrew/spring-boot.rb")) {
def homebrewFormulaArtifact = artifacts.add("archives", file(layout.buildDirectory.file("homebrew/spring-boot.rb"))) {
type "rb"
classifier "homebrew"
builtBy "homebrewFormula"

View File

@ -5,7 +5,7 @@ plugins {
description = "Spring Boot Loader Tools"
def generatedResources = "${buildDir}/generated-resources/main"
Provider<Directory> generatedResources = layout.buildDirectory.dir("generated-resources/main")
configurations {
loader {
@ -62,7 +62,7 @@ task reproducibleLoaderJar(type: Jar) {
reproducibleFileOrder = true
preserveFileTimestamps = false
archiveFileName = "spring-boot-loader.jar"
destinationDirectory = file("${generatedResources}/META-INF/loader")
destinationDirectory = file(generatedResources.map {it.dir("META-INF/loader") })
}
task reproducibleLoaderClassicJar(type: Jar) {
@ -77,7 +77,7 @@ task reproducibleLoaderClassicJar(type: Jar) {
reproducibleFileOrder = true
preserveFileTimestamps = false
archiveFileName = "spring-boot-loader-classic.jar"
destinationDirectory = file("${generatedResources}/META-INF/loader")
destinationDirectory = file(generatedResources.map { it.dir("META-INF/loader") })
}
task toolsJar(type: Sync) {
@ -86,7 +86,7 @@ task toolsJar(type: Sync) {
file(configurations.jarmode.incoming.files.singleFile)
}
rename({ "spring-boot-jarmode-tools.jar" })
into(file("${generatedResources}/META-INF/jarmode"))
into(file(generatedResources.map { it.dir("META-INF/jarmode") }))
}
sourceSets {

View File

@ -93,19 +93,19 @@ ext {
task copySettingsXml(type: Copy) {
from file("src/intTest/projects/settings.xml")
into "${buildDir}/generated-resources/settings"
into layout.buildDirectory.dir("generated-resources/settings")
filter(springRepositoryTransformers.mavenSettings())
}
sourceSets {
main {
output.dir("${buildDir}/generated/resources/xsd", builtBy: "xsdResources")
output.dir(layout.buildDirectory.dir("generated/resources/xsd"), builtBy: "xsdResources")
}
intTest {
output.dir("${buildDir}/generated-resources", builtBy: ["extractVersionProperties", "copySettingsXml"])
output.dir(layout.buildDirectory.dir("generated-resources"), builtBy: ["extractVersionProperties", "copySettingsXml"])
}
dockerTest {
output.dir("${buildDir}/generated-resources", builtBy: "extractVersionProperties")
output.dir(layout.buildDirectory.dir("generated-resources"), builtBy: "extractVersionProperties")
}
}
@ -124,7 +124,7 @@ javadoc {
task xsdResources(type: Sync) {
from "src/main/xsd/layers-${project.ext.xsdVersion}.xsd"
into "${buildDir}/generated/resources/xsd/org/springframework/boot/maven"
into layout.buildDirectory.dir("generated/resources/xsd/org/springframework/boot/maven")
rename { fileName -> "layers.xsd" }
}

View File

@ -9,7 +9,7 @@ plugins {
description = "Spring Boot"
def tomcatConfigProperties = "$buildDir/tomcat-config-properties"
def tomcatConfigProperties = layout.buildDirectory.dir("tomcat-config-properties")
configurations {
tomcatDistribution

View File

@ -30,7 +30,7 @@ configurations {
task syncMavenRepository(type: Sync) {
from configurations.app
into "${buildDir}/system-test-maven-repository"
into layout.buildDirectory.dir("system-test-maven-repository")
}
systemTest {

View File

@ -25,17 +25,17 @@ dependencies {
task syncMavenRepository(type: Sync) {
from configurations.app
into "${buildDir}/docker-test-maven-repository"
into layout.buildDirectory.dir("docker-test-maven-repository")
}
task syncAppSource(type: org.springframework.boot.build.SyncAppSource) {
sourceDirectory = file("spring-boot-launch-script-tests-app")
destinationDirectory = file("${buildDir}/spring-boot-launch-script-tests-app")
destinationDirectory = file(layout.buildDirectory.dir("spring-boot-launch-script-tests-app"))
}
task buildApp(type: GradleBuild) {
dependsOn syncAppSource, syncMavenRepository
dir = "${buildDir}/spring-boot-launch-script-tests-app"
dir = layout.buildDirectory.dir("spring-boot-launch-script-tests-app")
startParameter.buildCacheEnabled = false
tasks = ["build"]
}
@ -54,7 +54,7 @@ task syncJdkDownloads(type: Sync) {
dependsOn downloadJdk
from "${project.gradle.gradleUserHomeDir}/caches/springboot/downloads/jdk/bellsoft/"
include "bellsoft-jdk${jdkVersion}-linux-${jdkArch}.tar.gz"
into "${project.buildDir}/downloads/jdk/bellsoft/"
into layout.buildDirectory.dir("downloads/jdk/bellsoft/")
}
tasks.named("processDockerTestResources").configure {

View File

@ -22,17 +22,17 @@ dependencies {
task syncMavenRepository(type: Sync) {
from configurations.app
into "${buildDir}/docker-test-maven-repository"
into layout.buildDirectory.dir("docker-test-maven-repository")
}
task syncAppSource(type: org.springframework.boot.build.SyncAppSource) {
sourceDirectory = file("spring-boot-loader-classic-tests-app")
destinationDirectory = file("${buildDir}/spring-boot-loader-classic-tests-app")
destinationDirectory = file(layout.buildDirectory.dir("spring-boot-loader-classic-tests-app"))
}
task buildApp(type: GradleBuild) {
dependsOn syncAppSource, syncMavenRepository
dir = "${buildDir}/spring-boot-loader-classic-tests-app"
dir = layout.buildDirectory.dir("spring-boot-loader-classic-tests-app")
startParameter.buildCacheEnabled = false
tasks = ["build"]
}

View File

@ -28,29 +28,29 @@ dependencies {
task syncMavenRepository(type: Sync) {
from configurations.app
into "${buildDir}/docker-test-maven-repository"
into layout.buildDirectory.dir("docker-test-maven-repository")
}
task syncAppSource(type: org.springframework.boot.build.SyncAppSource) {
sourceDirectory = file("spring-boot-loader-tests-app")
destinationDirectory = file("${buildDir}/spring-boot-loader-tests-app")
destinationDirectory = file(layout.buildDirectory.dir("spring-boot-loader-tests-app"))
}
task buildApp(type: GradleBuild) {
dependsOn syncAppSource, syncMavenRepository
dir = "${buildDir}/spring-boot-loader-tests-app"
dir = layout.buildDirectory.dir("spring-boot-loader-tests-app")
startParameter.buildCacheEnabled = false
tasks = ["build"]
}
task syncSignedJarAppSource(type: org.springframework.boot.build.SyncAppSource) {
sourceDirectory = file("spring-boot-loader-tests-signed-jar")
destinationDirectory = file("${buildDir}/spring-boot-loader-tests-signed-jar")
destinationDirectory = file(layout.buildDirectory.dir("spring-boot-loader-tests-signed-jar"))
}
task buildSignedJarApp(type: GradleBuild) {
dependsOn syncSignedJarAppSource, syncMavenRepository
dir = "${buildDir}/spring-boot-loader-tests-signed-jar"
dir = layout.buildDirectory.dir("spring-boot-loader-tests-signed-jar")
startParameter.buildCacheEnabled = false
tasks = ["build"]
}
@ -69,7 +69,7 @@ task syncJdkDownloads(type: Sync) {
dependsOn downloadJdk
from "${project.gradle.gradleUserHomeDir}/caches/springboot/downloads/jdk/oracle/"
include "jdk-${oracleJdkVersion}_linux-${oracleJdkArch}_bin.tar.gz"
into "${project.buildDir}/downloads/jdk/oracle/"
into layout.buildDirectory.dir("downloads/jdk/oracle/")
}
tasks.named("processDockerTestResources").configure {

View File

@ -29,7 +29,7 @@ dependencies {
}
task syncTestRepository(type: Sync) {
destinationDir = file("${buildDir}/test-repository")
destinationDir = file(layout.buildDirectory.dir("test-repository"))
from {
configurations.testRepository
}
@ -37,12 +37,12 @@ task syncTestRepository(type: Sync) {
task syncAppSource(type: org.springframework.boot.build.SyncAppSource) {
sourceDirectory = file("spring-boot-server-tests-app")
destinationDirectory = file("${buildDir}/spring-boot-server-tests-app")
destinationDirectory = file(layout.buildDirectory.dir("spring-boot-server-tests-app"))
}
task buildApps(type: GradleBuild) {
dependsOn syncAppSource, syncTestRepository
dir = "${buildDir}/spring-boot-server-tests-app"
dir = layout.buildDirectory.dir("spring-boot-server-tests-app")
startParameter.buildCacheEnabled = false
tasks = [
"jettyBootJar",
@ -56,13 +56,14 @@ task buildApps(type: GradleBuild) {
intTest {
inputs.files(
"${buildDir}/spring-boot-server-tests-app/build/libs/spring-boot-server-tests-app-jetty.jar",
"${buildDir}/spring-boot-server-tests-app/build/libs/spring-boot-server-tests-app-jetty.war",
"${buildDir}/spring-boot-server-tests-app/build/libs/spring-boot-server-tests-app-resources.jar",
"${buildDir}/spring-boot-server-tests-app/build/libs/spring-boot-server-tests-app-tomcat.jar",
"${buildDir}/spring-boot-server-tests-app/build/libs/spring-boot-server-tests-app-tomcat.war",
"${buildDir}/spring-boot-server-tests-app/build/libs/spring-boot-server-tests-app-undertow.jar",
"${buildDir}/spring-boot-server-tests-app/build/libs/spring-boot-server-tests-app-undertow.war")
layout.buildDirectory.file("spring-boot-server-tests-app/build/libs/spring-boot-server-tests-app-jetty.jar"),
layout.buildDirectory.file("spring-boot-server-tests-app/build/libs/spring-boot-server-tests-app-jetty.war"),
layout.buildDirectory.file("spring-boot-server-tests-app/build/libs/spring-boot-server-tests-app-resources.jar"),
layout.buildDirectory.file("spring-boot-server-tests-app/build/libs/spring-boot-server-tests-app-tomcat.jar"),
layout.buildDirectory.file("spring-boot-server-tests-app/build/libs/spring-boot-server-tests-app-tomcat.war"),
layout.buildDirectory.file("spring-boot-server-tests-app/build/libs/spring-boot-server-tests-app-undertow.jar"),
layout.buildDirectory.file("spring-boot-server-tests-app/build/libs/spring-boot-server-tests-app-undertow.war")
)
.withPropertyName("applicationArchives")
.withPathSensitivity(PathSensitivity.RELATIVE)
.withNormalizer(ClasspathNormalizer)

View File

@ -29,17 +29,17 @@ dependencies {
task syncMavenRepository(type: Sync) {
from configurations.app
into "${buildDir}/int-test-maven-repository"
into layout.buildDirectory.dir("int-test-maven-repository")
}
task syncReactiveServerAppSource(type: org.springframework.boot.build.SyncAppSource) {
sourceDirectory = file("spring-boot-sni-reactive-app")
destinationDirectory = file("${buildDir}/spring-boot-sni-reactive-app")
destinationDirectory = file(layout.buildDirectory.dir("spring-boot-sni-reactive-app"))
}
task buildReactiveServerApps(type: GradleBuild) {
dependsOn syncReactiveServerAppSource, syncMavenRepository
dir = "${buildDir}/spring-boot-sni-reactive-app"
dir = layout.buildDirectory.dir("spring-boot-sni-reactive-app")
startParameter.buildCacheEnabled = false
tasks = [
"nettyServerApp",
@ -50,12 +50,12 @@ task buildReactiveServerApps(type: GradleBuild) {
task syncServletServerAppSource(type: org.springframework.boot.build.SyncAppSource) {
sourceDirectory = file("spring-boot-sni-servlet-app")
destinationDirectory = file("${buildDir}/spring-boot-sni-servlet-app")
destinationDirectory = file(layout.buildDirectory.dir("spring-boot-sni-servlet-app"))
}
task buildServletServerApps(type: GradleBuild) {
dependsOn syncServletServerAppSource, syncMavenRepository
dir = "${buildDir}/spring-boot-sni-servlet-app"
dir = layout.buildDirectory.dir("spring-boot-sni-servlet-app")
startParameter.buildCacheEnabled = false
tasks = [
"tomcatServerApp",
@ -65,23 +65,24 @@ task buildServletServerApps(type: GradleBuild) {
task syncClientAppSource(type: org.springframework.boot.build.SyncAppSource) {
sourceDirectory = file("spring-boot-sni-client-app")
destinationDirectory = file("${buildDir}/spring-boot-sni-client-app")
destinationDirectory = file(layout.buildDirectory.dir("spring-boot-sni-client-app"))
}
task buildClientApp(type: GradleBuild) {
dependsOn syncClientAppSource, syncMavenRepository
dir = "${buildDir}/spring-boot-sni-client-app"
dir = layout.buildDirectory.dir("spring-boot-sni-client-app")
startParameter.buildCacheEnabled = false
tasks = ["build"]
}
intTest {
inputs.files(
"${buildDir}/spring-boot-server-tests-app/build/libs/spring-boot-server-tests-app-netty-reactive.jar",
"${buildDir}/spring-boot-server-tests-app/build/libs/spring-boot-server-tests-app-tomcat-reactive.jar",
"${buildDir}/spring-boot-server-tests-app/build/libs/spring-boot-server-tests-app-tomcat-servlet.jar",
"${buildDir}/spring-boot-server-tests-app/build/libs/spring-boot-server-tests-app-undertow-reactive.jar",
"${buildDir}/spring-boot-server-tests-app/build/libs/spring-boot-server-tests-app-undertow-servlet.jar")
layout.buildDirectory.file("spring-boot-server-tests-app/build/libs/spring-boot-server-tests-app-netty-reactive.jar"),
layout.buildDirectory.file("spring-boot-server-tests-app/build/libs/spring-boot-server-tests-app-tomcat-reactive.jar"),
layout.buildDirectory.file("spring-boot-server-tests-app/build/libs/spring-boot-server-tests-app-tomcat-servlet.jar"),
layout.buildDirectory.file("spring-boot-server-tests-app/build/libs/spring-boot-server-tests-app-undertow-reactive.jar"),
layout.buildDirectory.file("spring-boot-server-tests-app/build/libs/spring-boot-server-tests-app-undertow-servlet.jar")
)
.withPropertyName("applicationArchives")
.withPathSensitivity(PathSensitivity.RELATIVE)
.withNormalizer(ClasspathNormalizer)

View File

@ -39,7 +39,7 @@ dependencies {
}
task syncTestRepository(type: Sync) {
destinationDir = file("${buildDir}/test-repository")
destinationDir = file(layout.buildDirectory.dir("test-repository"))
from configurations.testRepository
rename {
it.replaceAll("-[0-9]+\\.[0-9]+-[0-9]+\\.", "-SNAPSHOT.")
@ -47,14 +47,14 @@ task syncTestRepository(type: Sync) {
}
task syncAntSources(type: Sync) {
destinationDir file("${buildDir}/ant")
destinationDir file(layout.buildDirectory.dir("ant"))
from project.layout.projectDirectory
include "*.xml"
filter(springRepositoryTransformers.ant())
}
task antRun(type: JavaExec) {
workingDir "${buildDir}/ant"
workingDir layout.buildDirectory.dir("ant")
dependsOn syncTestRepository, syncAntSources, configurations.antDependencies
classpath = configurations.antDependencies;
mainClass = "org.apache.tools.ant.launch.Launcher"