Skip to content

Commit

Permalink
fix: binary incompatibility in ModelServerConnection
Browse files Browse the repository at this point in the history
  • Loading branch information
slisson committed Feb 1, 2024
1 parent 14b63dc commit 16fbfc6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
5 changes: 4 additions & 1 deletion mps-legacy-sync-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ tasks {
val checkBinaryCompatibility by registering {
group = "verification"
doLast {
val ignoredFiles = setOf("META-INF/MANIFEST.MF")
val ignoredFiles = setOf(
"META-INF/MANIFEST.MF",
"org/modelix/model/mpsplugin/AllowedBinaryIncompatibilityKt.class"
)
fun loadEntries(fileName: String) = rootProject.layout.buildDirectory
.dir("binary-compatibility")
.dir(project.name)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.modelix.model.mpsplugin

import com.intellij.openapi.project.ProjectManager
import com.intellij.openapi.project.ProjectManagerListener
import com.intellij.util.messages.MessageBus
import com.intellij.util.messages.MessageBusConnection
import com.intellij.util.messages.Topic

/**
* This file contains all API calls that lead to a difference in the compiled bytecode.
* This class file is ignored during the binary compatibility check.
* This file should contain as little code as possible.
*/

internal fun MessageBus.connectToMessageBus(): MessageBusConnection = connect()
internal fun getProjectManagerTopic(): Topic<ProjectManagerListener> = ProjectManager.TOPIC
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ class ModelServerConnection @JvmOverloads constructor(baseUrl: String, providedH
if (LOG.isDebugEnabled) {
LOG.debug("ModelServerConnection.init(" + baseUrl + ")")
}
messageBusConnection = ApplicationManager.getApplication().messageBus.connect()
messageBusConnection = ApplicationManager.getApplication().messageBus.connectToMessageBus()
messageBusConnection.subscribe(
ProjectManager.TOPIC,
getProjectManagerTopic(),
object : ProjectManagerListener {
override fun projectClosing(closingProject: Project) {
for (closingProjectBinding: ProjectBinding? in Sequence.fromIterable(MapSequence.fromMap(bindings).values)
Expand Down

0 comments on commit 16fbfc6

Please sign in to comment.