HMPP: Parameterize NativePlatform with KonanTarget

Original commit: 8d2e999776
This commit is contained in:
Dmitriy Dolovov
2020-03-31 12:00:59 +07:00
parent 24a2194a77
commit 382884f273
3 changed files with 6 additions and 5 deletions
@@ -51,7 +51,7 @@ fun IdePlatform<*, *>.toNewPlatform(): NewPlatform = when (this) {
is CommonIdePlatformKind.Platform -> CommonPlatforms.defaultCommonPlatform
is JvmIdePlatformKind.Platform -> JvmPlatforms.jvmPlatformByTargetVersion(this.version)
is JsIdePlatformKind.Platform -> JsPlatforms.defaultJsPlatform
is NativeIdePlatformKind.Platform -> NativePlatforms.defaultNativePlatform
is NativeIdePlatformKind.Platform -> NativePlatforms.unspecifiedNativePlatform
else -> error("Unknown platform $this")
}
@@ -14,13 +14,14 @@ import org.jetbrains.kotlin.platform.IdePlatformKind
import org.jetbrains.kotlin.platform.TargetPlatform
import org.jetbrains.kotlin.platform.TargetPlatformVersion
import org.jetbrains.kotlin.platform.konan.NativePlatforms
import org.jetbrains.kotlin.platform.konan.isNative
object NativeIdePlatformKind : IdePlatformKind<NativeIdePlatformKind>() {
override fun supportsTargetPlatform(platform: TargetPlatform): Boolean = platform == NativePlatforms.defaultNativePlatform
override fun supportsTargetPlatform(platform: TargetPlatform): Boolean = platform.isNative()
override fun platformByCompilerArguments(arguments: CommonCompilerArguments): TargetPlatform? {
return if (arguments is FakeK2NativeCompilerArguments)
NativePlatforms.defaultNativePlatform
NativePlatforms.unspecifiedNativePlatform
else
null
}
@@ -30,7 +31,7 @@ object NativeIdePlatformKind : IdePlatformKind<NativeIdePlatformKind>() {
}
override val defaultPlatform: TargetPlatform
get() = NativePlatforms.defaultNativePlatform
get() = NativePlatforms.unspecifiedNativePlatform
@Deprecated(
message = "IdePlatform is deprecated and will be removed soon, please, migrate to org.jetbrains.kotlin.platform.TargetPlatform",
@@ -264,7 +264,7 @@ class ModulesTxtBuilder {
"js" -> settings.compilerArguments =
K2JSCompilerArguments().also { settings.targetPlatform = JsPlatforms.defaultJsPlatform }
"native" -> settings.compilerArguments =
FakeK2NativeCompilerArguments().also { settings.targetPlatform = NativePlatforms.defaultNativePlatform }
FakeK2NativeCompilerArguments().also { settings.targetPlatform = NativePlatforms.unspecifiedNativePlatform }
else -> {
val flagProperty = ModulesTxt.Module.flags[flag]
if (flagProperty != null) flagProperty.set(module, true)