Do not use ApplicationExtensionDescriptor in JPS (KT-26542)
The 'ExtensionPointName' class that ApplicationExtensionDescriptor uses is missing in the JPS classpath. Now we don't use it unless the IDEA Application is properly initialized.
This commit is contained in:
@@ -27,19 +27,18 @@ abstract class IdePlatformKind<Kind : IdePlatformKind<Kind>> {
|
|||||||
override fun equals(other: Any?): Boolean = javaClass == other?.javaClass
|
override fun equals(other: Any?): Boolean = javaClass == other?.javaClass
|
||||||
override fun hashCode(): Int = javaClass.hashCode()
|
override fun hashCode(): Int = javaClass.hashCode()
|
||||||
|
|
||||||
companion object : ApplicationExtensionDescriptor<IdePlatformKind<*>>(
|
companion object {
|
||||||
"org.jetbrains.kotlin.idePlatformKind", IdePlatformKind::class.java
|
// We can't use the ApplicationExtensionDescriptor class directly because it's missing in the JPS process
|
||||||
) {
|
private val extension = ApplicationManager.getApplication()?.let {
|
||||||
|
ApplicationExtensionDescriptor("org.jetbrains.kotlin.idePlatformKind", IdePlatformKind::class.java)
|
||||||
|
}
|
||||||
|
|
||||||
// For using only in JPS
|
// For using only in JPS
|
||||||
private val JPS_KINDS = listOf(JvmIdePlatformKind, JsIdePlatformKind, CommonIdePlatformKind)
|
private val JPS_KINDS get() = listOf(JvmIdePlatformKind, JsIdePlatformKind, CommonIdePlatformKind)
|
||||||
|
|
||||||
val ALL_KINDS by lazy {
|
val ALL_KINDS by lazy {
|
||||||
if (ApplicationManager.getApplication() == null) {
|
val kinds = extension?.getInstances() ?: return@lazy JPS_KINDS
|
||||||
return@lazy JPS_KINDS
|
require(kinds.isNotEmpty()) { "Platform kind list is empty" }
|
||||||
}
|
|
||||||
|
|
||||||
val kinds = getInstances()
|
|
||||||
require(kinds.isNotEmpty()) { "Platform list is empty" }
|
|
||||||
kinds
|
kinds
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -70,7 +70,7 @@ class FrameworkLibraryValidatorWithDynamicDescription(
|
|||||||
val targetPlatform = getPlatform()
|
val targetPlatform = getPlatform()
|
||||||
|
|
||||||
if (checkLibraryIsConfigured(targetPlatform)) {
|
if (checkLibraryIsConfigured(targetPlatform)) {
|
||||||
val conflictingPlatforms = IdePlatformKind.getInstances()
|
val conflictingPlatforms = IdePlatformKind.ALL_KINDS
|
||||||
.filter { !it.isCommon && it.name != targetPlatform.name && checkLibraryIsConfigured(it) }
|
.filter { !it.isCommon && it.name != targetPlatform.name && checkLibraryIsConfigured(it) }
|
||||||
|
|
||||||
if (conflictingPlatforms.isNotEmpty()) {
|
if (conflictingPlatforms.isNotEmpty()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user