forked from reactor/reactor-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
276 lines (244 loc) · 8.95 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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
/*
* Copyright (c) 2011-2021 VMware Inc. or its affiliates, All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.gradle.util.VersionNumber
import java.text.SimpleDateFormat
buildscript {
// we define kotlin version for benefit of both core and test (see kotlin-gradle-plugin below)
ext.kotlinVersion = '1.5.31'
repositories {
mavenCentral()
maven { url "https://repo.spring.io/plugins-release" }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.24.18" //applied in individual submodules
}
}
plugins {
id "com.github.johnrengelman.shadow" version "7.0.0"
id 'org.asciidoctor.jvm.convert' version '3.3.2' apply false
id 'org.asciidoctor.jvm.pdf' version '3.3.2' apply false
id "me.champeau.gradle.japicmp" version "0.3.0"
id "de.undercouch.download" version "4.1.2"
id "org.unbroken-dome.test-sets" version "4.0.0" apply false
// note: build scan plugin now must be applied in settings.gradle
// plugin portal is now outdated due to bintray sunset, at least for artifactory gradle plugin
id 'biz.aQute.bnd.builder' version '5.3.0' apply false
id 'io.spring.nohttp' version '0.0.9'
id "io.github.reyerizo.gradle.jcstress" version "0.8.11" apply false
id "com.diffplug.spotless" version "5.15.0"
}
apply plugin: "io.reactor.gradle.detect-ci"
apply from: "gradle/asciidoc.gradle" // asciidoc (which is generated from root dir)
apply from: "gradle/releaser.gradle"
repositories { //needed at root for asciidoctor and nohttp-checkstyle
mavenCentral()
}
ext {
jdk = JavaVersion.current().majorVersion
jdkJavadoc = "https://docs.oracle.com/javase/$jdk/docs/api/"
if (JavaVersion.current().isJava11Compatible()) {
jdkJavadoc = "https://docs.oracle.com/en/java/javase/$jdk/docs/api/"
}
println "JDK Javadoc link for this build is ${rootProject.jdkJavadoc}"
versionNumber = VersionNumber.parse(version.toString())
if (versionNumber.qualifier == null || versionNumber.qualifier.size() == 0) {
osgiVersion = "${version}.RELEASE"
println "$version is a release, will use $osgiVersion for bnd"
}
else if (versionNumber.qualifier.equalsIgnoreCase("SNAPSHOT")) {
def sdf = new SimpleDateFormat("yyyyMMddHHmm");
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
def buildTimestamp = sdf.format(new Date())
osgiVersion = "${versionNumber.major}.${versionNumber.minor}.${versionNumber.micro}.BUILD-$buildTimestamp"
println "$version is a snapshot, will use $osgiVersion for bnd"
}
else {
osgiVersion = "${versionNumber.major}.${versionNumber.minor}.${versionNumber.micro}.${versionNumber.qualifier}"
println "$version is neither release nor snapshot, will use $osgiVersion for bnd"
}
/*
* Note that some versions can be bumped by a script.
* These are found in `gradle.properties`...
*
* Versions not necessarily bumped by a script (testing, etc...) below:
*/
// Misc not often upgraded
jsr166BackportVersion = '1.0.0.RELEASE'
// Used as a way to get jsr305 annotations.
// 3.0.1 is the last version that has the 'annotations' jar needed on the compile classpath
findbugsVersion = '3.0.1'
// Blockhound
blockhoundVersion = '1.0.6.RELEASE'
// Logging
slf4jVersion = '1.7.32'
logbackVersion = '1.2.9'
// Testing
jUnitPlatformVersion = '5.8.2' //needs to be manually synchronized in buildSrc
assertJVersion = '3.21.0' //needs to be manually synchronized in buildSrc
mockitoVersion = '3.12.4'
awaitilityVersion = '4.1.1'
throwingFunctionVersion = '1.5.1'
javaObjectLayoutVersion = '0.16'
testNgVersion = '7.4.0'
archUnitVersion = '0.22.0'
// For reactor-tools
byteBuddyVersion = '1.12.5' //dependency, but plugin usage is now in a mock build done via TestKit
cgLibVersion = '3.3.0'
// JMH
jmhVersion = '1.33'
}
// only publish scan if a specific gradle entreprise server is passed
// typically, for local usage, you would temporarily set the env with:
// `GRADLE_ENTERPRISE_URL=https://myge.example.com/ gradle foo`
if (System.getenv('GRADLE_ENTERPRISE_URL')) {
gradleEnterprise {
buildScan {
captureTaskInputFiles = true
obfuscation {
ipAddresses { addresses -> addresses.collect { '0.0.0.0' } }
}
publishAlways()
server = System.getenv('GRADLE_ENTERPRISE_URL')
}
}
}
nohttp {
source.exclude "docs/asciidoc/highlight/**"
source.exclude "**/build/reports/tests/**/*.html"
allowlistFile = project.file('codequality/nohttp/allowlist.lines')
}
spotless {
if (project.hasProperty("spotlessFrom")) {
if (project.spotlessFrom == "ALL") {
println "[Spotless] Ratchet deactivated"
}
else {
println "[Spotless] Ratchet from $project.spotlessFrom"
ratchetFrom project.spotlessFrom
}
}
else if (isCiServer) {
println "[Spotless] CI detected without explicit branch, not enforcing check"
enforceCheck false
}
else {
String spotlessBranch = "origin/main"
println "[Spotless] Local run detected, ratchet from $spotlessBranch"
ratchetFrom spotlessBranch
}
java {
target '**/*.java'
targetExclude '**/java8stubs/**/*', '**/java9stubs/**/*', '**/scrabble/**/*',
'reactor-core/src/main/java/reactor/util/annotation/NonNull.java',
'reactor-core/src/main/java/reactor/util/annotation/NonNullApi.java',
'reactor-core/src/main/java/reactor/util/annotation/Nullable.java'
licenseHeaderFile('codequality/spotless/licenseSlashstarStyle.txt')
}
}
configure(subprojects) { p ->
apply plugin: 'java'
apply plugin: 'jacoco'
apply from: "${rootDir}/gradle/setup.gradle"
description = 'Non-Blocking Reactive Foundation for the JVM'
group = 'io.projectreactor'
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
mavenLocal()
if (version.endsWith('-SNAPSHOT') || version.contains('-SNAPSHOT-')) { //classic or customized snapshots
//do not wait for Maven Central when going back to snapshots and comparing for baseline
maven { url 'https://repo.spring.io/release' }
maven { url 'https://repo.spring.io/snapshot' }
}
maven { url 'https://repo.spring.io/milestone' }
}
jacocoTestReport {
reports {
xml.required = true
html.required = true
}
}
// includes for base test task (see below for additional common configurations)
test {
include '**/*Tests.*'
include '**/*Test.*'
}
// all test tasks will show FAILED for each test method,
// common exclusions, no scanning
p.tasks.withType(Test).all {
testLogging {
events "FAILED"
showExceptions true
exceptionFormat "FULL"
maxGranularity -1
}
// show progress by displaying test classes, avoiding test suite timeouts
TestDescriptor last
beforeTest { TestDescriptor td ->
if (last != td.getParent() && td.getParent().toString().startsWith("Test class")) {
last = td.getParent()
println last
}
}
if (JavaVersion.current().isJava9Compatible()) {
println "Java ${JavaVersion.current()}: lowering MaxGCPauseMillis to 20ms in ${project.name} ${name}"
jvmArgs = ["-XX:MaxGCPauseMillis=20"]
}
systemProperty("java.awt.headless", "true")
systemProperty("testGroups", p.properties.get("testGroups"))
scanForTestClasses = false
exclude '**/*Abstract*.*'
exclude '**/*OperatorTest*.*'
// allow re-run of failed tests only without special test tasks failing
// because the filter is too restrictive
filter.setFailOnNoMatchingTests(false)
// display intermediate results for special test tasks
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
println('\n' + "${desc} Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)")
}
}
}
}
assemble.dependsOn docsZip
configure(subprojects) { p ->
// these apply once the above configure is done, but before project-specific build.gradle have applied
apply plugin: "io.reactor.gradle.java-conventions"
apply from: "${rootDir}/gradle/javadoc.gradle"
// these apply AFTER project-specific build.gradle have applied
afterEvaluate {
if (p.plugins.hasPlugin("kotlin")) {
println "Applying Kotlin conventions to ${p.name}"
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs = ["-Xjsr305=strict"]
languageVersion = "1.3" //TODO kotlin languageVersion 1.3 is now deprecated
apiVersion = "1.3"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs = ["-Xjsr305=strict"]
languageVersion = "1.3" //TODO kotlin languageVersion 1.3 is now deprecated
apiVersion = "1.3"
}
}
}
}
}