1
1
plugins {
2
2
id(" java-library" )
3
- id(" com.github.johnrengelman.shadow" )
4
- id(" biz.aQute.bnd.builder" )
5
3
id(" maven-publish" )
6
- id(" io.github.gradle-nexus.publish-plugin" )
7
4
id(" signing" )
8
- id(" com.github.hierynomus.license" )
9
5
id(" pmd" )
10
- id(" com.github.sgtsilvio.gradle.utf8" )
11
- id(" com.github.sgtsilvio.gradle.metadata" )
12
- id(" com.github.sgtsilvio.gradle.javadoc-links" )
6
+ alias(libs.plugins.bnd)
7
+ alias(libs.plugins.javadoc.links)
8
+ alias(libs.plugins.metadata)
9
+ alias(libs.plugins.nexus.publish)
10
+ alias(libs.plugins.license)
11
+ alias(libs.plugins.shadow)
12
+ alias(libs.plugins.utf8)
13
13
}
14
14
15
-
16
15
/* ******************** metadata ******************** */
17
16
18
17
allprojects {
@@ -21,7 +20,6 @@ allprojects {
21
20
" Java client library with different API flavours and backpressure support"
22
21
23
22
plugins.apply (" com.github.sgtsilvio.gradle.metadata" )
24
-
25
23
metadata {
26
24
moduleName.set(" com.hivemq.client.mqtt" )
27
25
readableName.set(" HiveMQ MQTT Client" )
@@ -33,9 +31,8 @@ allprojects {
33
31
apache2()
34
32
}
35
33
developers {
36
- developer {
37
- id.set(" SgtSilvio" )
38
- name.set(" Silvio Giebl" )
34
+ register(" SgtSilvio" ) {
35
+ fullName.set(" Silvio Giebl" )
39
36
40
37
}
41
38
}
@@ -46,44 +43,50 @@ allprojects {
46
43
issues()
47
44
}
48
45
}
49
- }
50
46
47
+ repositories {
48
+ mavenCentral()
49
+ }
50
+ }
51
51
52
52
/* ******************** java ******************** */
53
53
54
54
allprojects {
55
55
plugins.withId(" java" ) {
56
56
java {
57
- sourceCompatibility = JavaVersion .VERSION_1_8
58
- targetCompatibility = JavaVersion .VERSION_1_8
57
+ toolchain {
58
+ languageVersion = JavaLanguageVersion .of(21 )
59
+ }
60
+ tasks.compileJava {
61
+ javaCompiler = javaToolchains.compilerFor {
62
+ languageVersion = JavaLanguageVersion .of(8 )
63
+ }
64
+ }
59
65
}
60
-
61
66
plugins.apply (" com.github.sgtsilvio.gradle.utf8" )
62
67
}
63
68
}
64
69
65
-
66
70
/* ******************** dependencies ******************** */
67
71
68
72
dependencies {
69
- api(" io.reactivex.rxjava2: rxjava: ${property( " rxjava.version " )} " )
70
- api(" org.reactivestreams: reactive-streams: ${property( " reactive-streams.version " )} " )
73
+ api(libs. rxjava)
74
+ api(libs. reactive.streams )
71
75
72
- implementation(" io .netty:netty-buffer: ${property( " netty.version " )} " )
73
- implementation(" io .netty:netty-codec: ${property( " netty.version " )} " )
74
- implementation(" io .netty:netty-common: ${property( " netty.version " )} " )
75
- implementation(" io .netty:netty-handler: ${property( " netty.version " )} " )
76
- implementation(" io .netty:netty-transport: ${property( " netty.version " )} " )
77
- implementation(" org .jctools:jctools-core: ${property( " jctools.version " )} " )
78
- implementation(" org .jetbrains:annotations: ${property( " annotations.version " )} " )
79
- implementation(" com.google. dagger:dagger: ${property( " dagger.version " )} " )
76
+ implementation(libs .netty.buffer )
77
+ implementation(libs .netty.codec )
78
+ implementation(libs .netty.common )
79
+ implementation(libs .netty.handler )
80
+ implementation(libs .netty.transport )
81
+ implementation(libs .jctools)
82
+ implementation(libs .jetbrains.annotations )
83
+ implementation(libs. dagger)
80
84
81
- compileOnly(" org .slf4j:slf4j-api: ${property( " slf4j.version " )} " )
85
+ compileOnly(libs .slf4j.api )
82
86
83
- annotationProcessor(" com.google. dagger:dagger-compiler: ${property( " dagger.version " )} " )
87
+ annotationProcessor(libs. dagger.compiler )
84
88
}
85
89
86
-
87
90
/* ******************** optional dependencies ******************** */
88
91
89
92
for (feature in listOf (" websocket" , " proxy" , " epoll" )) {
@@ -93,20 +96,19 @@ for (feature in listOf("websocket", "proxy", "epoll")) {
93
96
}
94
97
95
98
dependencies {
96
- " websocketImplementation" (" io .netty:netty- codec-http: ${property( " netty.version " )} " )
97
- " proxyImplementation" (" io .netty:netty- handler-proxy: ${property( " netty.version " )} " )
98
- " epollImplementation" (" io .netty:netty- transport- native- epoll: ${property( " netty.version " )} : linux-x86_64" )
99
+ " websocketImplementation" (libs .netty. codec.http )
100
+ " proxyImplementation" (libs .netty. handler.proxy )
101
+ " epollImplementation" (variantOf(libs .netty. transport. native. epoll) { classifier( " linux-x86_64" ) } )
99
102
}
100
103
101
-
102
104
/* ******************** test ******************** */
103
105
104
106
allprojects {
105
107
plugins.withId(" java" ) {
106
108
dependencies {
107
- testImplementation(" org .junit.jupiter:junit-jupiter-api: ${property( " junit-jupiter.version " )} " )
108
- testImplementation(" org .junit.jupiter:junit-jupiter-params: ${property( " junit-jupiter.version " )} " )
109
- testRuntimeOnly(" org .junit.jupiter:junit-jupiter-engine: ${property( " junit-jupiter.version " )} " )
109
+ testImplementation(libs .junit.jupiter.api )
110
+ testImplementation(libs .junit.jupiter.params )
111
+ testRuntimeOnly(libs .junit.jupiter.engine )
110
112
}
111
113
112
114
tasks.test {
@@ -119,13 +121,13 @@ allprojects {
119
121
}
120
122
121
123
dependencies {
122
- testImplementation(" nl.jqno. equalsverifier:equalsverifier: ${property( " equalsverifier.version " )} " )
123
- testImplementation(" org .mockito:mockito-core: ${property( " mockito.version " )} " )
124
- testImplementation(" com.google. guava:guava: ${property( " guava.version " )} " )
125
- testImplementation(" org .bouncycastle:bcprov-jdk15on: ${property( " bouncycastle.version " )} " )
126
- testImplementation(" org .bouncycastle:bcpkix-jdk15on: ${property( " bouncycastle.version " )} " )
127
- testImplementation(" org.eclipse. paho:org.eclipse.paho. client.mqttv3: ${property( " paho.version " )} " )
128
- testRuntimeOnly(" org .slf4j:slf4j-simple: ${property( " slf4j.version " )} " )
124
+ testImplementation(libs. equalsverifier)
125
+ testImplementation(libs .mockito)
126
+ testImplementation(libs. guava)
127
+ testImplementation(libs .bouncycastle.pkix )
128
+ testImplementation(libs .bouncycastle.prov )
129
+ testImplementation(libs. paho. client)
130
+ testRuntimeOnly(libs .slf4j.simple )
129
131
}
130
132
131
133
/* ******************** integration Tests ******************** */
@@ -143,15 +145,9 @@ val integrationTestRuntimeOnly: Configuration by configurations.getting {
143
145
}
144
146
145
147
dependencies {
146
- integrationTestImplementation(" com.hivemq:hivemq-testcontainer-junit5:${property(" hivemq-testcontainer.version" )} " )
147
- integrationTestImplementation(" com.hivemq:hivemq-extension-sdk:${property(" hivemq-extension-sdk.version" )} " )
148
- integrationTestImplementation(" org.awaitility:awaitility:${property(" awaitility.version" )} " )
149
- }
150
-
151
- tasks.named<JavaCompile >(" compileIntegrationTestJava" ) {
152
- javaCompiler.set(javaToolchains.compilerFor {
153
- languageVersion.set(JavaLanguageVersion .of(11 ))
154
- })
148
+ integrationTestImplementation(libs.hivemq.testcontainer.junit5)
149
+ integrationTestImplementation(libs.hivemq.extension.sdk)
150
+ integrationTestImplementation(libs.awaitility)
155
151
}
156
152
157
153
val integrationTest by tasks.registering(Test ::class ) {
@@ -161,9 +157,6 @@ val integrationTest by tasks.registering(Test::class) {
161
157
testClassesDirs = sourceSets[" integrationTest" ].output.classesDirs
162
158
classpath = sourceSets[" integrationTest" ].runtimeClasspath
163
159
shouldRunAfter(tasks.test)
164
- javaLauncher.set(javaToolchains.launcherFor {
165
- languageVersion.set(JavaLanguageVersion .of(11 ))
166
- })
167
160
}
168
161
169
162
tasks.check { dependsOn(integrationTest) }
@@ -172,30 +165,25 @@ tasks.check { dependsOn(integrationTest) }
172
165
173
166
allprojects {
174
167
plugins.withId(" java-library" ) {
175
-
176
168
plugins.apply (" biz.aQute.bnd.builder" )
177
-
178
169
tasks.jar {
179
- withConvention(aQute.bnd.gradle. BundleTaskConvention :: class ) {
170
+ bundle {
180
171
bnd(" -consumer-policy: \$ {range;[==,=+)}" , " -removeheaders: Private-Package" )
181
172
}
182
173
}
183
-
184
174
java {
185
175
withJavadocJar()
186
176
withSourcesJar()
187
177
}
188
-
189
178
plugins.apply (" com.github.sgtsilvio.gradle.javadoc-links" )
190
-
191
179
tasks.javadoc {
192
180
exclude(" **/internal/**" )
193
181
}
194
182
}
195
183
}
196
184
197
185
tasks.jar {
198
- withConvention(aQute.bnd.gradle. BundleTaskConvention :: class ) {
186
+ bundle {
199
187
bnd(" Export-Package: " +
200
188
" com.hivemq.client.annotations.*," +
201
189
" com.hivemq.client.mqtt.*," +
@@ -225,8 +213,6 @@ tasks.shadowJar {
225
213
relocate(" dagger" , " ${shadePrefix} dagger" )
226
214
exclude(" META-INF/com.google.dagger_dagger.version" )
227
215
relocate(" javax.inject" , " ${shadePrefix} javax.inject" )
228
-
229
- minimize()
230
216
}
231
217
232
218
val javaComponent = components[" java" ] as AdhocComponentWithVariants
@@ -238,19 +224,14 @@ javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements
238
224
239
225
allprojects {
240
226
plugins.withId(" java-library" ) {
241
-
242
227
plugins.apply (" maven-publish" )
243
-
244
228
publishing.publications.register<MavenPublication >(" base" ) {
245
229
from(components[" java" ])
246
230
suppressAllPomMetadataWarnings()
247
231
}
248
232
}
249
-
250
233
plugins.withId(" java-platform" ) {
251
-
252
234
plugins.apply (" maven-publish" )
253
-
254
235
publishing.publications.register<MavenPublication >(" base" ) {
255
236
from(components[" javaPlatform" ])
256
237
suppressAllPomMetadataWarnings()
@@ -296,9 +277,7 @@ allprojects {
296
277
297
278
allprojects {
298
279
plugins.withId(" maven-publish" ) {
299
-
300
280
plugins.apply (" signing" )
301
-
302
281
signing {
303
282
val signKey: String? by project
304
283
val signKeyPass: String? by project
@@ -320,7 +299,6 @@ nexusPublishing {
320
299
321
300
allprojects {
322
301
plugins.apply (" com.github.hierynomus.license" )
323
-
324
302
license {
325
303
header = rootDir.resolve(" HEADER" )
326
304
mapping(" java" , " SLASHSTAR_STYLE" )
@@ -329,19 +307,16 @@ allprojects {
329
307
330
308
allprojects {
331
309
plugins.withId(" java" ) {
332
-
333
310
plugins.apply (" pmd" )
334
-
335
311
pmd {
336
- toolVersion = " 5.8.1 "
312
+ toolVersion = libs.versions.pmd.get()
337
313
incrementalAnalysis.set(false )
338
314
}
339
315
}
340
316
}
341
317
342
318
apply (" $rootDir /gradle/japicc.gradle.kts" )
343
319
344
-
345
320
/* ******************** build cache ******************** */
346
321
347
322
allprojects {
0 commit comments