forked from micrometer-metrics/micrometer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
249 lines (209 loc) · 7.9 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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
buildscript {
repositories {
jcenter()
gradlePluginPortal()
maven {
url 'https://repo.spring.io/plugins-release'
}
mavenLocal()
}
dependencies {
classpath 'io.spring.gradle:spring-release-plugin:0.20.1'
classpath 'me.champeau.gradle:jmh-gradle-plugin:0.5.0'
classpath 'com.netflix.nebula:nebula-project-plugin:3.4.0'
classpath "io.spring.nohttp:nohttp-gradle:0.0.4.RELEASE"
classpath "org.gradle:test-retry-gradle-plugin:1.1.6"
constraints {
classpath('org.ow2.asm:asm:7.3.1') {
because 'Supports modern JDKs'
}
classpath('org.jfrog.buildinfo:build-info-extractor-gradle:4.13.0') {
because 'Need recent version for Gradle 6+ compatibility'
}
}
}
configurations.classpath.resolutionStrategy.cacheDynamicVersionsFor 0, 'minutes'
}
apply plugin: 'io.spring.release'
apply from: 'dependencies.gradle'
allprojects {
apply plugin: 'io.spring.license'
afterEvaluate { project ->
println "I'm configuring $project.name with version $project.version"
}
group = 'io.micrometer'
}
subprojects {
if (project.name != 'micrometer-bom') {
if (project.name.contains('samples') || project.name.contains('benchmarks')) {
apply plugin: 'java'
} else {
apply plugin: 'java-library'
}
apply plugin: 'checkstyle'
apply plugin: 'io.spring.nohttp'
apply plugin: 'org.gradle.test-retry'
java {
// It is more idiomatic to define different features for different sets of optional
// dependencies, e.g., 'dropwizard' and 'reactor'. If this library published Gradle
// metadata, Gradle users would be able to use these feature names in their dependency
// declarations instead of understanding the actual required optional dependencies.
// But we don't publish Gradle metadata yet and this may be overkill so just have a
// single feature for now to correspond to any optional dependency.
registerFeature('optional') {
usingSourceSet(sourceSets.main)
}
}
// All projects use optional annotations, but since we don't expose them downstream we would
// have to add the dependency in every project, which is tedious so just do it here.
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:0.0.20")
}
tasks {
compileJava {
options.encoding = 'UTF-8'
options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
// ensure Java 8 baseline is enforced for main source
if (JavaVersion.current().isJava9Compatible()) {
options.release = 8
}
}
compileTestJava {
options.encoding = 'UTF-8'
options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
//noinspection GroovyAssignabilityCheck
test {
// set heap size for the test JVM(s)
maxHeapSize = "1500m"
useJUnitPlatform {
excludeTags 'docker'
}
retry {
maxFailures = 5
maxRetries = 3
}
}
task dockerTest(type: Test) {
// set heap size for the test JVM(s)
maxHeapSize = "1500m"
useJUnitPlatform {
includeTags 'docker'
}
}
task shenandoahTest(type: Test) {
// set heap size for the test JVM(s)
maxHeapSize = "1500m"
useJUnitPlatform {
includeTags 'gc'
}
jvmArgs '-XX:+UseShenandoahGC'
}
task zgcTest(type: Test) {
// set heap size for the test JVM(s)
maxHeapSize = "1500m"
useJUnitPlatform {
includeTags 'gc'
}
jvmArgs '-XX:+UseZGC'
}
license {
ext.year = Calendar.getInstance().get(Calendar.YEAR)
skipExistingHeaders = true
}
// Publish resolved versions.
plugins.withId('maven-publish') {
publishing {
publications {
nebula(MavenPublication) {
versionMapping {
allVariants {
fromResolutionResult()
}
}
// We publish resolved versions so don't need to publish our dependencyManagement
// too. This is different from many Maven projects, where published artifacts often
// don't include resolved versions and have a parent POM including dependencyManagement.
pom.withXml {
def dependencyManagement = asNode().get('dependencyManagement')
if (dependencyManagement != null) {
asNode().remove(dependencyManagement)
}
}
}
}
}
}
}
plugins.withId('maven-publish') {
publishing {
publications {
nebula(MavenPublication) {
// Nebula converts dynamic versions to static ones so it's ok.
suppressAllPomMetadataWarnings()
}
}
}
// Nebula doesn't interface with Gradle's module format so just disable it for now.
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
}
dependencyLocking {
lockAllConfigurations()
}
task resolveAndLockAll {
doFirst {
assert gradle.startParameter.writeDependencyLocks
}
doLast {
def skip = ['annotationProcessor', 'apt', 'testAnnotationProcessor', 'checkstyle',
'shadow', 'testApt', 'archives', 'junitPlatform']
configurations.each {
if (it.canBeResolved && !skip.contains(it.name)) {
it.resolve()
}
}
}
}
if(!['samples', 'benchmarks'].find{project.name.contains(it)}) {
apply plugin: 'io.spring.publishing'
if (project.name != 'micrometer-bom') {
jar {
manifest.attributes.put('Automatic-Module-Name', project.name.replace('-', '.'))
metaInf {
from "$rootDir/LICENSE"
from "$rootDir/NOTICE"
}
}
}
contacts {
moniker 'Tommy Ludwig'
github 'shakuzen'
}
}
if (project.extensions.findByName('bintray')) {
bintray.labels = ['micrometer', 'atlas', 'metrics', 'prometheus', 'spectator', 'influx', 'new-relic', 'signalfx', 'wavefront', 'elastic', 'dynatrace', 'azure-monitor', 'appoptics', 'kairos', 'stackdriver']
bintray.packageName = 'io.micrometer'
}
}
description = 'Application monitoring instrumentation facade'
repositories {
mavenCentral()
mavenLocal()
}
def check = tasks.findByName('check')
if (check) project.rootProject.tasks.releaseCheck.dependsOn check
}
wrapper {
gradleVersion = '6.7'
}
defaultTasks 'build'