/
build.gradle
205 lines (180 loc) · 7.65 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
/*
* 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.netty.http*;version=$osgiVersion;-noimport:=true",
"Import-Package": [
"!javax.annotation",
"io.netty.channel.kqueue;resolution:=optional;version=\"[4.1,5)\"",
"io.netty.handler.codec.haproxy;resolution:=optional;version=\"[4.1,5)\"",
"io.netty.incubator.channel.uring;resolution:=optional",
"io.micrometer.*;resolution:=optional",
"*"
].join(","),
"Bundle-Name" : "reactor-netty-http",
"Bundle-SymbolicName" : "io.projectreactor.netty.reactor-netty-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-netty-core', configuration: 'shadow')
// JSR-305 annotations
compileOnly "com.google.code.findbugs:jsr305:$jsr305Version"
api "io.netty:netty-codec-http:$nettyVersion"
api "io.netty:netty-codec-http2:$nettyVersion"
api "io.netty:netty-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") {
api "io.netty:netty-resolver-dns-native-macos:$nettyVersion$os_suffix"
}
else {
api "io.netty:netty-resolver-dns-native-macos:$nettyVersion:osx-x86_64"
}
}
else {
// MacOS binaries are not available for Netty SNAPSHOT version
api "io.netty:netty-resolver-dns-native-macos:$nettyVersion"
}
compileOnly "io.netty:netty-codec-haproxy:$nettyVersion"
//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:netty-transport-native-epoll:$nettyVersion"
compileOnly "io.netty:netty-transport-native-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:netty-transport-native-kqueue:$nettyVersion$os_suffix"
}
else if (osdetector.os == "linux") {
testRuntimeOnly "io.netty:netty-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:netty-transport-native-epoll:$nettyVersion:linux-x86_64"
compileOnly "io.netty:netty-transport-native-kqueue:$nettyVersion"
compileOnly "io.netty.incubator:netty-incubator-transport-native-io_uring:$nettyIoUringVersion"
}
//Metrics
compileOnly "io.micrometer:micrometer-core:$micrometerVersion"
// Logging
compileOnly "org.slf4j:slf4j-api:$slf4jVersion"
api "io.projectreactor:reactor-core:$reactorCoreVersion"
testImplementation(testFixtures(project(':reactor-netty-core'))) {
exclude module: "reactor-netty-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"
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:netty-handler-proxy:$nettyVersion"
testRuntimeOnly "io.netty:netty-codec-haproxy:$nettyVersion"
// Needed for HTTP/2 testing
testRuntimeOnly "io.netty:netty-tcnative-boringssl-static:$boringSslVersion$os_suffix"
// 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.netty.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"
}
task japicmp(type: JapicmpTask) {
oldClasspath.from(files("${buildDir}/baselineLibs/reactor-netty-http-${compatibleVersion}.jar"))
newClasspath.from(files(jar.archiveFile, project(':reactor-netty-core').jar))
onlyBinaryIncompatibleModified = true
failOnModification = true
failOnSourceIncompatibility = true
txtOutputFile = file("${project.buildDir}/reports/japi.txt")
ignoreMissingClasses = true
includeSynthetic = true
onlyIf { "$compatibleVersion" != "SKIP" }
}
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"