File tree 2 files changed +14
-8
lines changed
2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ Add dependencies (you can also add other modules that you need):
85
85
``` xml
86
86
<dependency >
87
87
<groupId >org.jetbrains.kotlinx</groupId >
88
- <artifactId >kotlinx-coroutines-core</artifactId >
88
+ <artifactId >kotlinx-coroutines-core-jvm </artifactId >
89
89
<version >1.10.1</version >
90
90
</dependency >
91
91
```
Original file line number Diff line number Diff line change 1
- import org.gradle.api.tasks.testing.*
2
- import org.gradle.kotlin.dsl.*
3
1
import org.jetbrains.kotlin.gradle.plugin.mpp.*
4
2
import org.jetbrains.kotlin.gradle.targets.native.tasks.*
5
3
import org.jetbrains.kotlin.gradle.tasks.*
@@ -182,15 +180,23 @@ val jvmJar by tasks.getting(Jar::class) { setupManifest(this) }
182
180
* This manifest contains reference to AgentPremain that belongs to
183
181
* kotlinx-coroutines-core-jvm, but our resolving machinery guarantees that
184
182
* any JVM project that depends on -core artifact also depends on -core-jvm one.
183
+ *
184
+ * To avoid a conflict with a JPMS module provided by kotlinx-coroutines-core-jvm,
185
+ * an explicit automatic module name has to be specified in the manifest.
185
186
*/
186
- val allMetadataJar by tasks.getting(Jar ::class ) { setupManifest(this ) }
187
+ val allMetadataJar by tasks.getting(Jar ::class ) {
188
+ setupManifest(this , " kotlinx.coroutines.core.trampoline" )
189
+ }
187
190
188
- fun setupManifest (jar : Jar ) {
191
+ fun setupManifest (jar : Jar , autoModuleName : String? = null ) {
189
192
jar.manifest {
190
- attributes(mapOf (
193
+ attributes(
191
194
" Premain-Class" to " kotlinx.coroutines.debug.internal.AgentPremain" ,
192
- " Can-Retransform-Classes" to " true" ,
193
- ))
195
+ " Can-Retransform-Classes" to " true"
196
+ )
197
+ autoModuleName?.also {
198
+ attributes(" Automatic-Module-Name" to it)
199
+ }
194
200
}
195
201
}
196
202
You can’t perform that action at this time.
0 commit comments