Rename: KonanPlatform, KonanPlatforms -> NativePlatform, NativePlatforms
Original commit: 9bbfe9c1ac
This commit is contained in:
@@ -20,7 +20,7 @@ import org.jetbrains.kotlin.platform.impl.JvmIdePlatformKind
|
||||
import org.jetbrains.kotlin.platform.js.JsPlatform
|
||||
import org.jetbrains.kotlin.platform.jvm.JdkPlatform
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatform
|
||||
import org.jetbrains.kotlin.platform.konan.KonanPlatform
|
||||
import org.jetbrains.kotlin.platform.konan.NativePlatform
|
||||
import java.lang.reflect.Modifier
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.full.superclasses
|
||||
@@ -40,7 +40,7 @@ fun TargetPlatform.createArguments(init: (CommonCompilerArguments).() -> Unit =
|
||||
jvmTarget = (singlePlatform as? JdkPlatform)?.targetVersion?.description ?: JvmTarget.DEFAULT.description
|
||||
}
|
||||
is JsPlatform -> K2JSCompilerArguments().apply { init() }
|
||||
is KonanPlatform -> FakeK2NativeCompilerArguments().apply { init() }
|
||||
is NativePlatform -> FakeK2NativeCompilerArguments().apply { init() }
|
||||
else -> error("Unknown platform $singlePlatform")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ import org.jetbrains.kotlin.platform.js.JsPlatforms
|
||||
import org.jetbrains.kotlin.platform.jvm.JdkPlatform
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatform
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import org.jetbrains.kotlin.platform.konan.KonanPlatform
|
||||
import org.jetbrains.kotlin.platform.konan.KonanPlatforms
|
||||
import org.jetbrains.kotlin.platform.konan.NativePlatforms
|
||||
import org.jetbrains.kotlin.platform.konan.NativePlatform
|
||||
|
||||
typealias OldPlatform = org.jetbrains.kotlin.resolve.TargetPlatform
|
||||
typealias NewPlatform = org.jetbrains.kotlin.platform.TargetPlatform
|
||||
@@ -29,7 +29,7 @@ fun NewPlatform.toOldPlatform(): OldPlatform = when (val single = singleOrNull()
|
||||
null -> CommonPlatforms.CompatCommonPlatform
|
||||
is JvmPlatform -> JvmPlatforms.CompatJvmPlatform
|
||||
is JsPlatform -> JsPlatforms.CompatJsPlatform
|
||||
is KonanPlatform -> KonanPlatforms.CompatKonanPlatform
|
||||
is NativePlatform -> NativePlatforms.CompatNativePlatform
|
||||
else -> error("Unknown platform $single")
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ fun OldPlatform.toNewPlatform(): NewPlatform = when (this) {
|
||||
is CommonPlatforms.CompatCommonPlatform -> this
|
||||
is JvmPlatforms.CompatJvmPlatform -> this
|
||||
is JsPlatforms.CompatJsPlatform -> this
|
||||
is KonanPlatforms.CompatKonanPlatform -> this
|
||||
is NativePlatforms.CompatNativePlatform -> this
|
||||
else -> error(
|
||||
"Can't convert org.jetbrains.kotlin.resolve.TargetPlatform to org.jetbrains.kotlin.platform.TargetPlatform: " +
|
||||
"non-Compat instance passed\n" +
|
||||
@@ -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 -> KonanPlatforms.defaultKonanPlatform
|
||||
is NativeIdePlatformKind.Platform -> NativePlatforms.defaultNativePlatform
|
||||
else -> error("Unknown platform $this")
|
||||
}
|
||||
|
||||
@@ -60,6 +60,6 @@ fun NewPlatform.toIdePlatform(): IdePlatform<*, *> = when (val single = singleOr
|
||||
is JdkPlatform -> JvmIdePlatformKind.Platform(single.targetVersion)
|
||||
is JvmPlatform -> JvmIdePlatformKind.Platform(JvmTarget.DEFAULT)
|
||||
is JsPlatform -> JsIdePlatformKind.Platform
|
||||
is KonanPlatform -> NativeIdePlatformKind.Platform
|
||||
is NativePlatform -> NativeIdePlatformKind.Platform
|
||||
else -> error("Unknown platform $single")
|
||||
}
|
||||
|
||||
@@ -13,14 +13,14 @@ import org.jetbrains.kotlin.platform.IdePlatform
|
||||
import org.jetbrains.kotlin.platform.IdePlatformKind
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.platform.TargetPlatformVersion
|
||||
import org.jetbrains.kotlin.platform.konan.KonanPlatforms
|
||||
import org.jetbrains.kotlin.platform.konan.NativePlatforms
|
||||
|
||||
object NativeIdePlatformKind : IdePlatformKind<NativeIdePlatformKind>() {
|
||||
override fun supportsTargetPlatform(platform: TargetPlatform): Boolean = platform == KonanPlatforms.defaultKonanPlatform
|
||||
override fun supportsTargetPlatform(platform: TargetPlatform): Boolean = platform == NativePlatforms.defaultNativePlatform
|
||||
|
||||
override fun platformByCompilerArguments(arguments: CommonCompilerArguments): TargetPlatform? {
|
||||
return if (arguments is FakeK2NativeCompilerArguments)
|
||||
KonanPlatforms.defaultKonanPlatform
|
||||
NativePlatforms.defaultNativePlatform
|
||||
else
|
||||
null
|
||||
}
|
||||
@@ -30,7 +30,7 @@ object NativeIdePlatformKind : IdePlatformKind<NativeIdePlatformKind>() {
|
||||
}
|
||||
|
||||
override val defaultPlatform: TargetPlatform
|
||||
get() = KonanPlatforms.defaultKonanPlatform
|
||||
get() = NativePlatforms.defaultNativePlatform
|
||||
|
||||
@Deprecated(
|
||||
message = "IdePlatform is deprecated and will be removed soon, please, migrate to org.jetbrains.kotlin.platform.TargetPlatform",
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.platform.isCommon
|
||||
import org.jetbrains.kotlin.platform.js.JsPlatforms
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import org.jetbrains.kotlin.platform.jvm.isJvm
|
||||
import org.jetbrains.kotlin.platform.konan.KonanPlatforms
|
||||
import org.jetbrains.kotlin.platform.konan.NativePlatforms
|
||||
import java.io.File
|
||||
import kotlin.reflect.KMutableProperty1
|
||||
import kotlin.reflect.full.findAnnotation
|
||||
@@ -264,7 +264,7 @@ class ModulesTxtBuilder {
|
||||
"js" -> settings.compilerArguments =
|
||||
K2JSCompilerArguments().also { settings.targetPlatform = JsPlatforms.defaultJsPlatform }
|
||||
"native" -> settings.compilerArguments =
|
||||
FakeK2NativeCompilerArguments().also { settings.targetPlatform = KonanPlatforms.defaultKonanPlatform }
|
||||
FakeK2NativeCompilerArguments().also { settings.targetPlatform = NativePlatforms.defaultNativePlatform }
|
||||
else -> {
|
||||
val flagProperty = ModulesTxt.Module.flags[flag]
|
||||
if (flagProperty != null) flagProperty.set(module, true)
|
||||
|
||||
Reference in New Issue
Block a user