MPP: Fix JPS tests
Move back the application check as only the class presence check is not sufficient.
This commit is contained in:
@@ -5,9 +5,24 @@
|
||||
|
||||
package org.jetbrains.kotlin.config
|
||||
|
||||
private const val IDE_EVENT_QUEUE_CLASS_NAME = "com.intellij.ide.IdeEventQueue"
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
|
||||
private const val APPLICATION_MANAGER_CLASS_NAME = "com.intellij.openapi.application.ApplicationManager"
|
||||
|
||||
val isJps: Boolean by lazy {
|
||||
val ideEventQueueClassPath = IDE_EVENT_QUEUE_CLASS_NAME.replace('.', '/') + ".class"
|
||||
{}.javaClass.classLoader.getResource(ideEventQueueClassPath) == null
|
||||
/*
|
||||
Normally, JPS shouldn't have an ApplicationManager class in the classpath,
|
||||
but that's not true for JPS inside IDEA right now.
|
||||
Though Application is not properly initialized inside JPS so we can use it as a check.
|
||||
*/
|
||||
return@lazy if (doesClassExist(APPLICATION_MANAGER_CLASS_NAME)) {
|
||||
ApplicationManager.getApplication() == null
|
||||
} else {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
private fun doesClassExist(fqName: String): Boolean {
|
||||
val classPath = fqName.replace('.', '/') + ".class"
|
||||
return {}.javaClass.classLoader.getResource(classPath) != null
|
||||
}
|
||||
Reference in New Issue
Block a user