-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New watchos targets that are available in kotlin coroutines #72
base: master
Are you sure you want to change the base?
Changes from all commits
8fdeed6
5467f22
1ba019e
7f8985c
1e69b78
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
.idea/ | ||
.gradle/ | ||
.kotlin/ | ||
build/ | ||
.idea_modules/ | ||
hs_err_pid* | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
# style guide | ||
kotlin.code.style=official | ||
kotlin.incremental.multiplatform=true | ||
kotlin.js.compiler=both | ||
kotlin.js.compiler=ir | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this property is not needed anymore |
||
kotlin.native.ignoreDisabledTargets=true | ||
systemProp.org.gradle.internal.publish.checksums.insecure=true | ||
org.gradle.vfs.watch=true | ||
|
||
kotlin.mpp.enableCompatibilityMetadataVariant=true | ||
org.gradle.jvmargs=-Xmx2g "-XX:MaxMetaspaceSize=2g" | ||
kotlin.mpp.enableCInteropCommonization=true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
pluginManagement { | ||
repositories { | ||
gradlePluginPortal() | ||
mavenLocal() | ||
mavenCentral() | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
@file:Suppress("UNUSED_VARIABLE") | ||
|
||
import org.apache.tools.ant.taskdefs.condition.Os | ||
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet | ||
|
||
plugins { | ||
id("me.him188.maven-central-publish") | ||
kotlin("multiplatform") | ||
|
@@ -13,129 +8,44 @@ plugins { | |
kotlin { | ||
explicitApi() | ||
|
||
targets { | ||
jvm { | ||
compilations.all { | ||
kotlinOptions.jvmTarget = "1.8" | ||
} | ||
} | ||
js(BOTH) { | ||
compilations.all { | ||
kotlinOptions { | ||
moduleKind = "umd" | ||
sourceMap = true | ||
metaInfo = true | ||
} | ||
} | ||
browser() | ||
nodejs() | ||
} | ||
|
||
|
||
val ideaActive = System.getProperty("idea.active") == "true" && System.getProperty("publication.test") != "true" | ||
|
||
val nativeMainSets = mutableListOf<KotlinSourceSet>() | ||
val nativeTestSets = mutableListOf<KotlinSourceSet>() | ||
|
||
if (ideaActive) { | ||
when { | ||
Os.isFamily(Os.FAMILY_MAC) -> if (Os.isArch("aarch64")) macosArm64("native") else macosX64("native") | ||
Os.isFamily(Os.FAMILY_WINDOWS) -> mingwX64("native") | ||
else -> linuxX64("native") | ||
} | ||
} else { | ||
// https://kotlinlang.org/docs/native-target-support.html | ||
// Updated for Kotlin 1.8.0, serialization 1.5.0 | ||
//kotlinx-serialization-core-iosarm32/ - - | ||
//kotlinx-serialization-core-iosarm64/ - - | ||
//kotlinx-serialization-core-iossimulatorarm64/ - - | ||
//kotlinx-serialization-core-iosx64/ - - | ||
//kotlinx-serialization-core-js/ - - | ||
//kotlinx-serialization-core-jvm/ - - | ||
//kotlinx-serialization-core-linuxarm32hfp/ - - | ||
//kotlinx-serialization-core-linuxarm64/ - - | ||
//kotlinx-serialization-core-linuxx64/ - - | ||
//kotlinx-serialization-core-macosarm64/ - - | ||
//kotlinx-serialization-core-macosx64/ - - | ||
//kotlinx-serialization-core-metadata/ - - | ||
//kotlinx-serialization-core-mingwx64/ - - | ||
//kotlinx-serialization-core-mingwx86/ - - | ||
//kotlinx-serialization-core-tvosarm64/ - - | ||
//kotlinx-serialization-core-tvossimulatorarm64/ - - | ||
//kotlinx-serialization-core-tvosx64/ - - | ||
//kotlinx-serialization-core-watchosarm32/ - - | ||
//kotlinx-serialization-core-watchosarm64/ - - | ||
//kotlinx-serialization-core-watchossimulatora.../ - - | ||
//kotlinx-serialization-core-watchosx64/ - - | ||
//kotlinx-serialization-core-watchosx86/ | ||
// Commented ones are not supported by kotlinx-coroutines-core | ||
val nativeTargets: List<String> = arrayOf( | ||
// Tier 1: | ||
"linuxX64", | ||
"macosX64", | ||
"macosArm64", | ||
"iosSimulatorArm64", | ||
"iosX64", | ||
|
||
// Tier 2: | ||
"linuxArm64", | ||
// "watchosSimulatorArm64", | ||
"watchosX64w", | ||
"wwatchosArm32", | ||
"watchosArm64", | ||
"tvosSimulatorArm64", | ||
"tvosX64", | ||
"tvosArm64", | ||
"iosArm64", | ||
|
||
// Tier 3: | ||
// "androidNativeArm32", | ||
// "androidNativeArm64", | ||
// "androidNativeX86", | ||
// "androidNativeX64", | ||
"mingwX64", | ||
// "watchosDeviceArm64", | ||
|
||
// Deprecated: | ||
"iosArm32", | ||
"watchosX86", | ||
// "wasm32", | ||
"mingwX86", | ||
"linuxArm32Hfp", | ||
// "linuxMips32", | ||
// "linuxMipsel32", | ||
).flatMap { it.split(", ") } | ||
presets.filter { it.name in nativeTargets } | ||
.forEach { preset -> | ||
val target = targetFromPreset(preset, preset.name) | ||
nativeMainSets.add(target.compilations[org.jetbrains.kotlin.gradle.plugin.KotlinCompilation.MAIN_COMPILATION_NAME].kotlinSourceSets.first()) | ||
nativeTestSets.add(target.compilations[org.jetbrains.kotlin.gradle.plugin.KotlinCompilation.TEST_COMPILATION_NAME].kotlinSourceSets.first()) | ||
} | ||
|
||
sourceSets { | ||
if (!ideaActive) { | ||
configure(nativeMainSets) { | ||
dependsOn(sourceSets.maybeCreate("nativeMain")) | ||
} | ||
|
||
configure(nativeTestSets) { | ||
dependsOn(sourceSets.maybeCreate("nativeTest")) | ||
} | ||
} | ||
} | ||
} | ||
|
||
/* | ||
val hostOs = System.getProperty("os.name") | ||
val isMingwX64 = hostOs.startsWith("Windows") | ||
val nativeTarget = when { | ||
hostOs == "Mac OS X" -> macosX64("native") | ||
hostOs == "Linux" -> linuxX64("native") | ||
isMingwX64 -> mingwX64("native") | ||
else -> throw GradleException("Host OS is not supported in Kotlin/Native.") | ||
}*/ | ||
jvmToolchain(8) | ||
jvm() | ||
js { | ||
browser() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would be nice to add |
||
nodejs() | ||
} | ||
|
||
// https://kotlinlang.org/docs/native-target-support.html | ||
// Updated for Kotlin 2.0.0, serialization 1.7.0 | ||
// Commented ones are not supported by kotlinx-coroutines-core | ||
|
||
// Tier 1: | ||
macosX64() | ||
macosArm64() | ||
iosSimulatorArm64() | ||
iosX64() | ||
|
||
// Tier 2: | ||
linuxX64() | ||
linuxArm64() | ||
watchosSimulatorArm64() | ||
watchosX64() | ||
watchosArm32() | ||
watchosArm64() | ||
tvosSimulatorArm64() | ||
tvosX64() | ||
tvosArm64() | ||
iosArm64() | ||
|
||
// Tier 3: | ||
//androidNativeArm32() | ||
//androidNativeArm64() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there any issue with those targets? |
||
//androidNativeX86() | ||
//androidNativeX64() | ||
mingwX64() | ||
watchosDeviceArm64() | ||
|
||
applyDefaultHierarchyTemplate() | ||
sourceSets { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is not needed, as hierarchy is applied automatically if there is no manual source set creation |
||
val serializationVersion: String = Versions.serialization | ||
|
||
|
@@ -166,26 +76,13 @@ kotlin { | |
api(kotlin("reflect")) | ||
} | ||
} | ||
|
||
val jvmMain by getting | ||
val jvmTest by getting { | ||
dependencies { | ||
api(kotlin("test-junit")) | ||
api("com.charleskorn.kaml:kaml:0.34.0") | ||
api("org.yaml:snakeyaml:1.26") | ||
} | ||
} | ||
|
||
val jsMain by getting | ||
val jsTest by getting | ||
|
||
val nativeMain by getting { | ||
dependsOn(commonMain) | ||
} | ||
|
||
val nativeTest by getting { | ||
dependsOn(commonTest) | ||
} | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line can be dropped