forked from reactor/reactor-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
264 lines (225 loc) · 7.52 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
/*
* Copyright (c) 2011-2017 Pivotal Software Inc, 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.api.internal.plugins.osgi.OsgiHelper
buildscript {
ext.kotlinVersion = '1.3.31'
repositories {
maven { url "https://repo.spring.io/plugins-release" }
}
dependencies {
classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.7'
classpath 'io.spring.gradle:spring-io-plugin:0.0.4.RELEASE'
classpath "com.github.jengelman.gradle.plugins:shadow:4.0.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
}
}
plugins {
id 'org.asciidoctor.convert' version '1.5.11'
id "me.champeau.gradle.japicmp" version "0.2.6"
id "de.undercouch.download" version "3.4.3"
id "org.unbroken-dome.test-sets" version "2.1.1" apply false // 2.x version does not work with Gradle 4.10
}
apply from: "gradle/doc.gradle"
apply from: "gradle/setup.gradle"
ext {
//also set up the special version at root, for refguide
if (project.hasProperty('versionBranch') && version.toString().endsWith(".BUILD-SNAPSHOT")) {
versionBranch = versionBranch.replaceAll("\"", "").trim()
if (!versionBranch.isEmpty()) {
realVersion = version.toString().replace("BUILD-SNAPSHOT", versionBranch + ".BUILD-SNAPSHOT")
project.version = realVersion
}
}
def ciServers = ["CI", "CONTINUOUS_INTEGRATION", "TRAVIS", "CIRCLECI", "bamboo_planKey"]
ciServers.retainAll(System.getenv().keySet())
isCiServer = !ciServers.isEmpty()
if (isCiServer) {
println "Detected CI environment: $ciServers"
}
// Metrics
micrometerVersion = 'latest.release' //TODO specify a version of micrometer?
// Logging
slf4jVersion = '1.7.12'
logbackVersion = '1.1.2'
// Testing
assertJVersion = '3.11.1'
mockitoVersion = '2.23.0'
jUnitParamsVersion = '1.1.1'
awaitilityVersion = '3.1.2'
throwingFunctionVersion = '1.5.0'
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/"
}
javadocLinks = [jdkJavadoc,
"https://www.reactive-streams.org/reactive-streams-1.0.3-javadoc/"] as String[]
bundleImportPackages = ['org.slf4j;resolution:=optional;version="[1.5.4,2)"',
'kotlin.*;resolution:=optional',
'io.micrometer.*;resolution:=optional',
'!javax.annotation',
'!javax.annotation.meta',
'*']
}
configure(subprojects) { p ->
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'jacoco'
apply plugin: 'propdeps'
description = 'Non-Blocking Reactive Foundation for the JVM'
group = 'io.projectreactor'
ext {
//set up special version per sub-project
//(the root level configuration doesn't seem to propagate)
if (project.hasProperty('versionBranch') && version.toString().endsWith(".BUILD-SNAPSHOT")) {
versionBranch = versionBranch.replaceAll("\"", "").trim()
if (!versionBranch.isEmpty()) {
realVersion = p.version.toString().replace("BUILD-SNAPSHOT", versionBranch + ".BUILD-SNAPSHOT")
p.version = realVersion
println "Building special ${project} snapshot ${p.version}"
println "OSGI version would be: ${new OsgiHelper().getVersion(p.version.toString())}"
}
}
}
repositories {
mavenLocal()
if (version.endsWith('BUILD-SNAPSHOT') || project.hasProperty('platformVersion')) {
maven { url 'https://repo.spring.io/libs-snapshot' }
}
mavenCentral()
jcenter()
maven { url 'https://repo.spring.io/libs-milestone' }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
jacoco {
toolVersion = '0.8.2'
}
jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
}
}
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
[compileJava, compileTestJava]*.options*.compilerArgs =
["-Xlint:-varargs", // intentionally disabled
"-Xlint:cast",
"-Xlint:classfile",
"-Xlint:dep-ann",
"-Xlint:divzero",
"-Xlint:empty",
"-Xlint:finally",
"-Xlint:overrides",
"-Xlint:path",
"-Xlint:processing",
"-Xlint:static",
"-Xlint:try",
"-Xlint:deprecation",
"-Xlint:unchecked",
"-Xlint:-serial", // intentionally disabled
"-Xlint:-options", // intentionally disabled
"-Xlint:-fallthrough", // intentionally disabled
"-Xlint:-rawtypes" // TODO enable and fix warnings
]
compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
compileTestJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.freeCompilerArgs = ["-Xjsr305=strict"]
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.freeCompilerArgs = ["-Xjsr305=strict"]
}
if (JavaVersion.current().isJava8Compatible()) {
compileTestJava.options.compilerArgs += "-parameters"
p.tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
//includes for base test task (see below for additional common configurations)
test {
include '**/*Tests.*'
include '**/*Test.*'
include '**/*Spec.*'
}
//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"
stackTraceFilters "ENTRY_POINT"
maxGranularity 3
}
if (isCiServer) {
def stdout = new LinkedList<TestOutputEvent>()
beforeTest { TestDescriptor td ->
stdout.clear()
}
onOutput { TestDescriptor td, TestOutputEvent toe ->
stdout.add(toe)
}
afterTest { TestDescriptor td, TestResult tr ->
if (tr.resultType == TestResult.ResultType.FAILURE && stdout.size() > 0) {
def stdOutput = stdout.collect {
it.getDestination().name() == "StdErr"
? "STD_ERR: ${it.getMessage()}"
: "STD_OUT: ${it.getMessage()}"
}
.join()
println "This is the console output of the failing test below:\n$stdOutput"
}
}
}
if (JavaVersion.current().isJava9Compatible()) {
println "Java 9+: 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)")
}
}
}
}
if (project.hasProperty('platformVersion')) {
apply plugin: 'spring-io'
dependencyManagement {
springIoTestRuntime {
imports {
mavenBom "io.spring.platform:platform-bom:$platformVersion"
}
}
}
}
assemble.dependsOn docsZip