You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+26-20
Original file line number
Diff line number
Diff line change
@@ -279,10 +279,11 @@ dependencies {
279
279
```
280
280
281
281
Parameters:
282
-
*`mpsConfig` - the configuration used to resolve MPS. Currently only vanilla MPS is supported and no custom RCPs.
283
-
Custom plugins are supported via the `pluginLocation` parameter.
284
-
*`mpsLocation` - optional location where to place the MPS files.
285
-
*`mpsVersion` - optional if you use a [custom distribution](#Custom MPS Distribution) of MPS
282
+
*`mpsConfig` - the configuration used to resolve MPS. Custom plugins are supported via the `pluginLocation` parameter.
283
+
*`mpsLocation` - optional location where to place the MPS files if `mpsConfig` is specified, or where to take them from
284
+
otherwise.
285
+
*`mpsVersion` - optionally overrides automated version detection from `mpsConfig`. Required if you use
286
+
a [custom distribution](#Custom MPS Distribution) of MPS.
286
287
*`javaExec` - optional `java` executable to use.
287
288
*`pluginLocation` - location where to load the plugins from. Structure needs to be a flat folder structure similar to the
288
289
`plugins` directory inside of the MPS installation.
@@ -348,10 +349,11 @@ modelcheck {
348
349
```
349
350
350
351
Parameters:
351
-
*`mpsConfig` - the configuration used to resolve MPS. Currently only vanilla MPS is supported and no custom RCPs.
352
-
Custom plugins are supported via the `pluginLocation` parameter.
353
-
*`mpsLocation` - optional location where to place the MPS files.
354
-
*`mpsVersion` - optional if you use a [custom distribution](#Custom MPS Distribution) of MPS
352
+
*`mpsConfig` - the configuration used to resolve MPS. Custom plugins are supported via the `pluginLocation` parameter.
353
+
*`mpsLocation` - optional location where to place the MPS files if `mpsConfig` is specified, or where to take them from
354
+
otherwise.
355
+
*`mpsVersion` - optionally overrides automated version detection from `mpsConfig`. Required if you use
356
+
a [custom distribution](#Custom MPS Distribution) of MPS.
355
357
*`javaExec` - optional `java` executable to use.
356
358
*`pluginLocation` - location where to load the plugins from. Structure needs to be a flat folder structure similar to the
357
359
`plugins` directory inside of the MPS installation.
@@ -607,9 +609,11 @@ runMigrations {
607
609
```
608
610
609
611
Parameters:
610
-
*`mpsConfig` - configuration used to resolve MPS.
611
-
*`mpsLocation` - location where to place the MPS files.
612
-
*`mpsVersion` - if you use a [custom distribution](#custom-mps-distribution) of MPS.
612
+
*`mpsConfig` - the configuration used to resolve MPS.
613
+
*`mpsLocation` - optional location where to place the MPS files if `mpsConfig` is specified, or where to take them from
614
+
otherwise.
615
+
*`mpsVersion` - optionally overrides automated version detection from `mpsConfig`. Required if you use
616
+
a [custom distribution](#Custom MPS Distribution) of MPS.
613
617
*`projectLocation` - location of the project that should be migrated.
614
618
*`force` - ignores the marker files for projects which allow pending migrations, migrate them anyway. Supported in 2021.3.0 and higher.
615
619
*`haltOnPrecheckFailure` - controls whether migration is aborted if pre-checks fail (except the check for migrated dependecies) Default: `true`. Supported in 2021.1 and higher.
@@ -681,17 +685,19 @@ downloadJbr {
681
685
## Custom MPS Distribution
682
686
683
687
Features that perform an action inside an MPS project, like the `modelcheck` or `generate-models` plugin, require
684
-
an MPS available to them. While for vanilla MPS it is enough to pass in a reference to the MPS dependency via the
685
-
`mpsConfig` property this doesn't work for custom distributions of MPS. A custom distribution of MPS is also called
686
-
a MPS RCP. If you like to use your own MPS distribution with preinstalled plugins and your own versioning scheme
687
-
then this is possible but requires additional steps in the build script.
688
+
an MPS available to them. While for vanilla MPS it is enough to pass in a reference to the MPS dependency via the
689
+
`mpsConfig` property, this doesn't work for custom distributions of MPS. A custom distribution of MPS is also called
690
+
an MPS RCP. If you like to use your own MPS distribution with preinstalled plugins and your own versioning scheme
691
+
then this is possible but requires additional steps in the build script.
688
692
689
-
When you are using a custom distribution of MPS you can no longer use the `mpsConfig` property and rely on
690
-
the plugin resolving it. The plugin needs to be configured with the properties `mpsVersion` and `mpsLocation`
691
-
being set and no value set for `mpsConfig`. If you set `mpsVersion` but also set `mpsConfig` then `mpsConfig`
692
-
will take precedence over `mpsVersion` and the plugin will resolve that configuration into `mpsLocation`.
693
+
When you are using a custom distribution of MPS you can still use the `mpsConfig` property and rely on
694
+
the plugin resolving it. However, you may need to configure explicit `mpsVersion` for the plugin. You can also use a
695
+
custom `mpsLocation` with no value set for `mpsConfig`. In this case you _must_ configure `mpsVersion` as well.
693
696
694
-
`mpsVersion` needs to be set to the exact MPS version your custom distribution is based on e.g. if you build a
697
+
If you set `mpsVersion` but also set `mpsConfig` then `mpsVersion` will take precedence over the version of the
698
+
dependency in the configuration. The plugin will resolve the specified configuration into `mpsLocation`.
699
+
700
+
`mpsVersion` needs to be set to the exact MPS version your custom distribution is based on. For example, if you build an
695
701
RCP with MPS 2020.3.3 you need to set this property to `2020.3.3`. `mpsLocation` needs to point to the location
696
702
where you extracted your custom MPS distribution into e.g. `$buildDir/myAwesomeMPS` if you extracted into that location.
constvalMUST_SET_CONFIG_OR_VERSION="Either mpsConfig or mpsVersion needs to specified!"
7
-
constvalMUST_SET_VERSION_AND_LOCATION="Setting an MPS version but no MPS location is not supported!"
8
7
constvalMPS_VERSION_NOT_SUPPORTED="This version of mps-gradle-plugin only supports MPS 2020.1 and above. Please use version 1.4 with an older version of MPS."
9
8
10
-
funnoMpsProjectIn(dir:File): String="Directory does not contain an MPS project: $dir"
9
+
internalfunnoMpsProjectIn(dir:File): String="Directory does not contain an MPS project: $dir"
Copy file name to clipboardexpand all lines: src/main/kotlin/de/itemis/mps/gradle/runmigrations/Plugin.kt
+9-4
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
packagede.itemis.mps.gradle.runmigrations
2
2
3
3
importde.itemis.mps.gradle.BasePluginExtensions
4
+
importde.itemis.mps.gradle.ErrorMessages
4
5
importde.itemis.mps.gradle.getMPSVersion
5
6
importde.itemis.mps.gradle.runAnt
6
7
importgroovy.xml.MarkupBuilder
@@ -43,17 +44,18 @@ open class RunMigrationsMpsProjectPlugin : Plugin<Project> {
43
44
44
45
overridefunapply(project:Project) {
45
46
project.run {
46
-
val extension = extensions.create("runMigrations", MigrationExecutorPluginExtensions::class.java)
47
+
val extensionName ="runMigrations"
48
+
val extension = extensions.create(extensionName, MigrationExecutorPluginExtensions::class.java)
49
+
47
50
tasks.register("runMigrations")
48
51
49
52
afterEvaluate {
50
-
val mpsLocation = extension.mpsLocation ?:File(project.buildDir, "mps")
51
53
val projectLocation = extension.projectLocation ?:throwGradleException("No project path set")
52
54
if (!file(projectLocation).exists()) {
53
55
throwGradleException("The path to the project doesn't exist: $projectLocation")
54
56
}
55
57
56
-
val mpsVersion = extension.getMPSVersion()
58
+
val mpsVersion = extension.getMPSVersion(extensionName)
57
59
val parsedMPSVersion =SemVer.parse(mpsVersion)
58
60
59
61
if (extension.force !=null&& parsedMPSVersion <MIN_VERSION_FOR_FORCE) {
@@ -68,13 +70,16 @@ open class RunMigrationsMpsProjectPlugin : Plugin<Project> {
68
70
throwGradleException("The 'do not halt on dependency error' option is only supported for MPS version $MIN_VERSION_FOR_HALT_ON_DEPENDENCY_ERROR and higher.")
69
71
}
70
72
73
+
val mpsLocation = extension.mpsLocation ?:File(project.buildDir, "mps")
71
74
val resolveMps:Task=if (extension.mpsConfig !=null) {
0 commit comments