Make possible to have no libraryDescription for 'Configure Kotlin'
This commit is contained in:
+7
-5
@@ -38,7 +38,7 @@ class FrameworkLibraryValidatorWithDynamicDescription(
|
||||
private val libraryCategoryName: String,
|
||||
private val getPlatform: () -> IdePlatform<*, *>
|
||||
) : FrameworkLibraryValidator() {
|
||||
private val IdePlatformKind<*>.libraryDescription: CustomLibraryDescription
|
||||
private val IdePlatformKind<*>.libraryDescription: CustomLibraryDescription?
|
||||
get() = this.tooling.getLibraryDescription(context.module.project)
|
||||
|
||||
private fun checkLibraryIsConfigured(platform: IdePlatformKind<*>): Boolean {
|
||||
@@ -49,7 +49,7 @@ class FrameworkLibraryValidatorWithDynamicDescription(
|
||||
it.getLibraryVersions(context.module, platform, context.rootModel).isNotEmpty()
|
||||
}) return true
|
||||
|
||||
val libraryDescription = platform.libraryDescription
|
||||
val libraryDescription = platform.libraryDescription ?: return true
|
||||
val libraryKinds = libraryDescription.suitableLibraryKinds
|
||||
var found = false
|
||||
val presentationManager = LibraryPresentationManager.getInstance()
|
||||
@@ -72,7 +72,10 @@ class FrameworkLibraryValidatorWithDynamicDescription(
|
||||
|
||||
if (checkLibraryIsConfigured(targetPlatform.kind)) {
|
||||
val conflictingPlatforms = IdePlatformKind.ALL_KINDS
|
||||
.filter { !it.isCommon && it.name != targetPlatform.kind.name && checkLibraryIsConfigured(it) }
|
||||
.filter {
|
||||
!it.isCommon && it.name != targetPlatform.kind.name
|
||||
&& it.libraryDescription != null && checkLibraryIsConfigured(it)
|
||||
}
|
||||
|
||||
if (conflictingPlatforms.isNotEmpty()) {
|
||||
val platformText = conflictingPlatforms.mapTo(LinkedHashSet()) { it.name }.joinToString()
|
||||
@@ -82,10 +85,9 @@ class FrameworkLibraryValidatorWithDynamicDescription(
|
||||
return ValidationResult.OK
|
||||
}
|
||||
|
||||
|
||||
return ValidationResult(
|
||||
IdeBundle.message("label.missed.libraries.text", libraryCategoryName),
|
||||
LibrariesQuickFix(targetPlatform.kind.libraryDescription)
|
||||
LibrariesQuickFix(targetPlatform.kind.libraryDescription!!)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ abstract class IdePlatformKindTooling {
|
||||
abstract val gradlePlatformIds: List<KotlinPlatform>
|
||||
|
||||
abstract val libraryKind: PersistentLibraryKind<*>?
|
||||
abstract fun getLibraryDescription(project: Project): CustomLibraryDescription
|
||||
abstract fun getLibraryDescription(project: Project): CustomLibraryDescription?
|
||||
abstract fun getLibraryVersionProvider(project: Project): (Library) -> String?
|
||||
|
||||
abstract fun getTestIcon(declaration: KtNamedDeclaration, descriptor: DeclarationDescriptor): Icon?
|
||||
|
||||
Reference in New Issue
Block a user