Skip to content

Commit 979abd5

Browse files
committed
Repackage byte-buddy along with debug agent (so it shouldn't be a dependency of target process), use shadow plugin for that to avoid clashes with other byte-buddy versions and publish shadow jar instead of regular one for debug module
1 parent 7a6fd89 commit 979abd5

File tree

3 files changed

+42
-9
lines changed

3 files changed

+42
-9
lines changed

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ buildscript {
4040
classpath "com.moowork.gradle:gradle-node-plugin:$gradle_node_version"
4141

4242
// JMH plugins
43-
classpath "com.github.jengelman.gradle.plugins:shadow:2.0.2"
43+
classpath "com.github.jengelman.gradle.plugins:shadow:4.0.2"
4444
classpath "me.champeau.gradle:jmh-gradle-plugin:0.4.7"
4545
classpath "net.ltgt.gradle:gradle-apt-plugin:0.10"
4646
}

core/kotlinx-coroutines-debug/build.gradle

+12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

5+
apply plugin: "com.github.johnrengelman.shadow"
6+
57
dependencies {
68
compile "net.bytebuddy:byte-buddy:$byte_buddy_version"
79
compile "net.bytebuddy:byte-buddy-agent:$byte_buddy_version"
@@ -13,3 +15,13 @@ jar {
1315
attributes "Can-Redefine-Classes": "true"
1416
}
1517
}
18+
19+
shadowJar {
20+
classifier null
21+
// Shadow only byte buddy, do not package kotlin stdlib
22+
dependencies {
23+
include(dependency("net.bytebuddy:byte-buddy:$byte_buddy_version"))
24+
include(dependency("net.bytebuddy:byte-buddy-agent:$byte_buddy_version"))
25+
}
26+
relocate 'net.bytebuddy', 'repackaged.net.bytebuddy'
27+
}

gradle/publish-bintray.gradle

+29-8
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ apply plugin: 'maven'
88
apply plugin: 'maven-publish'
99
apply plugin: 'com.jfrog.bintray'
1010
apply plugin: 'com.jfrog.artifactory'
11+
apply plugin: "com.github.johnrengelman.shadow"
1112

1213
apply from: project.rootProject.file('gradle/maven-central.gradle')
1314

@@ -32,19 +33,30 @@ task sourcesJar(type: Jar) {
3233
}
3334
}
3435

36+
3537
publishing {
3638
repositories {
3739
maven { url = 'https://kotlin.bintray.com/kotlinx' }
3840
}
3941

4042
publications {
41-
maven(MavenPublication) {
42-
if (!isNative) {
43-
from components.java
43+
// TODO I ain't even mad
44+
if (project.name == "kotlinx-coroutines-debug") {
45+
shadow(MavenPublication) { publication ->
46+
project.shadow.component(publication)
4447
artifact javadocJar
4548
artifact sourcesJar
49+
pom.withXml(configureMavenCentralMetadata)
50+
}
51+
} else {
52+
maven(MavenPublication) {
53+
if (!isNative) {
54+
from components.java
55+
artifact javadocJar
56+
artifact sourcesJar
57+
}
58+
pom.withXml(configureMavenCentralMetadata)
4659
}
47-
pom.withXml(configureMavenCentralMetadata)
4860
}
4961
}
5062
}
@@ -59,13 +71,22 @@ artifactory {
5971
}
6072

6173
publications {
62-
maven(MavenPublication) {
63-
if (!isNative) {
64-
from components.java
74+
if (project.name == "kotlinx-coroutines-debug") {
75+
shadow(MavenPublication) { publication ->
76+
project.shadow.component(publication)
6577
artifact javadocJar
6678
artifact sourcesJar
79+
pom.withXml(configureMavenCentralMetadata)
80+
}
81+
} else {
82+
maven(MavenPublication) {
83+
if (!isNative) {
84+
from components.java
85+
artifact javadocJar
86+
artifact sourcesJar
87+
}
88+
pom.withXml(configureMavenCentralMetadata)
6789
}
68-
pom.withXml(configureMavenCentralMetadata)
6990
}
7091
}
7192

0 commit comments

Comments
 (0)