Post KotlinNativeABICompatibilityChecker startup activity conversion clean up
Relates to #KT-38318
This commit is contained in:
+7
-3
@@ -48,10 +48,10 @@ class KotlinNativeABICompatibilityChecker : StartupActivity {
|
|||||||
object User : LibraryGroup(2)
|
object User : LibraryGroup(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val cachedIncompatibleLibraries = HashSet<String>()
|
private val cachedIncompatibleLibrariesPerProject = mutableMapOf<Project, MutableSet<String>>()
|
||||||
|
|
||||||
override fun runActivity(project: Project) {
|
override fun runActivity(project: Project) {
|
||||||
project.messageBus.connect().subscribe(ProjectTopics.PROJECT_ROOTS, object : ModuleRootListener {
|
project.messageBus.connect(project).subscribe(ProjectTopics.PROJECT_ROOTS, object : ModuleRootListener {
|
||||||
override fun rootsChanged(event: ModuleRootEvent) {
|
override fun rootsChanged(event: ModuleRootEvent) {
|
||||||
// run when project roots are changes, e.g. on project import
|
// run when project roots are changes, e.g. on project import
|
||||||
validateKotlinNativeLibraries(project)
|
validateKotlinNativeLibraries(project)
|
||||||
@@ -66,7 +66,10 @@ class KotlinNativeABICompatibilityChecker : StartupActivity {
|
|||||||
return
|
return
|
||||||
|
|
||||||
val backgroundJob: Ref<CancellablePromise<*>> = Ref()
|
val backgroundJob: Ref<CancellablePromise<*>> = Ref()
|
||||||
val disposable = Disposable { backgroundJob.get()?.let(CancellablePromise<*>::cancel) }
|
val disposable = Disposable {
|
||||||
|
cachedIncompatibleLibrariesPerProject.remove(project)
|
||||||
|
backgroundJob.get()?.let(CancellablePromise<*>::cancel)
|
||||||
|
}
|
||||||
Disposer.register(project, disposable)
|
Disposer.register(project, disposable)
|
||||||
|
|
||||||
backgroundJob.set(
|
backgroundJob.set(
|
||||||
@@ -95,6 +98,7 @@ class KotlinNativeABICompatibilityChecker : StartupActivity {
|
|||||||
.filter { !it.compatibilityInfo.isCompatible }
|
.filter { !it.compatibilityInfo.isCompatible }
|
||||||
.associateBy { it.libraryRoot }
|
.associateBy { it.libraryRoot }
|
||||||
|
|
||||||
|
val cachedIncompatibleLibraries = cachedIncompatibleLibrariesPerProject.computeIfAbsent(project) { mutableSetOf() }
|
||||||
val newEntries = if (cachedIncompatibleLibraries.isNotEmpty())
|
val newEntries = if (cachedIncompatibleLibraries.isNotEmpty())
|
||||||
incompatibleLibraries.filterKeys { it !in cachedIncompatibleLibraries }
|
incompatibleLibraries.filterKeys { it !in cachedIncompatibleLibraries }
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user