@@ -8,7 +8,6 @@ buildscript {
8
8
}
9
9
10
10
plugins {
11
- id ' nebula.optional-base' version ' 3.0.3'
12
11
id ' com.github.johnrengelman.shadow' version ' 4.0.4' apply false
13
12
id ' biz.aQute.bnd.builder' version ' 4.2.0' apply false
14
13
id ' com.github.hierynomus.license' version ' 0.14.0' apply false
@@ -91,16 +90,30 @@ dependencies {
91
90
implementation group : ' org.jetbrains' , name : ' annotations' , version : jetbrainsAnnotationsVersion
92
91
implementation group : ' com.google.dagger' , name : ' dagger' , version : daggerVersion
93
92
94
- implementation group : ' io.netty' , name : ' netty-codec-http' , version : nettyVersion, optional
95
- implementation group : ' io.netty' , name : ' netty-handler-proxy' , version : nettyVersion, optional
96
- implementation group : ' io.netty' , name : ' netty-transport-native-epoll' , version : nettyVersion, classifier : ' linux-x86_64' , optional
97
-
98
93
compileOnly group : ' org.slf4j' , name : ' slf4j-api' , version : slf4jVersion
99
94
100
95
annotationProcessor group : ' com.google.dagger' , name : ' dagger-compiler' , version : daggerVersion
101
96
}
102
97
103
98
99
+ /* ******************** optional dependencies ******************** */
100
+
101
+ def features = [' websocket' , ' proxy' , ' epoll' ]
102
+ java {
103
+ features. each {
104
+ registerFeature(it) {
105
+ usingSourceSet(sourceSets. main)
106
+ }
107
+ }
108
+ }
109
+
110
+ dependencies {
111
+ websocketImplementation group : ' io.netty' , name : ' netty-codec-http' , version : nettyVersion
112
+ proxyImplementation group : ' io.netty' , name : ' netty-handler-proxy' , version : nettyVersion
113
+ epollImplementation group : ' io.netty' , name : ' netty-transport-native-epoll' , version : nettyVersion, classifier : ' linux-x86_64'
114
+ }
115
+
116
+
104
117
/* ******************** test ******************** */
105
118
106
119
allprojects {
@@ -246,11 +259,12 @@ allprojects {
246
259
url = project. issuesUrl
247
260
}
248
261
}
249
- artifact javadocJar
250
- artifact sourcesJar
251
262
}
252
263
normal(MavenPublication ) {
253
- from components. java
264
+ from project. components. java
265
+ artifact project. tasks. javadocJar
266
+ artifact project. tasks. sourcesJar
267
+ suppressAllPomMetadataWarnings()
254
268
}
255
269
}
256
270
}
@@ -286,6 +300,19 @@ allprojects {
286
300
}
287
301
}
288
302
}
303
+
304
+ // workaround for publishing gradle metadata https://github.com/bintray/gradle-bintray-plugin/issues/229
305
+ // noinspection UnnecessaryQualifiedReference
306
+ project. tasks. withType(com.jfrog.bintray.gradle.tasks.BintrayUploadTask ) {
307
+ doFirst {
308
+ publishing. publications. withType(MavenPublication ). each { publication ->
309
+ def moduleFile = new File (new File (new File (project. buildDir, ' publications' ), publication. name), ' module.json' )
310
+ if (moduleFile. exists()) {
311
+ publication. artifact(moduleFile). setExtension(' module' )
312
+ }
313
+ }
314
+ }
315
+ }
289
316
}
290
317
}
291
318
@@ -295,9 +322,11 @@ allprojects {
295
322
publications {
296
323
shaded(MavenPublication ) {
297
324
artifactId project. name + ' -' + project. shadedAppendix
298
- artifact shadowJar
299
- pom. withXml { xml ->
300
- def dependenciesNode = xml. asNode(). appendNode(' dependencies' )
325
+ artifact project. tasks. shadowJar
326
+ artifact project. tasks. javadocJar
327
+ artifact project. tasks. sourcesJar
328
+ pom. withXml {
329
+ def dependenciesNode = asNode(). appendNode(' dependencies' )
301
330
302
331
project. configurations. api. allDependencies. each {
303
332
def dependencyNode = dependenciesNode. appendNode(' dependency' )
@@ -313,6 +342,33 @@ allprojects {
313
342
}
314
343
}
315
344
345
+ features. each { feature ->
346
+ publishing {
347
+ publications {
348
+ create(feature, MavenPublication ) {
349
+ artifactId project. name + ' -' + feature
350
+ pom. withXml {
351
+ def dependenciesNode = asNode(). appendNode(' dependencies' )
352
+
353
+ def rootDependencyNode = dependenciesNode. appendNode(' dependency' )
354
+ rootDependencyNode. appendNode(' groupId' , project. group)
355
+ rootDependencyNode. appendNode(' artifactId' , project. name)
356
+ rootDependencyNode. appendNode(' version' , project. version)
357
+ rootDependencyNode. appendNode(' scope' , ' compile' )
358
+
359
+ project. configurations. getByName(feature + ' Implementation' ). allDependencies. each {
360
+ def dependencyNode = dependenciesNode. appendNode(' dependency' )
361
+ dependencyNode. appendNode(' groupId' , it. group)
362
+ dependencyNode. appendNode(' artifactId' , it. name)
363
+ dependencyNode. appendNode(' version' , it. version)
364
+ dependencyNode. appendNode(' scope' , ' runtime' )
365
+ }
366
+ }
367
+ }
368
+ }
369
+ }
370
+ }
371
+
316
372
apply plugin : ' com.github.breadmoirai.github-release'
317
373
318
374
githubRelease {
0 commit comments