forked from reactor/reactor-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
518 lines (429 loc) · 14.4 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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
/*
* 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
*
* http://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 me.champeau.gradle.japicmp.JapicmpTask
import org.gradle.api.internal.plugins.osgi.OsgiHelper
buildscript {
ext.kotlinVersion = '1.1.61'
repositories {
maven { url "http://repo.spring.io/plugins-release" }
}
dependencies {
classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.7',
'io.spring.gradle:spring-io-plugin:0.0.4.RELEASE',
'com.github.jengelman.gradle.plugins:shadow:1.2.0',
'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.11',
"org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
}
}
plugins {
id 'org.asciidoctor.convert' version '1.5.6'
id "me.champeau.gradle.jmh" version "0.4.4" apply false
id "org.jetbrains.dokka" version "0.9.15"
id "me.champeau.gradle.japicmp" version "0.2.5"
}
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
}
}
// Logging
slf4jVersion = '1.7.12'
logbackVersion = '1.1.2'
// Testing
assertJVersion = '3.9.0'
mockitoVersion = '2.10.0'
javadocLinks = ["https://docs.oracle.com/javase/8/docs/api/",
"https://docs.oracle.com/javaee/6/api/",
"http://www.reactive-streams.org/reactive-streams-1.0.2-javadoc/"] as
String[]
bundleImportPackages = ['org.slf4j;resolution:=optional;version="[1.5.4,2)"',
'kotlin.*;resolution:=optional',
'!javax.annotation',
'!javax.annotation.meta',
'*']
}
configure(subprojects) { p ->
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'jacoco'
apply plugin: 'propdeps'
apply plugin: 'osgi'
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 'http://repo.spring.io/libs-snapshot' }
}
mavenCentral()
jcenter()
maven { url 'http://repo.spring.io/libs-milestone' }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
jacoco {
toolVersion = '0.7.9'
}
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/PASSED for each test method,
// common exclusions, no scanning
p.tasks.withType(Test).all {
testLogging {
events "passed", "failed"
showExceptions true
exceptionFormat "full"
maxGranularity 3
}
systemProperty("java.awt.headless", "true")
systemProperty("reactor.trace.cancel", "true")
systemProperty("reactor.trace.nocapacity", "true")
systemProperty("testGroups", p.properties.get("testGroups"))
scanForTestClasses = false
exclude '**/*Abstract*.*'
exclude '**/*OperatorTest*.*'
}
// now that kotlin-gradle-plugin 1.1.60 is out with fix for https://youtrack.jetbrains.com/issue/KT-17564
// be wary and fail if the issue of source file duplication in jar comes up again
sourcesJar {
duplicatesStrategy = DuplicatesStrategy.FAIL
}
}
if (project.hasProperty('platformVersion')) {
apply plugin: 'spring-io'
dependencyManagement {
springIoTestRuntime {
imports {
mavenBom "io.spring.platform:platform-bom:$platformVersion"
}
}
}
}
project('reactor-core') {
apply plugin: 'idea' //needed to avoid IDEA seeing the jmh folder as source
apply plugin: 'me.champeau.gradle.jmh'
configurations {
compileOnly.extendsFrom jsr166backport
testCompile.extendsFrom jsr166backport
baseline
}
dependencies {
// Reactive Streams
compile "org.reactivestreams:reactive-streams:1.0.2"
testCompile "org.reactivestreams:reactive-streams-tck:1.0.2"
// JSR-305 annotations
optional "com.google.code.findbugs:jsr305:3.0.2"
//Optional Logging Operator
optional "org.slf4j:slf4j-api:$slf4jVersion"
optional("org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}")
//Optional JDK 9 Converter
jsr166backport "io.projectreactor:jsr166:1.0.0.RELEASE"
testCompile 'junit:junit:4.12'
testRuntime "ch.qos.logback:logback-classic:$logbackVersion"
// Testing
testCompile(project(":reactor-test")) {
exclude module: 'reactor-core'
}
testCompile "org.hamcrest:hamcrest-library:1.3",
"org.testng:testng:6.8.5",
"org.assertj:assertj-core:$assertJVersion",
"org.mockito:mockito-core:$mockitoVersion",
"org.openjdk.jol:jol-core:0.9"
baseline("io.projectreactor:reactor-core:$compatibleVersion") {
transitive = false
force = true
}
}
task japicmp(type: JapicmpTask) {
oldClasspath = configurations.baseline
newClasspath = files(jar.archivePath)
onlyBinaryIncompatibleModified = true
failOnModification = true
txtOutputFile = file("${project.buildDir}/reports/japi.txt")
ignoreMissingClasses = true
includeSynthetic = true
}
javadoc {
dependsOn jar
group = "documentation"
description = "Generates aggregated Javadoc API documentation."
title = "Reactor Core $version"
options.addStringOption('charSet', 'UTF-8')
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
options.author = true
options.header = "$project.name"
options.overview = "$rootDir/src/api/overview.html"
options.stylesheetFile = file("$rootDir/src/api/stylesheet.css")
options.links(rootProject.ext.javadocLinks )
options.tags = [ "apiNote:a:API Note:", "implSpec:a:Implementation Requirements:",
"implNote:a:Implementation Note:" ]
// In Java 9, javadoc generator will complain if it finds invalid class files in the classpath
// And Kotlin produces such classes, plus kotlin plugin puts them in the main sourceSet
classpath = sourceSets.main.output.filter { !it.absolutePath.contains("kotlin") }
classpath += sourceSets.main.compileClasspath
maxMemory = "1024m"
destinationDir = new File(project.buildDir, "docs/javadoc")
}
// Need https://github.com/Kotlin/dokka/issues/184 to be fixed to avoid "Can't find node by signature" log spam
task dokka(type: org.jetbrains.dokka.gradle.DokkaTask) {
dependsOn jar
group = "documentation"
description = "Generates Kotlin API documentation."
moduleName = "reactor-core"
jdkVersion = 8
outputFormat = "html"
outputDirectory = new File(project.buildDir, "docs/kdoc")
//this is needed so that links to java classes are resolved
doFirst {
classpath += project.jar.outputs.files.getFiles()
classpath += project.sourceSets.main.compileClasspath
}
//this is needed so that the kdoc only generates for kotlin classes
//(default kotlinTasks sourceSet also includes java)
kotlinTasks {
}
processConfigurations = []
sourceDirs = files("src/main/kotlin")
externalDocumentationLink {
url = new URL("http://projectreactor.io/docs/core/release/api/")
}
externalDocumentationLink {
url = new URL("http://www.reactive-streams.org/reactive-streams-1.0.2-javadoc/")
}
}
task kdocZip(type: Zip, dependsOn: dokka) {
//ends up similar to javadoc jar: reactor-core-xxxx.RELEASE-kdoc.zip
classifier = 'kdoc'
from("${project.buildDir}/docs/kdoc")
}
task testStaticInit(type: Test, group: 'verification') {
systemProperty 'reactor.trace.operatorStacktrace', 'true'
include '**/*TestStaticInit.*'
doFirst {
println "Additional tests from `testStaticInit` ($includes)"
}
}
task loops(type: Test, group: 'verification') {
mustRunAfter testStaticInit
include '**/*Loop.*'
doFirst {
println "Additional tests from `loops` ($includes)"
}
}
task testNG(type: Test, group: 'verification') {
mustRunAfter testStaticInit
useTestNG()
include '**/*Verification.*'
doFirst {
println "Additional tests from `testNG` ($includes)"
}
}
//inherit basic test task + common configuration in root
//always depend on testStaticInit, skip testNG on Travis, skip loops when not releasing
//note that this way the tasks can be run individually
test {
dependsOn testStaticInit
if (System.env.TRAVIS != "true") {
dependsOn testNG
}
if (!version.endsWith('BUILD-SNAPSHOT')) {
dependsOn loops
}
}
sourceSets.test.resources.srcDirs = ["src/test/resources", "src/test/java"]
if (!JavaVersion.current().isJava9Compatible()) {
test {
jvmArgs = ["-Xbootclasspath/p:" + configurations.jsr166backport.asPath]
}
}
jar {
manifest {
attributes 'Implementation-Title': 'reactor-core',
'Implementation-Version': version
instruction 'Import-Package', bundleImportPackages.join(',')
}
}
artifacts {
archives sourcesJar
archives javadocJar
archives docsZip
if (!JavaVersion.current().isJava9Compatible())
archives kdocZip
}
jacocoTestReport.dependsOn test
check.dependsOn jacocoTestReport
jar.finalizedBy(japicmp)
}
project('reactor-test') {
description = 'Reactor Test support'
configurations {
baseline
}
dependencies {
compile project(":reactor-core")
testCompile 'junit:junit:4.12'
testRuntime "ch.qos.logback:logback-classic:$logbackVersion"
testCompile "org.hamcrest:hamcrest-library:1.3",
"org.assertj:assertj-core:$assertJVersion",
"org.mockito:mockito-core:$mockitoVersion"
baseline("io.projectreactor:reactor-test:$compatibleVersion") {
transitive = false
force = true
}
}
task japicmp(type: JapicmpTask) {
oldClasspath = configurations.baseline
newClasspath = files(jar.archivePath)
onlyBinaryIncompatibleModified = true
failOnModification = true
txtOutputFile = file("${project.buildDir}/reports/japi.txt")
ignoreMissingClasses = true
includeSynthetic = true
}
javadoc {
dependsOn jar
group = "documentation"
description = "Generates aggregated Javadoc API documentation."
title = "Reactor Test $version"
options.addStringOption('charSet', 'UTF-8')
options.memberLevel = JavadocMemberLevel.PROTECTED
options.author = true
options.header = "$project.name"
options.stylesheetFile = file("$rootDir/src/api/stylesheet.css")
options.links(rootProject.ext.javadocLinks
.plus("http://projectreactor.io/docs/core/release/api/") as String[])
options.tags = [ "apiNote:a:API Note:", "implSpec:a:Implementation Requirements:",
"implNote:a:Implementation Note:" ]
// In Java 9, javadoc generator will complain if it finds invalid class files in the classpath
// And Kotlin produces such classes, plus kotlin plugin puts them in the main sourceSet
classpath = sourceSets.main.output.filter { !it.absolutePath.contains("kotlin") }
classpath += sourceSets.main.compileClasspath
maxMemory = "1024m"
destinationDir = new File(project.buildDir, "docs/javadoc")
}
// Need https://github.com/Kotlin/dokka/issues/184 to be fixed to avoid "Can't find node by signature" log spam
task dokka(type: org.jetbrains.dokka.gradle.DokkaTask) {
dependsOn jar
group = "documentation"
description = "Generates Kotlin API documentation."
moduleName = "reactor-test"
jdkVersion = 8
outputFormat = "html"
outputDirectory = new File(project.buildDir, "docs/kdoc")
//this is needed so that links to java classes are resolved
doFirst {
classpath += project.jar.outputs.files.getFiles()
classpath += project.sourceSets.main.compileClasspath
}
//this is needed so that the kdoc only generates for kotlin classes
//(default kotlinTasks sourceSet also includes java)
kotlinTasks {
}
processConfigurations = []
sourceDirs = files("src/main/kotlin")
externalDocumentationLink {
url = new URL("http://projectreactor.io/docs/core/release/api/")
}
externalDocumentationLink {
url = new URL("http://projectreactor.io/docs/test/release/api/")
}
externalDocumentationLink {
url = new URL("http://www.reactive-streams.org/reactive-streams-1.0.2-javadoc/")
}
}
task kdocZip(type: Zip, dependsOn: dokka) {
//ends up similar to javadoc jar: reactor-test-xxx.RELEASE-kdoc.zip
classifier = 'kdoc'
from("${project.buildDir}/docs/kdoc")
}
artifacts {
if (!JavaVersion.current().isJava9Compatible())
archives kdocZip
}
jar.finalizedBy(japicmp)
}
assemble.dependsOn docsZip