Skip to content

Commit 6e4d3ec

Browse files
committed
feat(bulk-model-sync-gradle): quality of life improvements
New option to include multiple modules by prefix and progress indicator for the export from MPS.
1 parent d65ffb6 commit 6e4d3ec

File tree

4 files changed

+338
-89
lines changed

4 files changed

+338
-89
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ class ModelSyncGradlePlugin : Plugin<Project> {
134134
it.jsonDirPath.set(jsonDir.absolutePath)
135135
it.exportFlag.set(true)
136136
it.includedModules.set(syncDirection.includedModules)
137+
it.includedModulePrefixes.set(syncDirection.includedModulePrefixes)
137138
}
138139

139140
val exportFromMps = project.tasks.register("${syncDirection.name}ExportFromMps", ExportFromMps::class.java) {
@@ -198,7 +199,8 @@ class ModelSyncGradlePlugin : Plugin<Project> {
198199
it.mpsDependenciesPath.set(getDependenciesDir(project).absolutePath)
199200
it.jsonDirPath.set(jsonDir.absolutePath)
200201
it.exportFlag.set(false)
201-
it.includedModules.set(emptyList())
202+
it.includedModules.set(syncDirection.includedModules)
203+
it.includedModulePrefixes.set(syncDirection.includedModulePrefixes)
202204
}
203205

204206
val importName = "${syncDirection.name}ImportIntoMps"

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ data class SyncDirection(
4141
internal var target: SyncEndpoint? = null,
4242
internal val includedModules: Set<String> = mutableSetOf(),
4343
internal val registeredLanguages: Set<ILanguage> = mutableSetOf(),
44+
internal val includedModulePrefixes: Set<String> = mutableSetOf(),
4445
) {
4546
fun fromModelServer(action: Action<ServerSource>) {
4647
val endpoint = ServerSource()
@@ -70,6 +71,10 @@ data class SyncDirection(
7071
(includedModules as MutableSet).add(module)
7172
}
7273

74+
fun includeModulesByPrefix(prefix: String) {
75+
(includedModulePrefixes as MutableSet).add(prefix)
76+
}
77+
7378
fun registerLanguage(language: ILanguage) {
7479
(registeredLanguages as MutableSet).add(language)
7580
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ abstract class GenerateAntScriptForMps @Inject constructor(of: ObjectFactory) :
5656
@Input
5757
val includedModules: ListProperty<String> = of.listProperty(String::class.java)
5858

59+
@Input
60+
val includedModulePrefixes: ListProperty<String> = of.listProperty(String::class.java)
61+
5962
@TaskAction
6063
fun generate() {
6164
val isExport = exportFlag.get()
@@ -99,6 +102,7 @@ abstract class GenerateAntScriptForMps @Inject constructor(of: ObjectFactory) :
99102
<jvmargs>
100103
<arg value="-Dmodelix.mps.model.sync.bulk.${if (isExport) "output" else "input"}.path=${jsonDirPath.get()}" />
101104
<arg value="-Dmodelix.mps.model.sync.bulk.${if (isExport) "output" else "input"}.modules=${includedModules.get().joinToString(",")}" />
105+
<arg value="-Dmodelix.mps.model.sync.bulk.${if (isExport) "output" else "input"}.modules.prefixes=${includedModulePrefixes.get().joinToString(",")}" />
102106
<arg value="-Dmodelix.mps.model.sync.bulk.repo.path=${repositoryPath.get()}" />
103107
<arg value="-Didea.config.path=${"$"}{build.mps.config.path}" />
104108
<arg value="-Didea.system.path=${"$"}{build.mps.system.path}" />

0 commit comments

Comments
 (0)