File tree 2 files changed +35
-3
lines changed
2 files changed +35
-3
lines changed Original file line number Diff line number Diff line change @@ -77,14 +77,15 @@ publishing {
77
77
} else if (! isMultiplatform) {
78
78
publications {
79
79
maven(MavenPublication ) { publication ->
80
+ publication. artifact javadocJar
81
+ publication. artifact sourcesJar
82
+ publication. pom. withXml(configureMavenCentralMetadata)
80
83
if (project. name == " kotlinx-coroutines-debug" ) {
81
84
project. shadow. component(publication)
85
+ publication. pom. withXml(configureMavenDependencies)
82
86
} else {
83
87
publication. from components. java
84
88
}
85
- publication. artifact javadocJar
86
- publication. artifact sourcesJar
87
- publication. pom. withXml(configureMavenCentralMetadata)
88
89
}
89
90
}
90
91
Original file line number Diff line number Diff line change
1
+ import org.w3c.dom.Element
2
+
1
3
/*
2
4
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3
5
*/
16
18
attributes " Can-Redefine-Classes" : " true"
17
19
}
18
20
}
21
+ /*
22
+ * It is possible to extend a particular configuration with shadow,
23
+ * but in that case it changes dependency type to "runtime" and resolves it
24
+ * (so it cannot be further modified). Otherwise, shadow just ignores all dependencies.
25
+ */
26
+ configurations. shadow. extendsFrom(configurations. compile)
27
+
28
+ /*
29
+ * Thus we are rewriting the POM. I am really question my existence at this point.
30
+ */
31
+ project. ext. configureMavenDependencies = {
32
+ def root = it. asElement() as Element
33
+ def dependencies = root. getChildNodes(). find { it. nodeName == " dependencies" }. childNodes
34
+ def childrenToRemove = []
35
+ for (i in 0 .. dependencies. length - 1 ) {
36
+ def dependency = dependencies. item(i) as Element
37
+ def scope = dependency. getChildNodes(). find { it. nodeName == " scope" } as Element
38
+ def groupId = dependency. getChildNodes(). find { it. nodeName == " groupId" } as Element
39
+ if (groupId != null && groupId. firstChild. nodeValue == " net.bytebuddy" ) {
40
+ childrenToRemove. add(dependency)
41
+ } else if (scope != null ) {
42
+ scope. firstChild. setNodeValue(" compile" )
43
+ }
44
+ }
45
+
46
+ childrenToRemove. each {
47
+ root. getChildNodes(). find { it. nodeName == " dependencies" }. removeChild(it)
48
+ }
49
+ }
19
50
20
51
shadowJar {
21
52
classifier null
You can’t perform that action at this time.
0 commit comments