
Adds a new jarmode called 'tools'. This provides two commands, 'extract' and 'list-layers'. list-layers is the same as list from the layertools. extract is able to extract the JAR in four different modes: - CDS compatible extraction with libraries in a lib folder and a runner .jar - CDS compatible as above, but with layers - Launcher based - Launcher based with layers. This is essentially the same as extract from the layertools The commands in layertools have been deprecated in favor of the commands in 'tools'. This also changes the behavior of layers.enabled from the Gradle and Maven plugin: before this commit, layers.enabled prevents the inclusion of the layer index file as well as the layertools JAR. After this commit, layers.enabled only prevents the inclusion of the layer index file. layer.includeLayerTools have been deprecated in favor of includeTools, and the layertools JAR has been renamed to tools. Closes gh-38276
104 lines
2.8 KiB
Groovy
104 lines
2.8 KiB
Groovy
plugins {
|
|
id "java-library"
|
|
id "org.springframework.boot.conventions"
|
|
id "org.springframework.boot.deployed"
|
|
}
|
|
|
|
description = "Spring Boot Loader Tools"
|
|
|
|
def generatedResources = "${buildDir}/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("6.0.10")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
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}/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}/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}/META-INF/jarmode"))
|
|
}
|
|
|
|
sourceSets {
|
|
main {
|
|
output.dir(generatedResources, builtBy: [toolsJar, reproducibleLoaderJar, reproducibleLoaderClassicJar])
|
|
}
|
|
}
|
|
|
|
compileJava {
|
|
if ((!project.hasProperty("toolchainVersion")) && JavaVersion.current() == JavaVersion.VERSION_1_8) {
|
|
options.compilerArgs += ['-Xlint:-sunapi', '-XDenableSunApiLintControl']
|
|
}
|
|
}
|