From ca9a619259e7a4324e1d06d3f4cea783c2857334 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 30 Mar 2021 20:41:46 +0100 Subject: [PATCH] Defer processing of zipTree source until execution time Closes gh-25835 --- .../spring-boot-cli/build.gradle | 4 ++-- .../spring-boot-loader-tools/build.gradle | 20 +++++++++++-------- spring-boot-project/spring-boot/build.gradle | 9 +++++---- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/spring-boot-project/spring-boot-cli/build.gradle b/spring-boot-project/spring-boot-cli/build.gradle index a76bda576f..5b8cdf46d4 100644 --- a/spring-boot-project/spring-boot-cli/build.gradle +++ b/spring-boot-project/spring-boot-cli/build.gradle @@ -106,8 +106,8 @@ task fullJar(type: Jar) { from(sourceSets.main.output) { into "BOOT-INF/classes" } - into("") { - from(zipTree(configurations.loader.singleFile)) { + from { + zipTree(configurations.loader.singleFile).matching { exclude "META-INF/LICENSE.txt" exclude "META-INF/NOTICE.txt" } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/build.gradle b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/build.gradle index 29fcf0bbc6..e12d9d6771 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/build.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/build.gradle @@ -11,9 +11,11 @@ def generatedResources = "${buildDir}/generated-resources/main" configurations { loader { extendsFrom dependencyManagement + transitive = false } jarmode { extendsFrom dependencyManagement + transitive = false } } @@ -40,10 +42,11 @@ sourceSets { } task reproducibleLoaderJar(type: Jar) { - dependsOn configurations.loader - from(zipTree(configurations.loader.incoming.files.filter {it.name.startsWith "spring-boot-loader" }.singleFile)) { - exclude "META-INF/LICENSE.txt" - exclude "META-INF/NOTICE.txt" + from { + zipTree(configurations.loader.incoming.files.singleFile).matching { + exclude "META-INF/LICENSE.txt" + exclude "META-INF/NOTICE.txt" + } } reproducibleFileOrder = true preserveFileTimestamps = false @@ -52,10 +55,11 @@ task reproducibleLoaderJar(type: Jar) { } task reproducibleJarModeLayerToolsJar(type: Jar) { - dependsOn configurations.jarmode - from(zipTree(configurations.jarmode.incoming.files.filter {it.name.startsWith "spring-boot-jarmode-layertools" }.singleFile)) { - exclude "META-INF/LICENSE.txt" - exclude "META-INF/NOTICE.txt" + from { + zipTree(configurations.jarmode.incoming.files.singleFile).matching { + exclude "META-INF/LICENSE.txt" + exclude "META-INF/NOTICE.txt" + } } reproducibleFileOrder = true preserveFileTimestamps = false diff --git a/spring-boot-project/spring-boot/build.gradle b/spring-boot-project/spring-boot/build.gradle index 33b616c1b6..71ffe623ac 100644 --- a/spring-boot-project/spring-boot/build.gradle +++ b/spring-boot-project/spring-boot/build.gradle @@ -117,11 +117,12 @@ dependencies { } task extractTomcatConfigProperties(type: Sync) { - dependsOn configurations.tomcatDistribution destinationDir = file(tomcatConfigProperties) - from(zipTree(configurations.tomcatDistribution.incoming.files.singleFile).matching { - include '**/conf/catalina.properties' - }.singleFile) + from { + zipTree(configurations.tomcatDistribution.incoming.files.singleFile).matching { + include '**/conf/catalina.properties' + }.singleFile + } } sourceSets {