/
build.gradle
336 lines (294 loc) · 15.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
/*
* Copyright (c) 2020-2022 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 me.champeau.gradle.japicmp.JapicmpTask
apply plugin: 'io.spring.javadoc'
apply plugin: 'me.champeau.gradle.japicmp'
apply plugin: 'de.undercouch.download'
apply plugin: 'biz.aQute.bnd.builder'
ext {
bndOptions = [
"Export-Package" : "reactor.netty5.http*;version=$osgiVersion;-noimport:=true",
"Import-Package": [
"!javax.annotation",
"io.netty5.channel.kqueue;resolution:=optional;version=\"[5.0,6)\"",
"io.netty.contrib.handler.codec.haproxy;resolution:=optional;version=\"[5.0,6)\"",
"io.netty.incubator.channel.uring;resolution:=optional",
"io.micrometer.*;resolution:=optional",
"*"
].join(","),
"Bundle-Name" : "reactor-netty5-http",
"Bundle-SymbolicName" : "io.projectreactor.netty.reactor-netty5-http",
"Bundle-Version" : "$osgiVersion"
]
}
sourceSets {
noMicrometerTest {
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
}
}
configurations {
noMicrometerTestImplementation {
extendsFrom implementation
exclude group: 'io.micrometer'
}
noMicrometerTestRuntimeOnly.extendsFrom(runtimeOnly)
}
dependencies {
api project(path: ':reactor-netty5-core', configuration: 'shadow')
// JSR-305 annotations
compileOnly "com.google.code.findbugs:jsr305:$jsr305Version"
api "io.netty:netty-buffer:$nettyByteBufVersion"
api "io.netty.contrib:netty-handler-proxy:$nettyContribVersion"
api "io.netty:netty5-codec-http:$nettyVersion"
api "io.netty:netty5-codec-http2:$nettyVersion"
api "io.netty:netty5-resolver-dns:$nettyVersion"
// MacOS binaries are not available for Netty SNAPSHOT version
if (!"$nettyVersion".endsWithAny("SNAPSHOT")) {
if (osdetector.classifier == "osx-x86_64" || osdetector.classifier == "osx-aarch_64") {
testImplementation "io.netty:netty5-resolver-dns-native-macos:$nettyVersion$os_suffix"
}
else {
testImplementation "io.netty:netty5-resolver-dns-classes-macos:$nettyVersion"
}
}
else {
// MacOS binaries are not available for Netty SNAPSHOT version
testImplementation "io.netty:netty5-resolver-dns-classes-macos:$nettyVersion"
}
compileOnly "io.netty.contrib:netty-codec-haproxy:$nettyContribVersion"
//transport resolution: typical build forces epoll but not kqueue transitively
//on the other hand, if we want to make transport-specific tests, we'll make all
// native optional at compile time and add correct native/nio to testRuntime
if (project.hasProperty("forceTransport")) {
//so that the main code compiles
compileOnly "io.netty:netty5-transport-classes-epoll:$nettyVersion"
compileOnly "io.netty:netty5-transport-classes-kqueue:$nettyVersion"
//compileOnly "io.netty.incubator:netty-incubator-transport-native-io_uring:$nettyIoUringVersion"
//now we explicitly add correctly qualified native, or do nothing if we want to test NIO
if (forceTransport == "native") {
if (osdetector.os == "osx") {
testRuntimeOnly "io.netty:netty5-transport-native-kqueue:$nettyVersion$os_suffix"
}
else if (osdetector.os == "linux") {
testRuntimeOnly "io.netty:netty5-transport-native-epoll:$nettyVersion$os_suffix"
}
}
//else if (forceTransport == "io_uring" && osdetector.os == "linux") {
// testRuntimeOnly "io.netty.incubator:netty-incubator-transport-native-io_uring:$nettyIoUringVersion$os_suffix"
//}
else if (forceTransport != "nio") {
throw new InvalidUserDataException("invalid -PforceTranport option " + forceTransport + ", should be native|nio")
}
}
else {
//classic build to be distributed
api "io.netty:netty5-transport-native-epoll:$nettyVersion:linux-x86_64"
compileOnly "io.netty:netty5-transport-classes-kqueue:$nettyVersion"
//compileOnly "io.netty.incubator:netty-incubator-transport-native-io_uring:$nettyIoUringVersion"
}
//Metrics
compileOnly "io.micrometer:micrometer-core:$micrometerVersion"
compileOnly "io.micrometer:micrometer-tracing:$micrometerTracingVersion"
// Logging
compileOnly "org.slf4j:slf4j-api:$slf4jVersion"
api "io.projectreactor:reactor-core:$reactorCoreVersion"
testImplementation(testFixtures(project(':reactor-netty5-core'))) {
exclude module: "reactor-netty5-core"
}
// Testing
// JSR-305 annotations
testCompileOnly "com.google.code.findbugs:jsr305:$jsr305Version"
testImplementation "org.mockito:mockito-core:$mockitoVersion"
testImplementation "io.specto:hoverfly-java-junit5:$hoverflyJavaVersion"
testImplementation "org.apache.tomcat.embed:tomcat-embed-core:$tomcatVersion"
testImplementation "io.projectreactor:reactor-test:$testAddonVersion"
testImplementation "org.assertj:assertj-core:$assertJVersion"
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
testImplementation "org.junit.jupiter:junit-jupiter-params:$junitVersion"
testImplementation "io.projectreactor.tools:blockhound-junit-platform:$blockHoundVersion"
testImplementation "io.micrometer:micrometer-core:$micrometerVersion"
testImplementation "io.micrometer:micrometer-test:$micrometerVersion"
testImplementation "io.micrometer:micrometer-tracing-integration-test:$micrometerTracingVersion"
testImplementation "io.netty.contrib:netty-codec-extras:$nettyContribVersion"
testImplementation "org.reflections:reflections:$reflectionsVersion"
testRuntimeOnly "org.junit.platform:junit-platform-launcher:$junitPlatformLauncherVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
testRuntimeOnly "org.slf4j:jcl-over-slf4j:$slf4jVersion"
testRuntimeOnly "ch.qos.logback:logback-classic:$logbackVersion"
// Needed for proxy testing
testRuntimeOnly "io.netty.contrib:netty-handler-proxy:$nettyContribVersion"
testRuntimeOnly "io.netty.contrib:netty-codec-haproxy:$nettyContribVersion"
// Needed for HTTP/2 testing
testRuntimeOnly "io.netty:netty-tcnative-boringssl-static:$boringSslVersion$os_suffix"
// https://github.com/netty/netty/pull/11487
// https://github.com/netty/netty/issues/10317
// Necessary for generating SelfSignedCertificate on Java version >= 15
testRuntimeOnly "org.bouncycastle:bcpkix-jdk15on:$bouncycastleVersion"
noMicrometerTestRuntimeOnly "org.bouncycastle:bcpkix-jdk15on:$bouncycastleVersion"
// noMicrometerTest sourceSet (must not include Micrometer)
noMicrometerTestImplementation "org.assertj:assertj-core:$assertJVersion"
noMicrometerTestImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
noMicrometerTestRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
noMicrometerTestRuntimeOnly "ch.qos.logback:logback-classic:$logbackVersion"
}
jar {
manifest {
attributes("Automatic-Module-Name": "reactor.netty5.http")
}
bnd(bndOptions)
}
task downloadBaseline(type: Download) {
onlyIf {
if (project.gradle.startParameter.isOffline()) {
println "Offline: skipping downloading of baseline and JAPICMP"
return false
}
else if ("$compatibleVersion" == "SKIP") {
println "SKIP: Instructed to skip the baseline comparison"
return false
}
else {
println "Will download and perform baseline comparison with ${compatibleVersion}"
return true
}
}
onlyIfNewer true
compress true
src "${repositories.mavenCentral().url}io/projectreactor/netty/reactor-netty-http/$compatibleVersion/reactor-netty-http-${compatibleVersion}.jar"
dest "${buildDir}/baselineLibs/reactor-netty-http-${compatibleVersion}.jar"
}
def japicmpReport = tasks.register('japicmpReport') {
onlyIf {
japicmp.state.failure != null
}
doLast {
def reportFile = file("${project.buildDir}/reports/japi.txt")
if (reportFile.exists()) {
println "\n **********************************"
println " * /!\\ API compatibility failures *"
println " **********************************"
println "Japicmp report was filtered and interpreted to find the following incompatibilities:"
reportFile.eachLine {
if (it.contains("*") && (!it.contains("***") || it.contains("****")))
println "source incompatible change: $it"
else if (it.contains("!"))
println "binary incompatible change: $it"
}
}
else println "No incompatible change to report"
}
}
task japicmp(type: JapicmpTask) {
finalizedBy(japicmpReport)
onlyIf { "$compatibleVersion" != "SKIP" }
oldClasspath.from(files("${buildDir}/baselineLibs/reactor-netty-http-${compatibleVersion}.jar"))
newClasspath.from(files(jar.archiveFile))
// these onlyXxx parameters result in a report that is slightly too noisy, but better than
// onlyBinaryIncompatibleModified = true which masks source-incompatible-only changes
onlyBinaryIncompatibleModified = false
onlyModified = true
failOnModification = true
failOnSourceIncompatibility = true
txtOutputFile = file("${project.buildDir}/reports/japi.txt")
ignoreMissingClasses = true
includeSynthetic = true
compatibilityChangeExcludes = [ "METHOD_NEW_DEFAULT" ]
fieldExcludes = [
'reactor.netty.http.websocket.WebsocketOutbound#stringToWebsocketFrame',
// Deprecated field is removed
'reactor.netty.http.HttpDecoderSpec#DEFAULT_MAX_CHUNK_SIZE'
]
methodExcludes = [
'reactor.netty.http.HttpOperations#send(org.reactivestreams.Publisher)',
'reactor.netty.http.client.HttpClient$ResponseReceiver#responseContent()',
'reactor.netty.http.client.HttpClient$WebsocketReceiver#receive()',
// Deprecated methods are removed
'reactor.netty.http.Cookies#newServerRequestHolder(io.netty.handler.codec.http.HttpHeaders, io.netty.handler.codec.http.cookie.ServerCookieDecoder)',
'reactor.netty.http.HttpDecoderSpec#maxChunkSize()',
'reactor.netty.http.HttpDecoderSpec#maxChunkSize(int)',
'reactor.netty.http.HttpOperations#addHandler(java.lang.String, io.netty.channel.ChannelHandler)',
'reactor.netty.http.client.HttpClient#from(reactor.netty.tcp.TcpClient)',
'reactor.netty.http.client.HttpClient#tcpConfiguration(java.util.function.Function)',
'reactor.netty.http.client.HttpClientInfos#currentContext()',
'reactor.netty.http.server.HttpServer#accessLog(java.util.function.Function)',
'reactor.netty.http.server.HttpServer#from(reactor.netty.tcp.TcpServer)',
'reactor.netty.http.server.HttpServer#tcpConfiguration(java.util.function.Function)',
'reactor.netty.http.server.logging.AccessLogArgProvider#zonedDateTime()',
// TODO temporary disable multipart on the client
'reactor.netty.http.client.HttpClient$RequestSender#sendForm(java.util.function.BiConsumer)',
'reactor.netty.http.client.HttpClient$RequestSender#sendForm(java.util.function.BiConsumer, java.util.function.Consumer)',
// TODO temporary disable multipart on the server
'reactor.netty.http.server.HttpServerRequest#receiveForm()',
'reactor.netty.http.server.HttpServerRequest#receiveForm(java.util.function.Consumer)',
// Changes related to Netty 5 package change
'reactor.netty.http.HttpInfos#method()',
'reactor.netty.http.HttpInfos#version()',
'reactor.netty.http.HttpResources#getOrCreateDefaultResolver()',
'reactor.netty.http.client.HttpClient#cookie(io.netty.handler.codec.http.cookie.Cookie)',
'reactor.netty.http.client.HttpClient#cookieCodec(io.netty.handler.codec.http.cookie.ClientCookieEncoder)',
'reactor.netty.http.client.HttpClient#cookieCodec(io.netty.handler.codec.http.cookie.ClientCookieEncoder, io.netty.handler.codec.http.cookie.ClientCookieDecoder)',
'reactor.netty.http.client.HttpClient#request(io.netty.handler.codec.http.HttpMethod)',
'reactor.netty.http.client.HttpClientConfig#cookieDecoder()',
'reactor.netty.http.client.HttpClientConfig#cookieEncoder()',
'reactor.netty.http.client.HttpClientConfig#defaultAddressResolverGroup()',
'reactor.netty.http.client.HttpClientConfig#headers()',
'reactor.netty.http.client.HttpClientConfig#method()',
'reactor.netty.http.client.HttpClientInfos#requestHeaders()',
'reactor.netty.http.client.HttpClientRequest#addCookie(io.netty.handler.codec.http.cookie.Cookie)',
'reactor.netty.http.client.HttpClientRequest#headers(io.netty.handler.codec.http.HttpHeaders)',
'reactor.netty.http.client.HttpClientResponse#responseHeaders()',
'reactor.netty.http.client.HttpClientResponse#status()',
'reactor.netty.http.client.WebsocketClientSpec#version()',
'reactor.netty.http.client.WebsocketClientSpec$Builder#version(io.netty.handler.codec.http.websocketx.WebSocketVersion)',
'reactor.netty.http.server.HttpRouteHandlerMetadata#getMethod()',
'reactor.netty.http.server.HttpServer#channelGroup(io.netty.channel.group.ChannelGroup)',
'reactor.netty.http.server.HttpServer#cookieCodec(io.netty.handler.codec.http.cookie.ServerCookieEncoder)',
'reactor.netty.http.server.HttpServer#cookieCodec(io.netty.handler.codec.http.cookie.ServerCookieEncoder, io.netty.handler.codec.http.cookie.ServerCookieDecoder)',
'reactor.netty.http.server.HttpServerConfig#cookieDecoder()',
'reactor.netty.http.server.HttpServerConfig#cookieEncoder()',
'reactor.netty.http.server.HttpServerRequest#requestHeaders()',
'reactor.netty.http.server.HttpServerResponse#addCookie(io.netty.handler.codec.http.cookie.Cookie)',
'reactor.netty.http.server.HttpServerResponse#headers(io.netty.handler.codec.http.HttpHeaders)',
'reactor.netty.http.server.HttpServerResponse#responseHeaders()',
'reactor.netty.http.server.HttpServerResponse#status()',
'reactor.netty.http.server.HttpServerResponse#status(io.netty.handler.codec.http.HttpResponseStatus)',
'reactor.netty.http.server.ServerCookies#newServerRequestHolder(io.netty.handler.codec.http.HttpHeaders, io.netty.handler.codec.http.cookie.ServerCookieDecoder)',
'reactor.netty.http.server.logging.AccessLogHandlerFactory#create(java.util.function.Function)',
'reactor.netty.http.websocket.WebsocketInbound#headers()',
// API removed after adaptation to new HttpHeaders/Cookies Netty API (#12735)
'reactor.netty.http.Cookies#newClientResponseHolder(io.netty.handler.codec.http.HttpHeaders, io.netty.handler.codec.http.cookie.ClientCookieDecoder)',
'reactor.netty.http.server.ServerCookies#newServerRequestHolder(io.netty.handler.codec.http.HttpHeaders, io.netty.handler.codec.http.cookie.ServerCookieDecoder)',
'reactor.netty.http.client.HttpClient#cookie(java.lang.String, java.util.function.Consumer)',
'reactor.netty.http.client.HttpClient#cookieCodec(io.netty.handler.codec.http.cookie.ClientCookieEncoder)',
'reactor.netty.http.client.HttpClient#cookieCodec(io.netty.handler.codec.http.cookie.ClientCookieEncoder, io.netty.handler.codec.http.cookie.ClientCookieDecoder)',
'reactor.netty.http.client.HttpClient#cookiesWhen(java.lang.String, java.util.function.Function)',
'reactor.netty.http.client.HttpClientConfig#cookieEncoder()',
'reactor.netty.http.client.HttpClientConfig#cookieDecoder()'
]
classExcludes = [
// TODO temporary disable multipart on the client
'reactor.netty.http.client.HttpClientForm'
]
}
tasks.japicmp.dependsOn(downloadBaseline)
tasks.check.dependsOn(japicmp)
task noMicrometerTest(type: Test) {
testClassesDirs = sourceSets.noMicrometerTest.output.classesDirs
classpath = sourceSets.noMicrometerTest.runtimeClasspath
}
tasks.check.dependsOn(noMicrometerTest)
description = "HTTP functionality for the Reactor Netty library"