Skip to content

Commit ed5fc50

Browse files
committed
docs(bulk-model-sync-gradle): add docs for bulk sync plugin
1 parent 4cd5141 commit ed5fc50

File tree

4 files changed

+146
-3
lines changed

4 files changed

+146
-3
lines changed
88.3 KB
Loading

docs/global/modules/core/pages/reference/component-model-api-gen-gradle.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,19 +167,19 @@ Inside the `metamodel` block a `names` block can be declared to configure `prefi
167167
|"N_"
168168
|""
169169

170-
|`typedNodeImpl``
170+
|`typedNodeImpl`
171171
|"\_N_TypedImpl_"
172172
|""
173173

174174
|`untypedConcept`
175175
|"\_C_UntypedImpl_"
176176
|""
177177

178-
|`typedConcept``
178+
|`typedConcept`
179179
|"C_"
180180
|""
181181

182-
|`typedConceptImpl``
182+
|`typedConceptImpl`
183183
|"\_C_TypedImpl_"
184184
|""
185185

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
== Gradle Plugin for synchronizing models between model-api endpoints
2+
:navtitle: `model-sync-gradle`
3+
4+
:tip-caption: 🔗 Quick Links
5+
[TIP]
6+
--
7+
https://github.com/modelix/modelix.core[Repository^] | https://github.com/modelix/modelix.core/blob/main/model-sync-gradle/build.gradle.kts[buildfile^]
8+
--
9+
10+
== Overview
11+
12+
The `model-sync` gradle plugin synchronizes models between `model-api` endpoints.
13+
A common example would be synchronizing a local MPS project to a `model-server`.
14+
15+
image::model-sync-gradle.png[]
16+
17+
It allows the definition of sync directions by specifying source and target endpoint.
18+
Based on these directions, Gradle tasks will be generated, which can be run to trigger the corresponding synchronization.
19+
20+
Internally, the node data will be bulk exported from the source endpoint and stored as json files.
21+
After that, those json files serve as a specification to incrementally update the target model through via the target `model-api` endpoint.
22+
This means that only a minimal amount of write operations is used to update the target model.
23+
24+
== Configuration settings
25+
26+
=== modelSync configuration
27+
[%header, cols="1,1,2"]
28+
|===
29+
|method
30+
|parameter type
31+
|description
32+
33+
|`dependsOn`
34+
|Any
35+
|Adds the given task as a dependency of this task.
36+
37+
|`direction`
38+
|String, Action<SyncDirection>
39+
|Defines a new sync direction with the given name.
40+
|===
41+
42+
=== SyncDirection configuration
43+
[%header, cols="1,1,2"]
44+
|===
45+
|method
46+
|parameter type
47+
|description
48+
49+
|`fromLocal`
50+
|Action<LocalSource>
51+
|Defines a local source (MPS).
52+
53+
|`toModelServer`
54+
|Action<ServerTarget>
55+
|Defines a model-server target.
56+
57+
|`fromModelServer`
58+
|Action<ServerSource>
59+
|Defines a model-server source.
60+
61+
|`toLocal`
62+
|Action<LocalTarget>
63+
|Defines a local target (MPS).
64+
65+
|`registerLanguage`
66+
|ILanguage
67+
|Registers the given language and all of its concepts for the synchronisation process.
68+
69+
|`includeModule`
70+
|String
71+
|Includes the module specified by the given fully qualified name in the synchronisation process.
72+
|===
73+
74+
=== LocalSource/-Target configuration
75+
[%header, cols="1,1,2"]
76+
|===
77+
|setting
78+
|type
79+
|description
80+
81+
|`mpsHome`
82+
|File
83+
|Location of the MPS to be used for the sync.
84+
85+
|`mpsHeapSize`
86+
|String
87+
|MPS heap size specified as a String, e.g. "2g" for 2GB (default: "2g")
88+
89+
|`repositoryDir`
90+
|File
91+
|Directory in which the modules are stored.
92+
|===
93+
94+
=== ServerSource/-Target configuration
95+
[%header, cols="1,1,2"]
96+
|===
97+
|setting
98+
|type
99+
|description
100+
101+
|`url`
102+
|String
103+
|URL of the model-server API endpoint.
104+
105+
|`repositoryId`
106+
|String
107+
|Id of the target/source model-server repository.
108+
109+
|`branchName`
110+
|String
111+
|Name of the target/source model-server branch.
112+
113+
|`revision`
114+
|String
115+
|Source model-server revision. Can be used instead of `repositoryId` and `branchName`. Only available in ServerSource.
116+
117+
|===
118+
119+
== Example
120+
121+
[source,kotlin]
122+
--
123+
modelSync {
124+
dependsOn(someOtherTask)
125+
direction("pushToMyServer") {
126+
registerLanguage(L_MyGeneratedLanguage)
127+
includeModule("MySolution")
128+
fromLocal {
129+
mpsHome = buildDir.resolve("mps")
130+
mpsHeapSize = "4g"
131+
repositoryDir = projectDir.resolve("my-repo")
132+
}
133+
toModelServer {
134+
url = "http://0.0.0.0:28101/v2"
135+
repositoryId = "my-repo"
136+
branchName = "dev"
137+
}
138+
}
139+
}
140+
--
141+
142+
Generated gradle task to perform synchronization: `runSyncPushToMyServer`.

docs/global/modules/core/partials/nav-reference.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
* xref:core:reference/component-metamodel-export.adoc[]
44
* xref:core:reference/component-model-api-gen.adoc[]
55
* xref:core:reference/component-model-api-gen-gradle.adoc[]
6+
* xref:core:reference/component-model-sync-gradle.adoc[]
67
* xref:core:reference/component-light-model-client.adoc[]
78
* xref:core:reference/component-mps-model-server-plugin.adoc[]

0 commit comments

Comments
 (0)