Andy Wilkinson 4b8d5f22de Remove Java 8-specific build configuration that will never apply
With our Java 17 baseline, the build configuration that is only
applicable when building with Java 8 will never be used. This commit
removes it.

Closes gh-44129
2025-02-05 08:47:29 +00:00

109 lines
3.0 KiB
Groovy

plugins {
id "java-library"
id "org.springframework.boot.deployed"
}
description = "Spring Boot Loader Tools"
Provider<Directory> generatedResources = layout.buildDirectory.dir("generated-resources/main")
configurations {
loader {
extendsFrom dependencyManagement
transitive = false
}
loaderClassic {
extendsFrom dependencyManagement
transitive = false
}
jarmode {
extendsFrom dependencyManagement
transitive = false
}
all {
resolutionStrategy {
eachDependency { dependency ->
// Downgrade Spring Framework as Gradle cannot cope with 6.1.0-M1's
// multi-version jar files with bytecode in META-INF/versions/21
if (dependency.requested.group.equals("org.springframework")) {
dependency.useVersion("$springFramework60xVersion")
}
}
}
}
}
dependencies {
api("org.apache.commons:commons-compress")
api("org.springframework:spring-core")
compileOnly("ch.qos.logback:logback-classic")
loader(project(":spring-boot-project:spring-boot-tools:spring-boot-loader"))
loaderClassic(project(":spring-boot-project:spring-boot-tools:spring-boot-loader-classic"))
jarmode(project(":spring-boot-project:spring-boot-tools:spring-boot-jarmode-tools"))
testImplementation("org.assertj:assertj-core")
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("org.mockito:mockito-core")
testImplementation("org.zeroturnaround:zt-zip:1.13")
}
task reproducibleLoaderJar(type: Jar) {
dependsOn configurations.loader
from {
zipTree(configurations.loader.incoming.files.singleFile).matching {
exclude "META-INF/LICENSE.txt"
exclude "META-INF/NOTICE.txt"
exclude "META-INF/spring-boot.properties"
}
}
reproducibleFileOrder = true
preserveFileTimestamps = false
archiveFileName = "spring-boot-loader.jar"
destinationDirectory = file(generatedResources.map {it.dir("META-INF/loader") })
}
task reproducibleLoaderClassicJar(type: Jar) {
dependsOn configurations.loaderClassic
from {
zipTree(configurations.loaderClassic.incoming.files.singleFile).matching {
exclude "META-INF/LICENSE.txt"
exclude "META-INF/NOTICE.txt"
exclude "META-INF/spring-boot.properties"
}
}
reproducibleFileOrder = true
preserveFileTimestamps = false
archiveFileName = "spring-boot-loader-classic.jar"
destinationDirectory = file(generatedResources.map { it.dir("META-INF/loader") })
}
task toolsJar(type: Sync) {
dependsOn configurations.jarmode
from {
file(configurations.jarmode.incoming.files.singleFile)
}
rename({ "spring-boot-jarmode-tools.jar" })
into(file(generatedResources.map { it.dir("META-INF/jarmode") }))
}
sourceSets {
main {
output.dir(generatedResources, builtBy: [toolsJar, reproducibleLoaderJar, reproducibleLoaderClassicJar])
}
}
plugins.withType(EclipsePlugin) {
eclipse {
classpath.file { merger ->
merger.beforeMerged { content ->
if (content instanceof org.gradle.plugins.ide.eclipse.model.Classpath) {
content.entries.add(new org.gradle.plugins.ide.eclipse.model.SourceFolder("build/generated-resources/main", "bin/main"))
}
}
}
}
}