-
Notifications
You must be signed in to change notification settings - Fork 41.1k
/
Copy pathbuild.gradle
108 lines (95 loc) · 3.23 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
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")
}
// We manage the version of commons-compress here rather than
// in spring-boot-parent to minimize conflicts with Testcontainers
if (dependency.requested.group.equals("org.apache.commons")
&& dependency.requested.name.equals("commons-compress")) {
dependency.useVersion("$commonsCompressVersion")
}
}
}
}
}
dependencies {
api("org.apache.commons:commons-compress:$commonsCompressVersion")
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-layertools"))
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 layerToolsJar(type: Sync) {
dependsOn configurations.jarmode
from {
file(configurations.jarmode.incoming.files.singleFile)
}
rename({ "spring-boot-jarmode-layertools.jar" })
into(file(generatedResources.map { it.dir("META-INF/jarmode") }))
}
sourceSets {
main {
output.dir(generatedResources, builtBy: [layerToolsJar, reproducibleLoaderJar, reproducibleLoaderClassicJar])
}
}
compileJava {
if ((!project.hasProperty("toolchainVersion")) && JavaVersion.current() == JavaVersion.VERSION_1_8) {
options.compilerArgs += ['-Xlint:-sunapi', '-XDenableSunApiLintControl']
}
}