Skip to content

Commit

Permalink
Fix debug module publication with shadow plugin
Browse files Browse the repository at this point in the history
Fixes #3345
Fixes #3334
  • Loading branch information
qwwdfsad committed Jul 5, 2022
1 parent 7934032 commit 3d343e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
6 changes: 1 addition & 5 deletions gradle/publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@ publishing {
// Configure java publications for regular non-MPP modules
publications {
maven(MavenPublication) {
if (project.name == "kotlinx-coroutines-debug") {
project.shadow.component(it)
} else {
from components.java
}
from components.java
artifact sourcesJar
}
}
Expand Down
18 changes: 9 additions & 9 deletions kotlinx-coroutines-debug/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ configurations {
shadowDeps // shaded dependencies, not included into the resulting .pom file
compileOnly.extendsFrom(shadowDeps)
runtimeOnly.extendsFrom(shadowDeps)

/*
* It is possible to extend a particular configuration with shadow,
* but in that case it changes dependency type to "runtime" and resolves it
* (so it cannot be further modified). Otherwise, shadow just ignores all dependencies.
*/
shadow.extendsFrom(api) // shadow - resulting configuration with shaded jar file
configureKotlinJvmPlatform(shadow)
}

dependencies {
Expand All @@ -39,19 +31,27 @@ java {
}

jar {
setEnabled(false)
manifest {
attributes "Premain-Class": "kotlinx.coroutines.debug.AgentPremain"
attributes "Can-Redefine-Classes": "true"
}
}

shadowJar {
def shadowJarTask = shadowJar {
classifier null
// Shadow only byte buddy, do not package kotlin stdlib
configurations = [project.configurations.shadowDeps]
relocate('net.bytebuddy', 'kotlinx.coroutines.repackaged.net.bytebuddy')
}

configurations {
artifacts {
add("apiElements", shadowJarTask)
add("runtimeElements", shadowJarTask)
}
}

def commonKoverExcludes =
// Never used, safety mechanism
["kotlinx.coroutines.debug.internal.NoOpProbesKt"]
Expand Down

0 comments on commit 3d343e7

Please sign in to comment.