Skip to content

Commit

Permalink
Add debugger-related manifest to root metadata artifact of kotlinx-co…
Browse files Browse the repository at this point in the history
…routines-core (#2632)

* It fixes IDEA issue that was introduced in coroutines 1.4.3 where we switched to Kotlin 1.4.30 and stopped producing root artifact with JVM classes
    * It simplifies manual -javaagent specification for end-users who shouldn't even be aware of kotlinx-coroutines-core-jvm.jar

Fixes #2619
  • Loading branch information
qwwdfsad authored Apr 21, 2021
1 parent e49cf79 commit b400b02
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions kotlinx-coroutines-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,20 @@ jvmTest {
}
}

jvmJar {
manifest {
// Setup manifest for kotlinx-coroutines-core-jvm.jar
jvmJar { setupManifest(it) }

/*
* Setup manifest for kotlinx-coroutines-core.jar
* This is convenient for users that pass -javaagent arg manually and also is a workaround #2619 and KTIJ-5659.
* This manifest contains reference to AgentPremain that belongs to
* kotlinx-coroutines-core-jvm, but our resolving machinery guarantees that
* any JVM project that depends on -core artifact also depends on -core-jvm one.
*/
metadataJar { setupManifest(it) }

static def setupManifest(Jar jar) {
jar.manifest {
attributes "Premain-Class": "kotlinx.coroutines.debug.AgentPremain"
attributes "Can-Retransform-Classes": "true"
}
Expand Down

0 comments on commit b400b02

Please sign in to comment.