HMPP: Parameterize NativePlatform with KonanTarget

This commit is contained in:
Dmitriy Dolovov
2020-03-31 12:00:59 +07:00
parent 1b281d623b
commit 8d2e999776
17 changed files with 72 additions and 38 deletions
@@ -83,7 +83,8 @@ class NativeIdePlatformKindTooling : IdePlatformKindTooling() {
object NativeLibraryKind : PersistentLibraryKind<DummyLibraryProperties>("kotlin.native"), KotlinLibraryKind {
override val compilerPlatform: TargetPlatform
get() = NativePlatforms.defaultNativePlatform
// TODO: detect native platform by ???
get() = NativePlatforms.unspecifiedNativePlatform
override fun createDefaultProperties() = DummyLibraryProperties.INSTANCE!!
}
@@ -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(NativePlatforms.defaultNativePlatform) == true)
if (classesRoots.firstOrNull()?.isKlibLibraryRootForPlatform(NativePlatforms.unspecifiedNativePlatform) == true)
DummyLibraryProperties.INSTANCE!!
else null
@@ -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
}
@@ -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<ResolveSession>().packageFragmentProvider
val klibPackageFragmentProvider =
NativePlatforms.defaultNativePlatform.idePlatformKind.resolution.createKlibPackageFragmentProvider(
NativePlatforms.unspecifiedNativePlatform.idePlatformKind.resolution.createKlibPackageFragmentProvider(
moduleContent.moduleInfo,
moduleContext.storageManager,
languageVersionSettings,