Skip to content

Commit 614980d

Browse files
committed
Declare byte-buddy as 'implementation' dependency instead of shading.
Shading byte buddy might have negative effects: - It increases binary size by ~3MB w/o an easy option to opt-out - It causes JPMS issues (because of the re-location itself) The used APIs from the dependency can be considered stable.
1 parent a9e8a1e commit 614980d

File tree

1 file changed

+2
-26
lines changed

1 file changed

+2
-26
lines changed

kotlinx-coroutines-debug/build.gradle.kts

+2-26
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import com.github.jengelman.gradle.plugins.shadow.tasks.*
21
import java.net.*
32
import java.nio.file.*
43

54
plugins {
6-
id("com.github.johnrengelman.shadow")
75
id("org.jetbrains.kotlinx.kover") // apply plugin to use autocomplete for Kover DSL
86
}
97

@@ -28,8 +26,8 @@ dependencies {
2826
compileOnly("org.junit.jupiter:junit-jupiter-api:$junit5_version")
2927
testImplementation("org.junit.jupiter:junit-jupiter-engine:$junit5_version")
3028
testImplementation("org.junit.platform:junit-platform-testkit:1.7.0")
31-
add("shadowDeps", "net.bytebuddy:byte-buddy:$byte_buddy_version")
32-
add("shadowDeps", "net.bytebuddy:byte-buddy-agent:$byte_buddy_version")
29+
implementation("net.bytebuddy:byte-buddy:$byte_buddy_version")
30+
implementation("net.bytebuddy:byte-buddy-agent:$byte_buddy_version")
3331
compileOnly("io.projectreactor.tools:blockhound:$blockhound_version")
3432
testImplementation("io.projectreactor.tools:blockhound:$blockhound_version")
3533
testImplementation("com.google.code.gson:gson:2.8.6")
@@ -51,20 +49,6 @@ tasks.withType<Test>().configureEach {
5149
}
5250

5351
val jar by tasks.existing(Jar::class) {
54-
enabled = false
55-
}
56-
57-
val shadowJar by tasks.existing(ShadowJar::class) {
58-
// Shadow only byte buddy, do not package kotlin stdlib
59-
configurations = listOf(project.configurations["shadowDeps"])
60-
relocate("net.bytebuddy", "kotlinx.coroutines.repackaged.net.bytebuddy")
61-
/* These classifiers are both set to `null` to trick Gradle into thinking that this jar file is both the
62-
artifact from the `jar` task and the one from `shadowJar`. Without this, Gradle complains that the artifact
63-
from the `jar` task is not present when the compilaton finishes, even if the file with this name exists. */
64-
archiveClassifier.convention(null as String?)
65-
archiveClassifier = null
66-
archiveBaseName = jar.flatMap { it.archiveBaseName }
67-
archiveVersion = jar.flatMap { it.archiveVersion }
6852
manifest {
6953
attributes(
7054
mapOf(
@@ -90,14 +74,6 @@ val shadowJar by tasks.existing(ShadowJar::class) {
9074
}
9175
}
9276

93-
configurations {
94-
// shadowJar is already part of the `shadowRuntimeElements` and `shadowApiElements`, but the other subprojects
95-
// that depend on `kotlinx-coroutines-debug` look at `runtimeElements` and `apiElements`.
96-
artifacts {
97-
add("apiElements", shadowJar)
98-
add("runtimeElements", shadowJar)
99-
}
100-
}
10177

10278
kover {
10379
reports {

0 commit comments

Comments
 (0)