-
Notifications
You must be signed in to change notification settings - Fork 23
/
build.gradle
202 lines (171 loc) · 5.8 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
buildscript {
dependencyLocking {
lockAllConfigurations()
}
repositories {
mavenCentral()
gradlePluginPortal()
}
dependencies {
// TODO: this plugin brings in org.springframework:spring-core:3.1.3.RELEASE and org.springframework:spring-asm:3.1.3.RELEASE
// Because of this, it fails Boot's mainClass lookup mechanism, we need to find a better way to guard license headers
// classpath ('gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin:0.16.1')
classpath 'io.spring.nohttp:nohttp-gradle:0.0.11'
classpath 'io.spring.javaformat:spring-javaformat-gradle-plugin:0.0.41'
}
configurations.classpath.resolutionStrategy.cacheDynamicVersionsFor 0, 'minutes'
}
description = 'Micrometer Samples'
allprojects {
group = 'com.example.micrometersamples'
version = '0.1.0-SNAPSHOT'
afterEvaluate { project -> println "I'm configuring $project.name with version $project.version" }
}
subprojects {
apply plugin: 'java'
apply plugin: 'checkstyle'
apply plugin: 'io.spring.javaformat'
// apply plugin: 'com.github.hierynomus.license'
apply plugin: 'io.spring.nohttp'
apply plugin: 'maven-publish'
java {
registerFeature('optional') {
usingSourceSet(sourceSets.main)
}
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/milestone' }
if (springBootVersion.endsWith('SNAPSHOT') || springCloudVersion.endsWith('SNAPSHOT')) {
maven { url 'https://repo.spring.io/snapshot' }
maven { url 'https://repo.spring.io/milestone' }
}
}
dependencies {
// JSR-305 only used for non-required meta-annotations
optionalApi 'com.google.code.findbugs:jsr305:latest.release'
checkstyle 'io.spring.javaformat:spring-javaformat-checkstyle:latest.release'
}
tasks {
compileJava {
options.encoding = 'UTF-8'
options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
doLast {
task -> logger.info("Compiling with " + task.javaCompiler.get().executablePath)
}
}
compileTestJava {
options.encoding = 'UTF-8'
options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
}
javadoc {
enabled = false
}
}
normalization {
runtimeClasspath {
metaInf {
[
'Build-Date',
'Build-Date-UTC',
'Built-By',
'Built-OS',
'Build-Host',
'Build-Job',
'Build-Number',
'Build-Id',
'Change',
'Full-Change',
'Branch',
'Module-Origin',
'Created-By',
'Build-Java-Version'
].each {
ignoreAttribute it
ignoreProperty it
}
}
}
}
//noinspection GroovyAssignabilityCheck
test {
// set heap size for the test JVM(s)
maxHeapSize = "1500m"
useJUnitPlatform()
develocity.testRetry {
maxFailures = 5
maxRetries = 3
}
}
plugins.withId('org.springframework.boot') {
publishing {
publications {
bootJava(MavenPublication) {
artifact tasks.named("bootJar")
}
}
}
}
plugins.withId('org.graalvm.buildtools.native') {
// TODO: Run nativeTest on build once we have GraalVM on CI
// TODO: OTel Trcing does not work on native
// check.dependsOn('nativeTest')
tasks.withType(io.spring.javaformat.gradle.tasks.CheckFormat) {
if (it.name in [ 'checkFormatAot', 'checkFormatAotTest' ]) {
exclude '*'
}
}
plugins.withId('org.springframework.boot') {
checkstyle {
checkstyleAot.enabled = false
checkstyleAotTest.enabled = false
}
}
}
project.tasks.withType(Test) { Test testTask ->
testTask.testLogging.exceptionFormat = 'full'
}
// license {
// header rootProject.file('gradle/licenseHeader.txt')
// strictCheck true
// mapping {
// java = 'SLASHSTAR_STYLE'
// }
// sourceSets = project.sourceSets
// ext.year = Calendar.getInstance().get(Calendar.YEAR)
// skipExistingHeaders = true
// exclude '**/*.json' // comments not supported
// }
nohttp {
source.exclude '**/docker/**/*.yml', '**/docker-compose.yml'
}
dependencyLocking {
lockAllConfigurations()
}
tasks.register('resolveAndLockAll') {
description = 'Resolves dependencies of all configurations and writes them into the lock file.'
outputs.upToDateWhen { false }
doFirst {
assert gradle.startParameter.writeDependencyLocks || gradle.startParameter.lockedDependenciesToUpdate: 'Execute resolveAndLockAll --write-locks or --update-locks <dependencies>'
}
doLast {
project.configurations.findAll { it.canBeResolved }*.resolve()
}
}
tasks.register('downloadDependencies') {
outputs.upToDateWhen { false }
doLast {
project.configurations.findAll { it.canBeResolved }*.files
}
}
}
task deleteLockFiles(type: Delete) {
delete fileTree(dir: '.', include: '**/gradle.lockfile')
}
wrapper {
gradleVersion = '8.10'
}
defaultTasks 'build'