Skip to content

Commit 6d2639e

Browse files
author
Oleksandr Dzhychko
committed
fix(bulk-model-sync-gradle): fix MPS Runner configuration for server sources with base revision
When a base revision was specified, the specified branch was not passed as a system property to the bulk sync. When a base revision was specified without a source revision, the property value for the source revision was the string `"null"`. To write test with TestKit we would need further adjustments to the build setup. For this fix, I considered them out of scope. I tried to test execution with Gradles TestKit first. See https://docs.gradle.org/current/userguide/test_kit.html But the Plugin tries to download the package "org.modelix:bulk-model-sync-mps" as `mpsDependencies`. The names of the downloaded files are then used as `classPathElements` in the MPS Runner configuration. Therefore, the plugin cannot be tested with TestKit without publishing "org.modelix:bulk-model-sync-mps" and its dependents locally or including the "modelix.core" project from within a test execution.
1 parent 2ed6010 commit 6d2639e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

bulk-model-sync-gradle/src/main/kotlin/org/modelix/model/sync/bulk/gradle/MpsRunnerConfiguration.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,13 @@ internal fun buildMpsRunConfigurationForLocalTarget(
8181
if (source is ServerSource && source.baseRevision != null) {
8282
add("-Dmodelix.mps.model.sync.bulk.server.repository=${source.repositoryId}")
8383
add("-Dmodelix.mps.model.sync.bulk.server.url=${source.url}")
84-
add("-Dmodelix.mps.model.sync.bulk.server.version.hash=${source.revision}")
8584
add("-Dmodelix.mps.model.sync.bulk.server.version.base.hash=${source.baseRevision}")
85+
if (source.branchName != null) {
86+
add("-Dmodelix.mps.model.sync.bulk.server.branch=${source.branchName}")
87+
}
88+
if (source.revision != null) {
89+
add("-Dmodelix.mps.model.sync.bulk.server.version.hash=${source.revision}")
90+
}
8691
}
8792
},
8893
)

bulk-model-sync-gradle/src/test/kotlin/org/modelix/model/sync/bulk/gradle/MpsRunnerConfigurationTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class MpsRunnerConfigurationTest {
5959
"-Dmodelix.mps.model.sync.bulk.input.continueOnError=false",
6060
"-Xmx2g",
6161
"-Dmodelix.mps.model.sync.bulk.server.repository=aRepositoryId",
62-
"-Dmodelix.mps.model.sync.bulk.server.version.hash=null",
62+
"-Dmodelix.mps.model.sync.bulk.server.branch=aBranchName",
6363
"-Dmodelix.mps.model.sync.bulk.server.url=aUrl",
6464
"-Dmodelix.mps.model.sync.bulk.server.version.base.hash=aBaseRevision",
6565
)

0 commit comments

Comments
 (0)