Rename: KonanPlatform, KonanPlatforms -> NativePlatform, NativePlatforms
This commit is contained in:
@@ -5,12 +5,12 @@
|
||||
|
||||
package org.jetbrains.kotlin.platform
|
||||
|
||||
import org.jetbrains.kotlin.platform.js.JsPlatforms
|
||||
import org.jetbrains.kotlin.platform.js.JsPlatforms.allJsPlatforms
|
||||
import org.jetbrains.kotlin.platform.js.JsPlatforms.defaultJsPlatform
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms.allJvmPlatforms
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms.unspecifiedJvmPlatform
|
||||
import org.jetbrains.kotlin.platform.konan.KonanPlatforms
|
||||
import org.jetbrains.kotlin.platform.konan.KonanPlatforms.defaultKonanPlatform
|
||||
import org.jetbrains.kotlin.platform.konan.NativePlatforms.allNativePlatforms
|
||||
import org.jetbrains.kotlin.platform.konan.NativePlatforms.defaultNativePlatform
|
||||
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
object CommonPlatforms {
|
||||
@@ -23,7 +23,7 @@ object CommonPlatforms {
|
||||
setOf(
|
||||
unspecifiedJvmPlatform.single(),
|
||||
defaultJsPlatform.single(),
|
||||
defaultKonanPlatform.single()
|
||||
defaultNativePlatform.single()
|
||||
)
|
||||
), org.jetbrains.kotlin.analyzer.common.CommonPlatform {
|
||||
override val platformName: String
|
||||
@@ -36,9 +36,9 @@ object CommonPlatforms {
|
||||
val allSimplePlatforms: List<TargetPlatform>
|
||||
// TODO(auskov): migrate to SimplePlatform?
|
||||
get() = sequence {
|
||||
yieldAll(JvmPlatforms.allJvmPlatforms)
|
||||
yieldAll(KonanPlatforms.allKonanPlatforms)
|
||||
yieldAll(JsPlatforms.allJsPlatforms)
|
||||
yieldAll(allJvmPlatforms)
|
||||
yieldAll(allNativePlatforms)
|
||||
yieldAll(allJsPlatforms)
|
||||
|
||||
// TODO(dsavvinov): extensions points?
|
||||
}.toList()
|
||||
|
||||
+9
-10
@@ -7,32 +7,31 @@ package org.jetbrains.kotlin.platform.konan
|
||||
|
||||
import org.jetbrains.kotlin.platform.SimplePlatform
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.platform.toTargetPlatform
|
||||
|
||||
abstract class KonanPlatform : SimplePlatform("Native") {
|
||||
abstract class NativePlatform : SimplePlatform("Native") {
|
||||
override val oldFashionedDescription: String
|
||||
get() = "Native "
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
object KonanPlatforms {
|
||||
private object DefaultSimpleKonanPlatform : KonanPlatform()
|
||||
object NativePlatforms {
|
||||
private object DefaultSimpleNativePlatform : NativePlatform()
|
||||
|
||||
@Deprecated(
|
||||
message = "Should be accessed only by compatibility layer, other clients should use 'defaultKonanPlatform'",
|
||||
message = "Should be accessed only by compatibility layer, other clients should use 'defaultNativePlatform'",
|
||||
level = DeprecationLevel.ERROR
|
||||
)
|
||||
object CompatKonanPlatform : TargetPlatform(setOf(DefaultSimpleKonanPlatform)),
|
||||
object CompatNativePlatform : TargetPlatform(setOf(DefaultSimpleNativePlatform)),
|
||||
// Needed for backward compatibility, because old code uses INSTANCEOF checks instead of calling extensions
|
||||
org.jetbrains.kotlin.resolve.konan.platform.KonanPlatform {
|
||||
override val platformName: String
|
||||
get() = "Native"
|
||||
}
|
||||
|
||||
val defaultKonanPlatform: TargetPlatform
|
||||
get() = CompatKonanPlatform
|
||||
val defaultNativePlatform: TargetPlatform
|
||||
get() = CompatNativePlatform
|
||||
|
||||
val allKonanPlatforms: List<TargetPlatform> = listOf(defaultKonanPlatform)
|
||||
val allNativePlatforms: List<TargetPlatform> = listOf(defaultNativePlatform)
|
||||
}
|
||||
|
||||
fun TargetPlatform?.isNative(): Boolean = this?.singleOrNull() is KonanPlatform
|
||||
fun TargetPlatform?.isNative(): Boolean = this?.singleOrNull() is NativePlatform
|
||||
+3
-3
@@ -7,17 +7,17 @@
|
||||
|
||||
package org.jetbrains.kotlin.resolve.konan.platform
|
||||
|
||||
import org.jetbrains.kotlin.platform.konan.KonanPlatforms
|
||||
import org.jetbrains.kotlin.platform.konan.NativePlatforms
|
||||
import org.jetbrains.kotlin.resolve.TargetPlatform
|
||||
|
||||
@Deprecated(
|
||||
message = "This class is deprecated and will be removed soon, use API from 'org.jetbrains.kotlin.platform.*' packages instead",
|
||||
replaceWith = ReplaceWith("KonanPlatforms.defaultKonanPlatform", "org.jetbrains.kotlin.platform.konan.KonanPlatforms"),
|
||||
replaceWith = ReplaceWith("NativePlatforms.defaultNativePlatform", "org.jetbrains.kotlin.platform.konan.NativePlatforms"),
|
||||
level = DeprecationLevel.ERROR
|
||||
)
|
||||
interface KonanPlatform : TargetPlatform {
|
||||
companion object {
|
||||
@JvmField
|
||||
val INSTANCE: KonanPlatform = KonanPlatforms.CompatKonanPlatform
|
||||
val INSTANCE: KonanPlatform = NativePlatforms.CompatNativePlatform
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -17,7 +17,7 @@ import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
|
||||
import org.jetbrains.kotlin.frontend.di.configureModule
|
||||
import org.jetbrains.kotlin.frontend.di.configureStandardResolveComponents
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.platform.konan.KonanPlatforms
|
||||
import org.jetbrains.kotlin.platform.konan.NativePlatforms
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.resolve.*
|
||||
import org.jetbrains.kotlin.resolve.konan.platform.NativePlatformAnalyzerServices
|
||||
@@ -93,7 +93,7 @@ private fun createFakeTopDownAnalyzerForNative(
|
||||
): LazyTopDownAnalyzer = createContainer("FakeTopDownAnalyzerForNative", NativePlatformAnalyzerServices) {
|
||||
configureModule(
|
||||
moduleContext,
|
||||
KonanPlatforms.defaultKonanPlatform,
|
||||
NativePlatforms.defaultNativePlatform,
|
||||
NativePlatformAnalyzerServices,
|
||||
bindingTrace,
|
||||
languageVersionSettings
|
||||
|
||||
@@ -46,7 +46,7 @@ import org.jetbrains.kotlin.platform.CommonPlatforms
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.platform.js.JsPlatforms
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import org.jetbrains.kotlin.platform.konan.KonanPlatforms
|
||||
import org.jetbrains.kotlin.platform.konan.NativePlatforms
|
||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
@@ -506,7 +506,7 @@ abstract class BaseDiagnosticsTest : KotlinMultiFileTestWithJava<TestModule, Tes
|
||||
nameSuffix == "COMMON" -> CommonPlatforms.defaultCommonPlatform
|
||||
nameSuffix == "JVM" -> JvmPlatforms.unspecifiedJvmPlatform // TODO(dsavvinov): determine JvmTarget precisely
|
||||
nameSuffix == "JS" -> JsPlatforms.defaultJsPlatform
|
||||
nameSuffix == "NATIVE" -> KonanPlatforms.defaultKonanPlatform
|
||||
nameSuffix == "NATIVE" -> NativePlatforms.defaultNativePlatform
|
||||
nameSuffix.isEmpty() -> null // TODO(dsavvinov): this leads to 'null'-platform in ModuleDescriptor
|
||||
else -> throw IllegalStateException("Can't determine platform by name $nameSuffix")
|
||||
}
|
||||
|
||||
+2
-2
@@ -11,7 +11,7 @@ import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
|
||||
import org.jetbrains.kotlin.descriptors.konan.*
|
||||
import org.jetbrains.kotlin.descriptors.konan.isInteropLibrary
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.platform.konan.KonanPlatforms
|
||||
import org.jetbrains.kotlin.platform.konan.NativePlatforms
|
||||
import org.jetbrains.kotlin.resolve.ImplicitIntegerCoercion
|
||||
import org.jetbrains.kotlin.storage.StorageManager
|
||||
|
||||
@@ -31,7 +31,7 @@ internal class KlibModuleDescriptorFactoryImpl(val createBuiltIns: (StorageManag
|
||||
KlibModuleOrigin.CAPABILITY to origin,
|
||||
ImplicitIntegerCoercion.MODULE_CAPABILITY to origin.isInteropLibrary()
|
||||
),
|
||||
platform = KonanPlatforms.defaultKonanPlatform
|
||||
platform = NativePlatforms.defaultNativePlatform
|
||||
)
|
||||
|
||||
override fun createDescriptorAndNewBuiltIns(
|
||||
|
||||
+4
-4
@@ -35,8 +35,8 @@ import org.jetbrains.kotlin.platform.idePlatformKind
|
||||
import org.jetbrains.kotlin.platform.isCommon
|
||||
import org.jetbrains.kotlin.platform.js.isJs
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatform
|
||||
import org.jetbrains.kotlin.platform.konan.KonanPlatform
|
||||
import org.jetbrains.kotlin.platform.konan.KonanPlatforms
|
||||
import org.jetbrains.kotlin.platform.konan.NativePlatform
|
||||
import org.jetbrains.kotlin.platform.konan.NativePlatforms
|
||||
import org.jetbrains.kotlin.resolve.*
|
||||
import org.jetbrains.kotlin.resolve.checkers.ExperimentalMarkerDeclarationAnnotationChecker
|
||||
import org.jetbrains.kotlin.resolve.jvm.JavaDescriptorResolver
|
||||
@@ -136,8 +136,8 @@ class CompositeResolverForModuleFactory(
|
||||
if (targetPlatform.has<JvmPlatform>()) listOf(container.get<JavaDescriptorResolver>().packageFragmentProvider) else emptyList()
|
||||
|
||||
private fun getKonanProvidersIfAny(moduleInfo: ModuleInfo, container: StorageComponentContainer): List<PackageFragmentProvider> {
|
||||
if (!targetPlatform.has<KonanPlatform>()) return emptyList()
|
||||
val resolution = KonanPlatforms.defaultKonanPlatform.idePlatformKind.resolution
|
||||
if (!targetPlatform.has<NativePlatform>()) return emptyList()
|
||||
val resolution = NativePlatforms.defaultNativePlatform.idePlatformKind.resolution
|
||||
|
||||
val konanProvider = resolution.createPlatformSpecificPackageFragmentProvider(
|
||||
moduleInfo,
|
||||
|
||||
@@ -14,7 +14,7 @@ import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.platform.isCommon
|
||||
import org.jetbrains.kotlin.platform.js.JsPlatform
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatform
|
||||
import org.jetbrains.kotlin.platform.konan.KonanPlatform
|
||||
import org.jetbrains.kotlin.platform.konan.NativePlatform
|
||||
import org.jetbrains.kotlin.resolve.*
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformAnalyzerServices
|
||||
import org.jetbrains.kotlin.resolve.konan.platform.NativePlatformAnalyzerServices
|
||||
@@ -30,7 +30,7 @@ fun SimplePlatform.findAnalyzerServices(): PlatformDependentAnalyzerServices {
|
||||
return when (this) {
|
||||
is JvmPlatform -> JvmPlatformAnalyzerServices
|
||||
is JsPlatform -> JsPlatformAnalyzerServices
|
||||
is KonanPlatform -> NativePlatformAnalyzerServices
|
||||
is NativePlatform -> NativePlatformAnalyzerServices
|
||||
else -> throw IllegalStateException("Unknown platform $this")
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -10,7 +10,7 @@ import org.jetbrains.kotlin.ide.konan.hasKotlinNativeRuntimeInScope
|
||||
import org.jetbrains.kotlin.idea.configuration.ConfigureKotlinStatus
|
||||
import org.jetbrains.kotlin.idea.configuration.KotlinWithGradleConfigurator
|
||||
import org.jetbrains.kotlin.idea.configuration.ModuleSourceRootGroup
|
||||
import org.jetbrains.kotlin.platform.konan.KonanPlatforms
|
||||
import org.jetbrains.kotlin.platform.konan.NativePlatforms
|
||||
|
||||
open class KotlinNativeGradleConfigurator : KotlinWithGradleConfigurator() {
|
||||
override fun getKotlinPluginExpression(forKotlinDsl: Boolean): String = ""
|
||||
@@ -29,10 +29,10 @@ open class KotlinNativeGradleConfigurator : KotlinWithGradleConfigurator() {
|
||||
|
||||
override val name: String get() = NAME
|
||||
|
||||
override val targetPlatform get() = KonanPlatforms.defaultKonanPlatform
|
||||
override val targetPlatform get() = NativePlatforms.defaultNativePlatform
|
||||
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
override fun getTargetPlatform() = KonanPlatforms.CompatKonanPlatform
|
||||
override fun getTargetPlatform() = NativePlatforms.CompatNativePlatform
|
||||
|
||||
override val presentableText get() = PRESENTABLE_TEXT
|
||||
|
||||
|
||||
+2
-2
@@ -41,7 +41,7 @@ import org.jetbrains.kotlin.idea.KotlinIdeaGradleBundle;
|
||||
import org.jetbrains.kotlin.idea.facet.KotlinFacet;
|
||||
import org.jetbrains.kotlin.platform.TargetPlatformKt;
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform;
|
||||
import org.jetbrains.kotlin.platform.konan.KonanPlatformKt;
|
||||
import org.jetbrains.kotlin.platform.konan.NativePlatformKt;
|
||||
import org.jetbrains.plugins.gradle.execution.build.CachedModuleDataFinder;
|
||||
import org.jetbrains.plugins.gradle.execution.build.GradleProjectTaskRunner;
|
||||
import org.jetbrains.plugins.gradle.service.project.GradleBuildSrcProjectsResolver;
|
||||
@@ -302,7 +302,7 @@ class KotlinMPPGradleProjectTaskRunner extends ProjectTaskRunner
|
||||
final TargetPlatform platform = kotlinFacet.getConfiguration().getSettings().getTargetPlatform();
|
||||
if (platform == null) return false;
|
||||
|
||||
return KonanPlatformKt.isNative(platform);
|
||||
return NativePlatformKt.isNative(platform);
|
||||
}
|
||||
|
||||
private static boolean isCommonProductionSourceModule(Module module) {
|
||||
|
||||
+2
-2
@@ -39,7 +39,7 @@ import org.jetbrains.kotlin.idea.KotlinIdeaGradleBundle;
|
||||
import org.jetbrains.kotlin.idea.facet.KotlinFacet;
|
||||
import org.jetbrains.kotlin.platform.TargetPlatformKt;
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform;
|
||||
import org.jetbrains.kotlin.platform.konan.KonanPlatformKt;
|
||||
import org.jetbrains.kotlin.platform.konan.NativePlatformKt;
|
||||
import org.jetbrains.plugins.gradle.execution.build.CachedModuleDataFinder;
|
||||
import org.jetbrains.plugins.gradle.execution.build.GradleProjectTaskRunner;
|
||||
import org.jetbrains.plugins.gradle.service.project.GradleBuildSrcProjectsResolver;
|
||||
@@ -299,7 +299,7 @@ class KotlinMPPGradleProjectTaskRunner extends ProjectTaskRunner
|
||||
final TargetPlatform platform = kotlinFacet.getConfiguration().getSettings().getTargetPlatform();
|
||||
if (platform == null) return false;
|
||||
|
||||
return KonanPlatformKt.isNative(platform);
|
||||
return NativePlatformKt.isNative(platform);
|
||||
}
|
||||
|
||||
private static boolean isCommonProductionSourceModule(Module module) {
|
||||
|
||||
+7
-7
@@ -12,7 +12,7 @@ import org.jetbrains.kotlin.config.*
|
||||
import org.jetbrains.kotlin.idea.codeInsight.gradle.MultiplePluginVersionGradleImportingTestCase
|
||||
import org.jetbrains.kotlin.platform.js.JsPlatforms
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import org.jetbrains.kotlin.platform.konan.KonanPlatforms
|
||||
import org.jetbrains.kotlin.platform.konan.NativePlatforms
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.PluginTargetVersions
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
@@ -60,7 +60,7 @@ class HierarchicalMultiplatformProjectImportingTest : MultiplePluginVersionGradl
|
||||
module("my-app")
|
||||
module("project.my-app.commonMain") {
|
||||
isHMPP(true)
|
||||
targetPlatform(JsPlatforms.defaultJsPlatform, JvmPlatforms.jvm16, KonanPlatforms.defaultKonanPlatform)
|
||||
targetPlatform(JsPlatforms.defaultJsPlatform, JvmPlatforms.jvm16, NativePlatforms.defaultNativePlatform)
|
||||
libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.COMPILE)
|
||||
sourceFolder("src/commonMain/kotlin", SourceKotlinRootType)
|
||||
sourceFolder("src/commonMain/resources", ResourceKotlinRootType)
|
||||
@@ -68,7 +68,7 @@ class HierarchicalMultiplatformProjectImportingTest : MultiplePluginVersionGradl
|
||||
|
||||
module("project.my-app.commonTest") {
|
||||
isHMPP(true)
|
||||
targetPlatform(JsPlatforms.defaultJsPlatform, JvmPlatforms.jvm16, KonanPlatforms.defaultKonanPlatform)
|
||||
targetPlatform(JsPlatforms.defaultJsPlatform, JvmPlatforms.jvm16, NativePlatforms.defaultNativePlatform)
|
||||
libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.TEST)
|
||||
libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-test-annotations-common:${gradleKotlinPluginVersion}", DependencyScope.TEST)
|
||||
libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-test-common:${gradleKotlinPluginVersion}", DependencyScope.TEST)
|
||||
@@ -165,7 +165,7 @@ class HierarchicalMultiplatformProjectImportingTest : MultiplePluginVersionGradl
|
||||
|
||||
module("project.my-app.linuxAndJsMain") {
|
||||
isHMPP(true)
|
||||
targetPlatform(JsPlatforms.defaultJsPlatform, KonanPlatforms.defaultKonanPlatform)
|
||||
targetPlatform(JsPlatforms.defaultJsPlatform, NativePlatforms.defaultNativePlatform)
|
||||
libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.COMPILE)
|
||||
moduleDependency("project.my-app.commonMain", DependencyScope.COMPILE)
|
||||
sourceFolder("src/linuxAndJsMain/kotlin", SourceKotlinRootType)
|
||||
@@ -174,7 +174,7 @@ class HierarchicalMultiplatformProjectImportingTest : MultiplePluginVersionGradl
|
||||
|
||||
module("project.my-app.linuxAndJsTest") {
|
||||
isHMPP(true)
|
||||
targetPlatform(JsPlatforms.defaultJsPlatform, KonanPlatforms.defaultKonanPlatform)
|
||||
targetPlatform(JsPlatforms.defaultJsPlatform, NativePlatforms.defaultNativePlatform)
|
||||
sourceFolder("src/linuxAndJsTest/kotlin", TestSourceKotlinRootType)
|
||||
sourceFolder("src/linuxAndJsTest/resources", TestResourceKotlinRootType)
|
||||
libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.TEST)
|
||||
@@ -187,7 +187,7 @@ class HierarchicalMultiplatformProjectImportingTest : MultiplePluginVersionGradl
|
||||
|
||||
module("project.my-app.linuxX64Main") {
|
||||
isHMPP(true)
|
||||
targetPlatform(KonanPlatforms.defaultKonanPlatform)
|
||||
targetPlatform(NativePlatforms.defaultNativePlatform)
|
||||
libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.COMPILE)
|
||||
libraryDependency("Kotlin/Native ${gradleKotlinPluginVersion} - builtin [linux_x64]", DependencyScope.PROVIDED)
|
||||
libraryDependency("Kotlin/Native ${gradleKotlinPluginVersion} - iconv [linux_x64]", DependencyScope.PROVIDED)
|
||||
@@ -203,7 +203,7 @@ class HierarchicalMultiplatformProjectImportingTest : MultiplePluginVersionGradl
|
||||
|
||||
module("project.my-app.linuxX64Test") {
|
||||
isHMPP(true)
|
||||
targetPlatform(KonanPlatforms.defaultKonanPlatform)
|
||||
targetPlatform(NativePlatforms.defaultNativePlatform)
|
||||
libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.TEST)
|
||||
libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-test-annotations-common:${gradleKotlinPluginVersion}", DependencyScope.TEST)
|
||||
libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-test-common:${gradleKotlinPluginVersion}", DependencyScope.TEST)
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
+4
-4
@@ -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",
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.platform.impl.NativeIdePlatformKind
|
||||
import org.jetbrains.kotlin.psi.KtFunction
|
||||
import org.jetbrains.kotlin.psi.KtNamedDeclaration
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.platform.konan.KonanPlatforms
|
||||
import org.jetbrains.kotlin.platform.konan.NativePlatforms
|
||||
import javax.swing.Icon
|
||||
|
||||
class NativeIdePlatformKindTooling : IdePlatformKindTooling() {
|
||||
@@ -59,7 +59,7 @@ class NativeIdePlatformKindTooling : IdePlatformKindTooling() {
|
||||
|
||||
object NativeLibraryKind : PersistentLibraryKind<DummyLibraryProperties>("kotlin.native"), KotlinLibraryKind {
|
||||
override val compilerPlatform: TargetPlatform
|
||||
get() = KonanPlatforms.defaultKonanPlatform
|
||||
get() = NativePlatforms.defaultNativePlatform
|
||||
|
||||
override fun createDefaultProperties() = DummyLibraryProperties.INSTANCE!!
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import com.intellij.openapi.roots.libraries.ui.LibraryEditorComponent
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import org.jetbrains.kotlin.idea.KotlinIcons
|
||||
import org.jetbrains.kotlin.idea.klib.isKlibLibraryRootForPlatform
|
||||
import org.jetbrains.kotlin.platform.konan.KonanPlatforms
|
||||
import org.jetbrains.kotlin.platform.konan.NativePlatforms
|
||||
import javax.swing.Icon
|
||||
import javax.swing.JComponent
|
||||
|
||||
@@ -25,7 +25,7 @@ object NativeLibraryType : LibraryType<DummyLibraryProperties>(NativeLibraryKind
|
||||
// However this does not work for libraries that are to be just created during project build, e.g. C-interop Kotlin/Native KLIBs.
|
||||
// The code below helps to perform postponed detection of Kotlin/Native libraries.
|
||||
override fun detect(classesRoots: List<VirtualFile>): DummyLibraryProperties? =
|
||||
if (classesRoots.firstOrNull()?.isKlibLibraryRootForPlatform(KonanPlatforms.defaultKonanPlatform) == true)
|
||||
if (classesRoots.firstOrNull()?.isKlibLibraryRootForPlatform(NativePlatforms.defaultNativePlatform) == true)
|
||||
DummyLibraryProperties.INSTANCE!!
|
||||
else null
|
||||
|
||||
|
||||
@@ -38,10 +38,10 @@ import org.jetbrains.kotlin.konan.util.KlibMetadataFactories
|
||||
import org.jetbrains.kotlin.library.isInterop
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.platform.impl.NativeIdePlatformKind
|
||||
import org.jetbrains.kotlin.platform.konan.KonanPlatforms
|
||||
import org.jetbrains.kotlin.resolve.ImplicitIntegerCoercion
|
||||
import org.jetbrains.kotlin.resolve.TargetEnvironment
|
||||
import org.jetbrains.kotlin.library.metadata.NullFlexibleTypeDeserializer
|
||||
import org.jetbrains.kotlin.platform.konan.NativePlatforms
|
||||
import org.jetbrains.kotlin.serialization.konan.impl.KlibMetadataModuleDescriptorFactoryImpl
|
||||
import org.jetbrains.kotlin.storage.StorageManager
|
||||
|
||||
@@ -64,7 +64,7 @@ class NativePlatformKindResolution : IdePlatformKindResolution {
|
||||
createNativeKlibPackageFragmentProvider(moduleInfo, storageManager, languageVersionSettings, moduleDescriptor)
|
||||
|
||||
override fun isLibraryFileForPlatform(virtualFile: VirtualFile): Boolean =
|
||||
virtualFile.isKlibLibraryRootForPlatform(KonanPlatforms.defaultKonanPlatform)
|
||||
virtualFile.isKlibLibraryRootForPlatform(NativePlatforms.defaultNativePlatform)
|
||||
|
||||
override fun createResolverForModuleFactory(
|
||||
settings: PlatformAnalysisParameters,
|
||||
@@ -168,5 +168,5 @@ class NativeKlibLibraryInfo(project: Project, library: Library, libraryRoot: Str
|
||||
}
|
||||
|
||||
override val platform: TargetPlatform
|
||||
get() = KonanPlatforms.defaultKonanPlatform
|
||||
get() = NativePlatforms.defaultNativePlatform
|
||||
}
|
||||
|
||||
+2
-3
@@ -14,13 +14,12 @@ import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
|
||||
import org.jetbrains.kotlin.frontend.di.createContainerForLazyResolve
|
||||
import org.jetbrains.kotlin.ide.konan.NativePlatformKindResolution.Companion.createNativeKlibPackageFragmentProvider
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.platform.konan.KonanPlatforms
|
||||
import org.jetbrains.kotlin.platform.konan.NativePlatforms
|
||||
import org.jetbrains.kotlin.resolve.CodeAnalyzerInitializer
|
||||
import org.jetbrains.kotlin.resolve.TargetEnvironment
|
||||
import org.jetbrains.kotlin.resolve.konan.platform.NativePlatformAnalyzerServices
|
||||
import org.jetbrains.kotlin.resolve.lazy.ResolveSession
|
||||
import org.jetbrains.kotlin.resolve.lazy.declarations.DeclarationProviderFactoryService.Companion.createDeclarationProviderFactory
|
||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||
|
||||
class NativeResolverForModuleFactory(
|
||||
private val platformAnalysisParameters: PlatformAnalysisParameters,
|
||||
@@ -47,7 +46,7 @@ class NativeResolverForModuleFactory(
|
||||
moduleContext,
|
||||
declarationProviderFactory,
|
||||
CodeAnalyzerInitializer.getInstance(moduleContext.project).createTrace(),
|
||||
KonanPlatforms.defaultKonanPlatform,
|
||||
NativePlatforms.defaultNativePlatform,
|
||||
NativePlatformAnalyzerServices,
|
||||
targetEnvironment,
|
||||
languageVersionSettings
|
||||
|
||||
+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