Remove JPS KotlinNativeConfigurator
This commit is contained in:
@@ -7,55 +7,14 @@ package org.jetbrains.kotlin.ide.konan
|
||||
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.projectRoots.Sdk
|
||||
import com.intellij.openapi.roots.OrderRootType
|
||||
import com.intellij.openapi.roots.libraries.DummyLibraryProperties
|
||||
import com.intellij.openapi.roots.libraries.Library
|
||||
import com.intellij.openapi.roots.libraries.LibraryType
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import org.jetbrains.kotlin.ide.konan.index.KotlinNativeMetaFileIndex
|
||||
import org.jetbrains.kotlin.idea.configuration.KotlinWithLibraryConfigurator
|
||||
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.versions.LibraryJarDescriptor
|
||||
import org.jetbrains.kotlin.idea.vfilefinder.hasSomethingInPackage
|
||||
import org.jetbrains.kotlin.konan.library.KONAN_STDLIB_NAME
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.resolve.konan.platform.KonanPlatform
|
||||
|
||||
open class KotlinNativeModuleConfigurator : KotlinWithLibraryConfigurator() {
|
||||
|
||||
override val name: String get() = NAME
|
||||
|
||||
override val targetPlatform get() = KonanPlatform
|
||||
|
||||
override val presentableText get() = PRESENTABLE_TEXT
|
||||
|
||||
override fun isConfigured(module: Module) = hasKotlinNativeRuntimeInScope(module)
|
||||
|
||||
override val libraryName get() = NativeStandardLibraryDescription.LIBRARY_NAME
|
||||
|
||||
override val dialogTitle get() = NativeStandardLibraryDescription.DIALOG_TITLE
|
||||
|
||||
override val libraryCaption get() = NativeStandardLibraryDescription.LIBRARY_CAPTION
|
||||
|
||||
override val messageForOverrideDialog get() = NativeStandardLibraryDescription.NATIVE_LIBRARY_CREATION
|
||||
|
||||
override fun getLibraryJarDescriptors(sdk: Sdk?) = emptyList<LibraryJarDescriptor>()
|
||||
|
||||
override val libraryMatcher: (Library, Project) -> Boolean = { library, _ ->
|
||||
library.getFiles(OrderRootType.CLASSES).any { it.nameWithoutExtension == KONAN_STDLIB_NAME }
|
||||
}
|
||||
|
||||
override val libraryType: LibraryType<DummyLibraryProperties>? get() = null
|
||||
|
||||
companion object {
|
||||
const val NAME = "KotlinNative"
|
||||
const val PRESENTABLE_TEXT = "Native"
|
||||
}
|
||||
}
|
||||
|
||||
fun hasKotlinNativeRuntimeInScope(module: Module): Boolean {
|
||||
return runReadAction {
|
||||
|
||||
+2
-22
@@ -9,6 +9,7 @@ import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.roots.libraries.DummyLibraryProperties
|
||||
import com.intellij.openapi.roots.libraries.Library
|
||||
import com.intellij.openapi.roots.libraries.PersistentLibraryKind
|
||||
import com.intellij.openapi.roots.ui.configuration.libraries.CustomLibraryDescription
|
||||
import org.jetbrains.kotlin.ide.konan.analyzer.NativeAnalyzerFacade
|
||||
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
@@ -35,7 +36,7 @@ class NativeIdePlatformKindTooling : IdePlatformKindTooling() {
|
||||
override val gradlePlatformIds: List<KotlinPlatform> get() = listOf(KotlinPlatform.NATIVE)
|
||||
|
||||
override val libraryKind: PersistentLibraryKind<*> = NativeLibraryKind
|
||||
override fun getLibraryDescription(project: Project) = NativeStandardLibraryDescription(project)
|
||||
override fun getLibraryDescription(project: Project): CustomLibraryDescription? = null
|
||||
override fun getLibraryVersionProvider(project: Project): (Library) -> String? = { null }
|
||||
|
||||
override fun getTestIcon(declaration: KtNamedDeclaration, descriptor: DeclarationDescriptor): Icon? = null
|
||||
@@ -49,24 +50,3 @@ object NativeLibraryKind : PersistentLibraryKind<DummyLibraryProperties>("kotlin
|
||||
|
||||
override fun createDefaultProperties() = DummyLibraryProperties.INSTANCE!!
|
||||
}
|
||||
|
||||
class NativeStandardLibraryDescription(project: Project?) :
|
||||
CustomLibraryDescriptorWithDeferredConfig(
|
||||
project,
|
||||
KotlinNativeModuleConfigurator.NAME,
|
||||
LIBRARY_NAME,
|
||||
DIALOG_TITLE,
|
||||
LIBRARY_CAPTION,
|
||||
NativeLibraryKind,
|
||||
SUITABLE_LIBRARY_KINDS
|
||||
) {
|
||||
|
||||
companion object {
|
||||
val LIBRARY_NAME = "KotlinNative"
|
||||
|
||||
val NATIVE_LIBRARY_CREATION = "Native Library Creation"
|
||||
val DIALOG_TITLE = "Create Kotlin Native Library"
|
||||
val LIBRARY_CAPTION = "Kotlin Native Library"
|
||||
val SUITABLE_LIBRARY_KINDS = setOf(NativeLibraryKind)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user