Skip to content

Commit b400b02

Browse files
authored
Add debugger-related manifest to root metadata artifact of kotlinx-coroutines-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
1 parent e49cf79 commit b400b02

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

kotlinx-coroutines-core/build.gradle

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,20 @@ jvmTest {
208208
}
209209
}
210210

211-
jvmJar {
212-
manifest {
211+
// Setup manifest for kotlinx-coroutines-core-jvm.jar
212+
jvmJar { setupManifest(it) }
213+
214+
/*
215+
* Setup manifest for kotlinx-coroutines-core.jar
216+
* This is convenient for users that pass -javaagent arg manually and also is a workaround #2619 and KTIJ-5659.
217+
* This manifest contains reference to AgentPremain that belongs to
218+
* kotlinx-coroutines-core-jvm, but our resolving machinery guarantees that
219+
* any JVM project that depends on -core artifact also depends on -core-jvm one.
220+
*/
221+
metadataJar { setupManifest(it) }
222+
223+
static def setupManifest(Jar jar) {
224+
jar.manifest {
213225
attributes "Premain-Class": "kotlinx.coroutines.debug.AgentPremain"
214226
attributes "Can-Retransform-Classes": "true"
215227
}

0 commit comments

Comments
 (0)