Always remove configure notifications without additional checks in tests (KT-23399)
For some reason there were ~1000 tests that were spontaneously
falling (~20%) because they couldn't find some class. It was mostly
Java classes.
Those failures started after cff88a3f8b.
There were group of commits about notifications right before it:
b4fb0e0305b77a0caa83d34edac3253b7d8e082b..1be33b91fa85e50f5048dc5a12604debfa3c19e8
#KT-23399 Fixed
This commit is contained in:
+20
-11
@@ -70,19 +70,28 @@ fun checkHideNonConfiguredNotifications(project: Project) {
|
|||||||
DumbService.getInstance(project).waitForSmartMode()
|
DumbService.getInstance(project).waitForSmartMode()
|
||||||
val moduleSourceRootMap = ModuleSourceRootMap(project)
|
val moduleSourceRootMap = ModuleSourceRootMap(project)
|
||||||
|
|
||||||
val hideNotification = try {
|
if (notification.notificationState.debugProjectName != project.name) {
|
||||||
val moduleSourceRootGroups = notification.notificationState.notConfiguredModules
|
LOG.error("Bad notification check for project: ${project.name}\n${notification.notificationState}")
|
||||||
.mapNotNull { ModuleManager.getInstance(project).findModuleByName(it) }
|
|
||||||
.map { moduleSourceRootMap.getWholeModuleGroup(it) }
|
|
||||||
moduleSourceRootGroups.none(::isNotConfiguredNotificationRequired)
|
|
||||||
} catch (e: IndexNotReadyException) {
|
|
||||||
checkInProgress.set(false)
|
|
||||||
ApplicationManager.getApplication().invokeLater {
|
|
||||||
checkHideNonConfiguredNotifications(project)
|
|
||||||
}
|
|
||||||
return@executeOnPooledThread
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val hideNotification =
|
||||||
|
if (!ApplicationManager.getApplication().isUnitTestMode) {
|
||||||
|
try {
|
||||||
|
val moduleSourceRootGroups = notification.notificationState.notConfiguredModules
|
||||||
|
.mapNotNull { ModuleManager.getInstance(project).findModuleByName(it) }
|
||||||
|
.map { moduleSourceRootMap.getWholeModuleGroup(it) }
|
||||||
|
moduleSourceRootGroups.none(::isNotConfiguredNotificationRequired)
|
||||||
|
} catch (e: IndexNotReadyException) {
|
||||||
|
checkInProgress.set(false)
|
||||||
|
ApplicationManager.getApplication().invokeLater {
|
||||||
|
checkHideNonConfiguredNotifications(project)
|
||||||
|
}
|
||||||
|
return@executeOnPooledThread
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
if (hideNotification) {
|
if (hideNotification) {
|
||||||
ApplicationManager.getApplication().invokeLater {
|
ApplicationManager.getApplication().invokeLater {
|
||||||
ConfigureKotlinNotificationManager.expireOldNotifications(project)
|
ConfigureKotlinNotificationManager.expireOldNotifications(project)
|
||||||
|
|||||||
+2
@@ -48,6 +48,8 @@ class KotlinConfigurationCheckerComponent(project: Project) : AbstractProjectCom
|
|||||||
val connection = project.messageBus.connect()
|
val connection = project.messageBus.connect()
|
||||||
connection.subscribe(ProjectTopics.PROJECT_ROOTS, object : ModuleRootListener {
|
connection.subscribe(ProjectTopics.PROJECT_ROOTS, object : ModuleRootListener {
|
||||||
override fun rootsChanged(event: ModuleRootEvent?) {
|
override fun rootsChanged(event: ModuleRootEvent?) {
|
||||||
|
if (!project.isInitialized) return
|
||||||
|
|
||||||
if (notificationPostponed && !isSyncing) {
|
if (notificationPostponed && !isSyncing) {
|
||||||
ApplicationManager.getApplication().executeOnPooledThread {
|
ApplicationManager.getApplication().executeOnPooledThread {
|
||||||
DumbService.getInstance(myProject).waitForSmartMode()
|
DumbService.getInstance(myProject).waitForSmartMode()
|
||||||
|
|||||||
+2
@@ -17,6 +17,7 @@ import org.jetbrains.kotlin.idea.configuration.ui.KotlinConfigurationCheckerComp
|
|||||||
import javax.swing.event.HyperlinkEvent
|
import javax.swing.event.HyperlinkEvent
|
||||||
|
|
||||||
data class ConfigureKotlinNotificationState(
|
data class ConfigureKotlinNotificationState(
|
||||||
|
val debugProjectName: String,
|
||||||
val notificationString: String,
|
val notificationString: String,
|
||||||
val notConfiguredModules: Collection<String>
|
val notConfiguredModules: Collection<String>
|
||||||
)
|
)
|
||||||
@@ -64,6 +65,7 @@ class ConfigureKotlinNotification(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return ConfigureKotlinNotificationState(
|
return ConfigureKotlinNotificationState(
|
||||||
|
project.name,
|
||||||
"Configure $modulesString in '${project.name}' project<br/> $links",
|
"Configure $modulesString in '${project.name}' project<br/> $links",
|
||||||
configurableModules.map { it.baseModule.name }
|
configurableModules.map { it.baseModule.name }
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user