Skip to content

Commit

Permalink
test: fix classpath of MPS plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
slisson committed Jan 29, 2025
1 parent d514889 commit 3947aaa
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
13 changes: 13 additions & 0 deletions build-logic/src/main/kotlin/org/modelix/CopyMps.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package org.modelix

import org.gradle.api.Project
import org.gradle.api.artifacts.ModuleDependency
import org.gradle.api.file.Directory
import org.gradle.api.provider.Provider
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.exclude
import java.io.File
import java.util.zip.ZipInputStream

Expand Down Expand Up @@ -101,3 +103,14 @@ fun Project.copyMps(): File {
println("Extracting MPS done.")
return mpsHome
}

val excludeMPSLibraries: (ModuleDependency).() -> Unit = {
exclude("org.jetbrains.kotlinx", "kotlinx-coroutines-core")
exclude("org.jetbrains.kotlinx", "kotlinx-coroutines-jdk8")
exclude("org.jetbrains.kotlinx", "kotlinx-coroutines-swing")
exclude("org.jetbrains.kotlin", "kotlin-stdlib")
exclude("org.jetbrains.kotlin", "kotlin-stdlib-common")
exclude("org.jetbrains.kotlin", "kotlin-stdlib-jdk7")
exclude("org.jetbrains.kotlin", "kotlin-stdlib-jdk8")
exclude("org.jetbrains", "annotations")
}
9 changes: 5 additions & 4 deletions bulk-model-sync-lib/mps-test/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import org.modelix.copyMps
import org.modelix.excludeMPSLibraries
import org.modelix.mpsMajorVersion

plugins {
Expand All @@ -14,10 +15,10 @@ plugins {
}

dependencies {
testImplementation(project(":bulk-model-sync-lib"))
testImplementation(project(":bulk-model-sync-mps"))
testImplementation(project(":mps-model-adapters"))
testImplementation(project(":model-datastructure"))
testImplementation(project(":bulk-model-sync-lib"), excludeMPSLibraries)
testImplementation(project(":bulk-model-sync-mps"), excludeMPSLibraries)
testImplementation(project(":mps-model-adapters"), excludeMPSLibraries)
testImplementation(project(":model-datastructure"), excludeMPSLibraries)
testImplementation(libs.kotlin.serialization.json)
testImplementation(libs.xmlunit.matchers)
testImplementation(libs.jimfs)
Expand Down
9 changes: 2 additions & 7 deletions mps-model-adapters-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import org.modelix.copyMps
import org.modelix.excludeMPSLibraries
import org.modelix.mpsMajorVersion

plugins {
Expand All @@ -8,13 +9,7 @@ plugins {
}

dependencies {
testImplementation(project(":mps-model-adapters")) {
// MPS provides the Kotlin standard library and coroutines.
// Bundling different versions of the same library can cause the plugin to break.
exclude(group = "org.jetbrains.kotlin")
exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-coroutines-core")
exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-coroutines-jdk8")
}
testImplementation(project(":mps-model-adapters"), excludeMPSLibraries)
testImplementation(kotlin("test"))
}

Expand Down

0 comments on commit 3947aaa

Please sign in to comment.