Samples: Get rid of KotlinNativeTarget and KonanTarget imports

This commit is contained in:
Ilya Matveev
2019-05-31 17:37:48 +03:00
committed by Ilya Matveev
parent edda913b04
commit 90decbf517
13 changed files with 204 additions and 248 deletions
+12 -15
View File
@@ -1,23 +1,20 @@
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetPreset
plugins {
kotlin("multiplatform")
}
// Determine host preset.
val hostOs = System.getProperty("os.name")
val hostPreset: KotlinNativeTargetPreset = when {
hostOs == "Mac OS X" -> "macosX64"
hostOs == "Linux" -> "linuxX64"
hostOs.startsWith("Windows") -> "mingwX64"
else -> throw GradleException("Host OS '$hostOs' is not supported in Kotlin/Native $project.")
}.let {
kotlin.presets[it] as KotlinNativeTargetPreset
}
kotlin {
targetFromPreset(hostPreset, "workers") {
// Determine host preset.
val hostOs = System.getProperty("os.name")
// Create target for the host platform.
val hostTarget = when {
hostOs == "Mac OS X" -> macosX64("workers")
hostOs == "Linux" -> linuxX64("workers")
hostOs.startsWith("Windows") -> mingwX64("workers")
else -> throw GradleException("Host OS '$hostOs' is not supported in Kotlin/Native $project.")
}
hostTarget.apply {
binaries {
executable {
entryPoint = "sample.workers.main"