-
Notifications
You must be signed in to change notification settings - Fork 82
/
build.gradle
270 lines (229 loc) · 7.32 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
import org.gradle.util.VersionNumber
import java.text.SimpleDateFormat
/*
* 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.
*/
buildscript {
repositories {
mavenCentral()
maven { url "https://repo.spring.io/plugins-release" }
}
}
plugins {
alias(libs.plugins.bnd) apply false
alias(libs.plugins.artifactory) apply false
}
description = 'Reactor Core Addons including processors, adapters and more'
ext {
//NOTE: all dependencies, including plugins, are defined in gradle/libs.versions.toml catalog
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}"
javadocLinks = [
"https://projectreactor.io/docs/core/${libs.versions.reactorCore.get()}/api/",
jdkJavadoc,
"https://www.reactive-streams.org/reactive-streams-${libs.versions.reactiveStreams.get()}-javadoc/"
] as String[]
//OSGI version number
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"
}
}
apply from: "${rootDir}/gradle/releaser.gradle"
configurations.all {
// check for updates every build
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
configure(subprojects) { project ->
group = 'io.projectreactor.addons'
apply plugin: 'java-library'
apply from: "${rootDir}/gradle/setup.gradle"
apply from: "${rootDir}/gradle/javadoc.gradle"
[compileJava, compileTestJava]*.options*.compilerArgs = ["-Xlint:varargs",
"-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
}
if (JavaVersion.current().isJava8Compatible()) {
compileTestJava.options.compilerArgs += "-parameters"
}
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
sourceSets.test.resources.srcDirs = ["src/test/resources", "src/test/java"]
project.tasks.withType(Test).all {
scanForTestClasses = false
include '**/*Tests.*'
include '**/*Test.*'
exclude '**/*Abstract*.*'
}
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
if (version.endsWith('-SNAPSHOT')) {
mavenLocal()
maven { url 'https://repo.spring.io/snapshot' }
}
maven { url 'https://repo.spring.io/milestone' }
}
// dependencies that are common across all java projects
dependencies {
api libs.reactorCore
// JSR-305 annotations
compileOnly libs.jsr305
testCompileOnly libs.jsr305
// Logging
compileOnly libs.slf4j
testCompileOnly libs.slf4j
// Testing
testImplementation libs.junit4
testImplementation libs.hamcrest
testImplementation libs.assertj
testImplementation libs.quickTheories
testImplementation libs.testNg
testImplementation libs.reactorTest
testRuntimeOnly libs.logback
}
}
project('reactor-adapter') {
ext {
shortDescription = "Reactor Adapter"
}
description = 'Adapters from/to RxJava2, RxJava3 and Akka'
apply plugin: "biz.aQute.bnd.builder"
ext {
bndOptions = [
"-exportcontents": "reactor.*;version=$osgiVersion;-noimport:=true",
"Import-Package": [
"!*internal*",
"!javax.annotation",
"*"
].join(","),
"Bundle-Name" : "reactor-adapter",
"Bundle-SymbolicName" : "io.projectreactor.addons.reactor-adapter",
"Bundle-Version" : "$osgiVersion"
]
}
dependencies {
//Optional RxJava 2 Converter
compileOnly libs.rxJava2
testImplementation libs.rxJava2
//Optional RxJava 3 Converter
compileOnly libs.rxJava3
testImplementation libs.rxJava3
compileOnly libs.akkaActor
testImplementation libs.akkaActor
testImplementation libs.reactiveStreams.tck
}
jar {
manifest {
attributes('Automatic-Module-Name': 'reactor.adapter')
}
bnd(bndOptions)
}
}
project('reactor-extra') {
ext {
shortDescription = "Reactor Extra"
}
description = 'Reactor Extra utilities, helpers and custom operators'
apply plugin: "biz.aQute.bnd.builder"
repositories {
maven { url "https://maven-eclipse.github.io/maven" }
}
ext {
bndOptions = [
"-exportcontents" : "reactor.*;version=$osgiVersion;-noimport:=true",
"Import-Package": [
"!*internal*",
"!javax.annotation",
"org.eclipse.*;resolution:=optional",
"javax.swing.*;resolution:=optional",
"*"
].join(","),
"Bundle-Name" : "reactor-extra",
"Bundle-SymbolicName" : "io.projectreactor.addons.reactor-extra",
"Bundle-Version" : "$osgiVersion"
]
}
dependencies {
compileOnly getSwtPlatform()
testImplementation getSwtPlatform()
testImplementation libs.reactiveStreams.tck
testImplementation libs.mockito
}
jar {
manifest {
attributes('Automatic-Module-Name': 'reactor.extra')
}
bnd(bndOptions)
}
}
def getSwtPlatform() {
String osname = System.properties['os.name']
String osarch = System.properties['os.arch']
if (osname.toLowerCase(Locale.ROOT).contains('win')) {
if (osarch.contains("64")) {
return libs.swt.windows64
}
return libs.swt.windows
}
if (osname.toLowerCase(Locale.ROOT).contains("nux")) {
if (osarch.contains("64")) {
return libs.swt.linux64
}
return libs.swt.linux
}
if (osname.toLowerCase(Locale.ROOT).contains("mac")) {
return libs.swt.mac
}
throw new RuntimeException("Unknown OS/Arch: " + osname + ", " + osarch)
}