Skip to content

Commit 4f06ce2

Browse files
author
Santos Zatarain Vera
committed
Support the Java Module System through Automatic-Module-Name manifest entry (Kotlin#2237).
1 parent b5679ab commit 4f06ce2

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

kotlinx-coroutines-core/build.gradle

+6-4
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ void defineSourceSet(newName, dependsOn, includedInPred) {
5454
}
5555

5656
static boolean isNativeDarwin(String name) { return ["ios", "macos", "tvos", "watchos"].any { name.startsWith(it) } }
57+
5758
static boolean isNativeOther(String name) { return ["linux", "mingw"].any { name.startsWith(it) } }
5859

5960
defineSourceSet("concurrent", ["common"]) { it in ["jvm", "native"] }
@@ -122,11 +123,11 @@ def configureNativeSourceSetPreset(name, preset) {
122123
def implementationConfiguration = configurations[hostMainCompilation.defaultSourceSet.implementationMetadataConfigurationName]
123124
// Now find the libraries: Finds platform libs & stdlib, but platform declarations are still not resolved due to IDE bugs
124125
def hostNativePlatformLibs = files(
125-
provider {
126-
implementationConfiguration.findAll {
127-
it.path.endsWith(".klib") || it.absolutePath.contains("klib${File.separator}platform") || it.absolutePath.contains("stdlib")
126+
provider {
127+
implementationConfiguration.findAll {
128+
it.path.endsWith(".klib") || it.absolutePath.contains("klib${File.separator}platform") || it.absolutePath.contains("stdlib")
129+
}
128130
}
129-
}
130131
)
131132
// Add all those dependencies
132133
for (suffix in sourceSetSuffixes) {
@@ -219,6 +220,7 @@ static def setupManifest(Jar jar) {
219220
jar.manifest {
220221
attributes "Premain-Class": "kotlinx.coroutines.debug.AgentPremain"
221222
attributes "Can-Retransform-Classes": "true"
223+
attributes "Automatic-Module-Name": "kotlinx.coroutines.core"
222224
}
223225
}
224226

ui/kotlinx-coroutines-javafx/build.gradle.kts

+6
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ val jdk8Test by tasks.registering(Test::class) {
5252
dependsOn(checkJdk8)
5353
}
5454

55+
tasks.jar {
56+
manifest {
57+
attributes["Automatic-Module-Name"] = "kotlinx.coroutines.javafx"
58+
}
59+
}
60+
5561
tasks.build {
5662
dependsOn(jdk8Test)
5763
}

0 commit comments

Comments
 (0)