File tree Expand file tree Collapse file tree 2 files changed +35
-3
lines changed Expand file tree Collapse file tree 2 files changed +35
-3
lines changed Original file line number Diff line number Diff line change @@ -77,14 +77,15 @@ publishing {
7777 } else if (! isMultiplatform) {
7878 publications {
7979 maven(MavenPublication ) { publication ->
80+ publication. artifact javadocJar
81+ publication. artifact sourcesJar
82+ publication. pom. withXml(configureMavenCentralMetadata)
8083 if (project. name == " kotlinx-coroutines-debug" ) {
8184 project. shadow. component(publication)
85+ publication. pom. withXml(configureMavenDependencies)
8286 } else {
8387 publication. from components. java
8488 }
85- publication. artifact javadocJar
86- publication. artifact sourcesJar
87- publication. pom. withXml(configureMavenCentralMetadata)
8889 }
8990 }
9091
Original file line number Diff line number Diff line change 1+ import org.w3c.dom.Element
2+
13/*
24 * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
35 */
1618 attributes " Can-Redefine-Classes" : " true"
1719 }
1820}
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+ }
1950
2051shadowJar {
2152 classifier null
You can’t perform that action at this time.
0 commit comments