Gradle Plugin for synchronizing models between model-api endpoints
API doc | Repository | Artifacts: Nexus GitHub Packages |
Overview
The bulk-model-sync
Gradle plugin synchronizes models between model-api
endpoints.
A common example would be synchronizing a local MPS project to a model-server
.
The plugin allows the definition of sync directions inside of a modelSync
block by specifying source and target endpoint.
Based on these directions, Gradle tasks will be generated, which can be run to trigger the corresponding synchronization.
Internally, the node data will be bulk exported from the source endpoint and stored as JSON files.
After that, these JSON files serve as a specification to incrementally update the target model via the target model-api
endpoint.
This means that only a minimal amount of write operations is used to update the target model.
Configuration settings
modelSync configuration
method | parameter type | description |
---|---|---|
|
Any |
Adds the given task as a dependency of this task. |
|
String, Action<SyncDirection> |
Defines a new sync direction with the given name. |
SyncDirection configuration
method | parameter type | description |
---|---|---|
|
Action<LocalSource> |
Defines a local source (MPS). |
|
Action<ServerTarget> |
Defines a model-server target. |
|
Action<ServerSource> |
Defines a model-server source. |
|
Action<LocalTarget> |
Defines a local target (MPS). |
|
ILanguage |
Registers the given language and all of its concepts for the synchronisation process. |
|
String |
Includes the module specified by the given fully qualified name in the synchronisation process. |
|
String |
Includes all modules, whose fully qualified name starts with the given prefix, in the synchronisation process. |
LocalSource/-Target configuration
setting | type | description |
---|---|---|
|
File |
Location of the MPS to be used for the sync. |
|
String |
MPS heap size specified as a String, e.g. "2g" for 2GB (default: "2g") |
|
File |
Directory in which the modules are stored. |
|
Int |
If set, the headless MPS will suspend on startup and wait for a remote debugger on the specified port. |
ServerSource/-Target configuration
setting | type | description |
---|---|---|
|
String |
URL of the model-server API endpoint. |
|
String |
Id of the target/source model-server repository. |
|
String |
Name of the target/source model-server branch. |
|
String |
Source model-server revision. Can be used instead of |
Example
modelSync {
dependsOn(someOtherTask)
direction("pushToMyServer") {
registerLanguage(L_MyGeneratedLanguage)
includeModule("MySolution")
fromLocal {
mpsHome = project.layout.buildDirectory.dir("mps").get().asFile
mpsHeapSize = "4g"
repositoryDir = projectDir.resolve("my-repo")
}
toModelServer {
url = "http://0.0.0.0:28101/v2"
repositoryId = "my-repo"
branchName = "dev"
}
}
}
Generated Gradle task to perform synchronization: runSyncPushToMyServer
.