KotlinNativeModuleConfigurator: fix INRE
#EA-219416 Fixed
This commit is contained in:
+6
-13
@@ -11,16 +11,13 @@ import com.intellij.psi.search.GlobalSearchScope
|
||||
import org.jetbrains.kotlin.ide.konan.index.KotlinNativeMetaFileIndex
|
||||
import org.jetbrains.kotlin.idea.configuration.LibraryKindSearchScope
|
||||
import org.jetbrains.kotlin.idea.configuration.hasKotlinFilesOnlyInTests
|
||||
import org.jetbrains.kotlin.idea.util.application.runReadAction
|
||||
import org.jetbrains.kotlin.idea.util.runWithAlternativeResolveEnabled
|
||||
import org.jetbrains.kotlin.idea.util.runReadActionInSmartMode
|
||||
import org.jetbrains.kotlin.idea.vfilefinder.hasSomethingInPackage
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
|
||||
fun hasKotlinNativeRuntimeInScope(module: Module): Boolean {
|
||||
return runReadAction {
|
||||
val scope = module.getModuleWithDependenciesAndLibrariesScope(hasKotlinFilesOnlyInTests(module))
|
||||
hasKotlinNativeMetadataFile(module.project, LibraryKindSearchScope(module, scope, NativeLibraryKind))
|
||||
}
|
||||
fun hasKotlinNativeRuntimeInScope(module: Module): Boolean = module.project.runReadActionInSmartMode {
|
||||
val scope = module.getModuleWithDependenciesAndLibrariesScope(hasKotlinFilesOnlyInTests(module))
|
||||
hasKotlinNativeMetadataFile(module.project, LibraryKindSearchScope(module, scope, NativeLibraryKind))
|
||||
}
|
||||
|
||||
private val KOTLIN_NATIVE_FQ_NAMES = listOf(
|
||||
@@ -28,10 +25,6 @@ private val KOTLIN_NATIVE_FQ_NAMES = listOf(
|
||||
"konan.native" // Keep "konan.native" for backward compatibility with older versions of Kotlin/Native.
|
||||
).map { FqName(it) }
|
||||
|
||||
fun hasKotlinNativeMetadataFile(project: Project, scope: GlobalSearchScope): Boolean {
|
||||
return runReadAction {
|
||||
project.runWithAlternativeResolveEnabled {
|
||||
KOTLIN_NATIVE_FQ_NAMES.any { KotlinNativeMetaFileIndex.hasSomethingInPackage(it, scope) }
|
||||
}
|
||||
}
|
||||
fun hasKotlinNativeMetadataFile(project: Project, scope: GlobalSearchScope): Boolean = project.runReadActionInSmartMode {
|
||||
KOTLIN_NATIVE_FQ_NAMES.any { KotlinNativeMetaFileIndex.hasSomethingInPackage(it, scope) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user