diff --git a/compiler/cli/cli-common/build.gradle.kts b/compiler/cli/cli-common/build.gradle.kts index 4fb00c558a6e5..128c56b6a1f6a 100644 --- a/compiler/cli/cli-common/build.gradle.kts +++ b/compiler/cli/cli-common/build.gradle.kts @@ -8,6 +8,7 @@ dependencies { compile(project(":compiler:config")) compile(project(":compiler:config.jvm")) compile(project(":js:js.config")) + compile(project(":native:kotlin-native-utils")) compileOnly(project(":kotlin-reflect-api")) compileOnly(intellijCoreDep()) { includeJars("intellij-core") } compileOnly(intellijDep()) { includeIntellijCoreJarDependencies(project) } diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/platform/CommonPlatforms.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/platform/CommonPlatforms.kt index a8de68fa853d2..134d03665fc6a 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/platform/CommonPlatforms.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/platform/CommonPlatforms.kt @@ -10,7 +10,7 @@ import org.jetbrains.kotlin.platform.js.JsPlatforms.defaultJsPlatform import org.jetbrains.kotlin.platform.jvm.JvmPlatforms.allJvmPlatforms import org.jetbrains.kotlin.platform.jvm.JvmPlatforms.unspecifiedJvmPlatform import org.jetbrains.kotlin.platform.konan.NativePlatforms.allNativePlatforms -import org.jetbrains.kotlin.platform.konan.NativePlatforms.defaultNativePlatform +import org.jetbrains.kotlin.platform.konan.NativePlatforms.unspecifiedNativePlatform @Suppress("DEPRECATION_ERROR") object CommonPlatforms { @@ -23,7 +23,7 @@ object CommonPlatforms { setOf( unspecifiedJvmPlatform.single(), defaultJsPlatform.single(), - defaultNativePlatform.single() + unspecifiedNativePlatform.single() ) ), org.jetbrains.kotlin.analyzer.common.CommonPlatform { override val platformName: String diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/platform/konan/NativePlatform.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/platform/konan/NativePlatform.kt index 34cdf369ce093..468c783e7aee0 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/platform/konan/NativePlatform.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/platform/konan/NativePlatform.kt @@ -5,33 +5,62 @@ package org.jetbrains.kotlin.platform.konan +import org.jetbrains.kotlin.konan.target.KonanTarget import org.jetbrains.kotlin.platform.SimplePlatform import org.jetbrains.kotlin.platform.TargetPlatform +import org.jetbrains.kotlin.platform.toTargetPlatform + +sealed class NativePlatform : SimplePlatform("Native") + +object NativePlatformUnspecifiedTarget : NativePlatform() { + override fun toString() = "$platformName (general)" + + override val oldFashionedDescription: String + get() = "Native (general) " +} + +data class NativePlatformWithTarget(val target: KonanTarget) : NativePlatform() { + override fun toString() = "$platformName ($target)" -abstract class NativePlatform : SimplePlatform("Native") { override val oldFashionedDescription: String - get() = "Native " + get() = "Native ($target) " } @Suppress("DEPRECATION_ERROR") object NativePlatforms { - private object DefaultSimpleNativePlatform : NativePlatform() + private val predefinedNativeTargetToSimpleNativePlatform: Map = + KonanTarget.predefinedTargets.values.associateWith { NativePlatformWithTarget(it) } + + private val predefinedNativeTargetToNativePlatform: Map = + predefinedNativeTargetToSimpleNativePlatform.mapValues { (_, simplePlatform) -> simplePlatform.toTargetPlatform() } + + val unspecifiedNativePlatform: TargetPlatform + get() = CompatNativePlatform + + val allNativePlatforms: List = listOf(unspecifiedNativePlatform) + predefinedNativeTargetToNativePlatform.values + + fun nativePlatformBySingleTarget(target: KonanTarget): TargetPlatform = + predefinedNativeTargetToNativePlatform[target] ?: unspecifiedNativePlatform + + fun nativePlatformByTargets(targets: Collection): TargetPlatform { + val simplePlatforms = targets.mapNotNullTo(HashSet()) { predefinedNativeTargetToSimpleNativePlatform[it] } + return when (simplePlatforms.size) { + 0 -> unspecifiedNativePlatform + 1 -> nativePlatformBySingleTarget(simplePlatforms.first().target) + else -> TargetPlatform(simplePlatforms) + } + } @Deprecated( - message = "Should be accessed only by compatibility layer, other clients should use 'defaultNativePlatform'", + message = "Should be accessed only by compatibility layer, other clients should use 'unspecifiedNativePlatform'", level = DeprecationLevel.ERROR ) - object CompatNativePlatform : TargetPlatform(setOf(DefaultSimpleNativePlatform)), + object CompatNativePlatform : TargetPlatform(setOf(NativePlatformUnspecifiedTarget)), // 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 defaultNativePlatform: TargetPlatform - get() = CompatNativePlatform - - val allNativePlatforms: List = listOf(defaultNativePlatform) } -fun TargetPlatform?.isNative(): Boolean = this?.singleOrNull() is NativePlatform +fun TargetPlatform?.isNative(): Boolean = this?.isNotEmpty() == true && all { it is NativePlatform } diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/resolve/konan/platform/KonanPlatform.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/resolve/konan/platform/KonanPlatform.kt index 9c175948f18cd..87036e2c2cf7d 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/resolve/konan/platform/KonanPlatform.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/resolve/konan/platform/KonanPlatform.kt @@ -12,7 +12,7 @@ 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("NativePlatforms.defaultNativePlatform", "org.jetbrains.kotlin.platform.konan.NativePlatforms"), + replaceWith = ReplaceWith("NativePlatforms.unspecifiedNativePlatform", "org.jetbrains.kotlin.platform.konan.NativePlatforms"), level = DeprecationLevel.ERROR ) interface KonanPlatform : TargetPlatform { diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsNativeTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsNativeTest.kt index e4329547f456c..ee98e24b0bcb2 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsNativeTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsNativeTest.kt @@ -93,7 +93,7 @@ private fun createFakeTopDownAnalyzerForNative( ): LazyTopDownAnalyzer = createContainer("FakeTopDownAnalyzerForNative", NativePlatformAnalyzerServices) { configureModule( moduleContext, - NativePlatforms.defaultNativePlatform, + NativePlatforms.unspecifiedNativePlatform, NativePlatformAnalyzerServices, bindingTrace, languageVersionSettings diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/BaseDiagnosticsTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/BaseDiagnosticsTest.kt index ec802d7596566..5deb887deb83a 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/BaseDiagnosticsTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/BaseDiagnosticsTest.kt @@ -511,7 +511,7 @@ abstract class BaseDiagnosticsTest : KotlinMultiFileTestWithJava CommonPlatforms.defaultCommonPlatform nameSuffix == "JVM" -> JvmPlatforms.unspecifiedJvmPlatform // TODO(dsavvinov): determine JvmTarget precisely nameSuffix == "JS" -> JsPlatforms.defaultJsPlatform - nameSuffix == "NATIVE" -> NativePlatforms.defaultNativePlatform + nameSuffix == "NATIVE" -> NativePlatforms.unspecifiedNativePlatform nameSuffix.isEmpty() -> null // TODO(dsavvinov): this leads to 'null'-platform in ModuleDescriptor else -> throw IllegalStateException("Can't determine platform by name $nameSuffix") } diff --git a/compiler/util-klib-metadata/src/org/jetbrains/kotlin/library/metadata/impl/KlibModuleDescriptorFactoryImpl.kt b/compiler/util-klib-metadata/src/org/jetbrains/kotlin/library/metadata/impl/KlibModuleDescriptorFactoryImpl.kt index c097dcff7e320..40d8583f68c45 100644 --- a/compiler/util-klib-metadata/src/org/jetbrains/kotlin/library/metadata/impl/KlibModuleDescriptorFactoryImpl.kt +++ b/compiler/util-klib-metadata/src/org/jetbrains/kotlin/library/metadata/impl/KlibModuleDescriptorFactoryImpl.kt @@ -31,7 +31,8 @@ internal class KlibModuleDescriptorFactoryImpl(val createBuiltIns: (StorageManag KlibModuleOrigin.CAPABILITY to origin, ImplicitIntegerCoercion.MODULE_CAPABILITY to origin.isInteropLibrary() ), - platform = NativePlatforms.defaultNativePlatform + // TODO: detect native platform by ??? + platform = NativePlatforms.unspecifiedNativePlatform ) override fun createDescriptorAndNewBuiltIns( diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/caches/resolve/CompositeResolverForModuleFactory.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/caches/resolve/CompositeResolverForModuleFactory.kt index e66173e50cd40..2b0cdbda6f795 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/caches/resolve/CompositeResolverForModuleFactory.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/caches/resolve/CompositeResolverForModuleFactory.kt @@ -104,7 +104,7 @@ class CompositeResolverForModuleFactory( yieldAll(getCommonProvidersIfAny(moduleInfo, moduleContext, moduleDescriptor, container)) // todo: module context yieldAll(getJsProvidersIfAny(moduleInfo, moduleContext, moduleDescriptor, container)) yieldAll(getJvmProvidersIfAny(container)) - yieldAll(getKonanProvidersIfAny(moduleInfo, container)) + yieldAll(getNativeProvidersIfAny(moduleInfo, container)) }.toList() return ResolverForModule(CompositePackageFragmentProvider(packageFragmentProviders), container) @@ -133,11 +133,11 @@ class CompositeResolverForModuleFactory( private fun getJvmProvidersIfAny(container: StorageComponentContainer): List = if (targetPlatform.has()) listOf(container.get().packageFragmentProvider) else emptyList() - private fun getKonanProvidersIfAny(moduleInfo: ModuleInfo, container: StorageComponentContainer): List { + private fun getNativeProvidersIfAny(moduleInfo: ModuleInfo, container: StorageComponentContainer): List { if (!targetPlatform.has()) return emptyList() return listOfNotNull( - NativePlatforms.defaultNativePlatform.idePlatformKind.resolution.createKlibPackageFragmentProvider( + NativePlatforms.unspecifiedNativePlatform.idePlatformKind.resolution.createKlibPackageFragmentProvider( moduleInfo, container.get(), container.get(), diff --git a/idea/idea-gradle-native/src/org/jetbrains/kotlin/ide/konan/gradle/KotlinNativeGradleConfigurator.kt b/idea/idea-gradle-native/src/org/jetbrains/kotlin/ide/konan/gradle/KotlinNativeGradleConfigurator.kt index cc58c03ea3e06..fb3648ac01ed5 100644 --- a/idea/idea-gradle-native/src/org/jetbrains/kotlin/ide/konan/gradle/KotlinNativeGradleConfigurator.kt +++ b/idea/idea-gradle-native/src/org/jetbrains/kotlin/ide/konan/gradle/KotlinNativeGradleConfigurator.kt @@ -29,7 +29,7 @@ open class KotlinNativeGradleConfigurator : KotlinWithGradleConfigurator() { override val name: String get() = NAME - override val targetPlatform get() = NativePlatforms.defaultNativePlatform + override val targetPlatform get() = NativePlatforms.unspecifiedNativePlatform @Suppress("DEPRECATION_ERROR") override fun getTargetPlatform() = NativePlatforms.CompatNativePlatform diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/HierarchicalMultiplatformProjectImportingTest.kt b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/HierarchicalMultiplatformProjectImportingTest.kt index 1e793e11c0373..3cdc5606ec4de 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/HierarchicalMultiplatformProjectImportingTest.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/HierarchicalMultiplatformProjectImportingTest.kt @@ -60,7 +60,7 @@ class HierarchicalMultiplatformProjectImportingTest : MultiplePluginVersionGradl module("my-app") module("project.my-app.commonMain") { isHMPP(true) - targetPlatform(JsPlatforms.defaultJsPlatform, JvmPlatforms.jvm16, NativePlatforms.defaultNativePlatform) + targetPlatform(JsPlatforms.defaultJsPlatform, JvmPlatforms.jvm16, NativePlatforms.unspecifiedNativePlatform) 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, NativePlatforms.defaultNativePlatform) + targetPlatform(JsPlatforms.defaultJsPlatform, JvmPlatforms.jvm16, NativePlatforms.unspecifiedNativePlatform) 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, NativePlatforms.defaultNativePlatform) + targetPlatform(JsPlatforms.defaultJsPlatform, NativePlatforms.unspecifiedNativePlatform) 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, NativePlatforms.defaultNativePlatform) + targetPlatform(JsPlatforms.defaultJsPlatform, NativePlatforms.unspecifiedNativePlatform) 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(NativePlatforms.defaultNativePlatform) + targetPlatform(NativePlatforms.unspecifiedNativePlatform) 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(NativePlatforms.defaultNativePlatform) + targetPlatform(NativePlatforms.unspecifiedNativePlatform) 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) diff --git a/idea/idea-jps-common/src/org/jetbrains/kotlin/platform/compat/compatConversions.kt b/idea/idea-jps-common/src/org/jetbrains/kotlin/platform/compat/compatConversions.kt index 28ee4c441cd87..2b8d7d2ea8799 100644 --- a/idea/idea-jps-common/src/org/jetbrains/kotlin/platform/compat/compatConversions.kt +++ b/idea/idea-jps-common/src/org/jetbrains/kotlin/platform/compat/compatConversions.kt @@ -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") } diff --git a/idea/idea-jps-common/src/org/jetbrains/kotlin/platform/impl/NativeIdePlatformKind.kt b/idea/idea-jps-common/src/org/jetbrains/kotlin/platform/impl/NativeIdePlatformKind.kt index f5ef2c579aeae..d6ab4adfa5559 100644 --- a/idea/idea-jps-common/src/org/jetbrains/kotlin/platform/impl/NativeIdePlatformKind.kt +++ b/idea/idea-jps-common/src/org/jetbrains/kotlin/platform/impl/NativeIdePlatformKind.kt @@ -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() { - 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() { } 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", diff --git a/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/NativeIdePlatformKindTooling.kt b/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/NativeIdePlatformKindTooling.kt index fd523ee774695..730561289673e 100644 --- a/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/NativeIdePlatformKindTooling.kt +++ b/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/NativeIdePlatformKindTooling.kt @@ -83,7 +83,8 @@ class NativeIdePlatformKindTooling : IdePlatformKindTooling() { object NativeLibraryKind : PersistentLibraryKind("kotlin.native"), KotlinLibraryKind { override val compilerPlatform: TargetPlatform - get() = NativePlatforms.defaultNativePlatform + // TODO: detect native platform by ??? + get() = NativePlatforms.unspecifiedNativePlatform override fun createDefaultProperties() = DummyLibraryProperties.INSTANCE!! } diff --git a/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/NativeLibraryType.kt b/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/NativeLibraryType.kt index 57a4964eb4ae6..2600e7a71c21b 100644 --- a/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/NativeLibraryType.kt +++ b/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/NativeLibraryType.kt @@ -25,7 +25,7 @@ object NativeLibraryType : LibraryType(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): DummyLibraryProperties? = - if (classesRoots.firstOrNull()?.isKlibLibraryRootForPlatform(NativePlatforms.defaultNativePlatform) == true) + if (classesRoots.firstOrNull()?.isKlibLibraryRootForPlatform(NativePlatforms.unspecifiedNativePlatform) == true) DummyLibraryProperties.INSTANCE!! else null diff --git a/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/NativePlatformKindResolution.kt b/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/NativePlatformKindResolution.kt index 63209ddd5a327..7e03240829af9 100644 --- a/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/NativePlatformKindResolution.kt +++ b/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/NativePlatformKindResolution.kt @@ -74,7 +74,7 @@ class NativePlatformKindResolution : IdePlatformKindResolution { } override fun isLibraryFileForPlatform(virtualFile: VirtualFile): Boolean = - virtualFile.isKlibLibraryRootForPlatform(NativePlatforms.defaultNativePlatform) + virtualFile.isKlibLibraryRootForPlatform(NativePlatforms.unspecifiedNativePlatform) override fun createResolverForModuleFactory( settings: PlatformAnalysisParameters, @@ -162,5 +162,6 @@ class NativeKlibLibraryInfo(project: Project, library: Library, libraryRoot: Str } override val platform: TargetPlatform - get() = NativePlatforms.defaultNativePlatform + // TODO: detect native platform by library + get() = NativePlatforms.unspecifiedNativePlatform } diff --git a/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/analyzer/NativeResolverForModuleFactory.kt b/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/analyzer/NativeResolverForModuleFactory.kt index 52a46728a604e..0d7200cceb80f 100644 --- a/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/analyzer/NativeResolverForModuleFactory.kt +++ b/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/analyzer/NativeResolverForModuleFactory.kt @@ -47,7 +47,7 @@ class NativeResolverForModuleFactory( moduleContext, declarationProviderFactory, CodeAnalyzerInitializer.getInstance(moduleContext.project).createTrace(), - NativePlatforms.defaultNativePlatform, + moduleDescriptor.platform!!, NativePlatformAnalyzerServices, targetEnvironment, languageVersionSettings @@ -56,7 +56,7 @@ class NativeResolverForModuleFactory( var packageFragmentProvider = container.get().packageFragmentProvider val klibPackageFragmentProvider = - NativePlatforms.defaultNativePlatform.idePlatformKind.resolution.createKlibPackageFragmentProvider( + NativePlatforms.unspecifiedNativePlatform.idePlatformKind.resolution.createKlibPackageFragmentProvider( moduleContent.moduleInfo, moduleContext.storageManager, languageVersionSettings, diff --git a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/dependeciestxt/ModulesTxt.kt b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/dependeciestxt/ModulesTxt.kt index 7f51474fb7c42..eeedd28f334b1 100644 --- a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/dependeciestxt/ModulesTxt.kt +++ b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/dependeciestxt/ModulesTxt.kt @@ -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)