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