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 libraryCategoryName: String,
|
||||||
private val getPlatform: () -> IdePlatform<*, *>
|
private val getPlatform: () -> IdePlatform<*, *>
|
||||||
) : FrameworkLibraryValidator() {
|
) : FrameworkLibraryValidator() {
|
||||||
private val IdePlatformKind<*>.libraryDescription: CustomLibraryDescription
|
private val IdePlatformKind<*>.libraryDescription: CustomLibraryDescription?
|
||||||
get() = this.tooling.getLibraryDescription(context.module.project)
|
get() = this.tooling.getLibraryDescription(context.module.project)
|
||||||
|
|
||||||
private fun checkLibraryIsConfigured(platform: IdePlatformKind<*>): Boolean {
|
private fun checkLibraryIsConfigured(platform: IdePlatformKind<*>): Boolean {
|
||||||
@@ -49,7 +49,7 @@ class FrameworkLibraryValidatorWithDynamicDescription(
|
|||||||
it.getLibraryVersions(context.module, platform, context.rootModel).isNotEmpty()
|
it.getLibraryVersions(context.module, platform, context.rootModel).isNotEmpty()
|
||||||
}) return true
|
}) return true
|
||||||
|
|
||||||
val libraryDescription = platform.libraryDescription
|
val libraryDescription = platform.libraryDescription ?: return true
|
||||||
val libraryKinds = libraryDescription.suitableLibraryKinds
|
val libraryKinds = libraryDescription.suitableLibraryKinds
|
||||||
var found = false
|
var found = false
|
||||||
val presentationManager = LibraryPresentationManager.getInstance()
|
val presentationManager = LibraryPresentationManager.getInstance()
|
||||||
@@ -72,7 +72,10 @@ class FrameworkLibraryValidatorWithDynamicDescription(
|
|||||||
|
|
||||||
if (checkLibraryIsConfigured(targetPlatform.kind)) {
|
if (checkLibraryIsConfigured(targetPlatform.kind)) {
|
||||||
val conflictingPlatforms = IdePlatformKind.ALL_KINDS
|
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()) {
|
if (conflictingPlatforms.isNotEmpty()) {
|
||||||
val platformText = conflictingPlatforms.mapTo(LinkedHashSet()) { it.name }.joinToString()
|
val platformText = conflictingPlatforms.mapTo(LinkedHashSet()) { it.name }.joinToString()
|
||||||
@@ -82,10 +85,9 @@ class FrameworkLibraryValidatorWithDynamicDescription(
|
|||||||
return ValidationResult.OK
|
return ValidationResult.OK
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return ValidationResult(
|
return ValidationResult(
|
||||||
IdeBundle.message("label.missed.libraries.text", libraryCategoryName),
|
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 gradlePlatformIds: List<KotlinPlatform>
|
||||||
|
|
||||||
abstract val libraryKind: PersistentLibraryKind<*>?
|
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 getLibraryVersionProvider(project: Project): (Library) -> String?
|
||||||
|
|
||||||
abstract fun getTestIcon(declaration: KtNamedDeclaration, descriptor: DeclarationDescriptor): Icon?
|
abstract fun getTestIcon(declaration: KtNamedDeclaration, descriptor: DeclarationDescriptor): Icon?
|
||||||
|
|||||||
Reference in New Issue
Block a user