Continuous Integration of MPS & ANT

# Continuous Integration of MPS & ANT

#### Problem:

You no longer want to generate your MPS languages ​​and compile your MPS solutions within MPS, but want to control this functionality from outside?

Would you like to create an automated build environment for your application based on the MPS framework or even develop a complete continuous integration environment for your MPS application?

#### Troubleshooting:

In principle, the control of the MPS build environment depends on your technical requirements. For example, the  can be used for a deployment of the Gradle environment.

`import de.itemis.mps.gradle.BuildLanguagesimport de.itemis.mps.gradle.RunAntScriptimport org.gradle.api.DefaultTask`

`buildscript {    dependencies {		classpath(fileTree(mapOf("dir" to "path/de/itemis/mps/mps-gradle-plugin", "include" to listOf("*.jar"))))	}}`

`val task1 = tasks.register<BuildLanguages>("taskName") { ... }val task2 = tasks.register<RunAntScript>("taskName") { ... }`

But even without using such a Wrapper, it is possible to control the MPS build environment without any problems. It is  is required for this.

The XML files generated during the execution of the MPS build scripts are pure Ant-scripts, which can also be easily controlled outside of MPS using the Ant launcher, for example.

```<project name="application-build-script" default="build">
<!-- Generated by MPS -->
<property name="build.dir" location="build" />
<property name="build.tmp" location="\${build.dir}/tmp/application-build-script" />
<property name="build.layout" location="\${build.dir}/artifacts/application-build-script" />...```

To do this, simply call the Ant-Launcher with the correct paths to JetBrains JDK and JetBrains MPS.

`%JAVA_PATH% -Dfile.encoding=windows-1252 -Duser.country=US -Duser.language=en -Duser.variant -cp %ANT_PATH\lib\ant-launcher.jar;%JDK_PATH%\lib\tools.jar org.apache.tools.ant.launch.Launcher -Dmps_home=%MPS_PATH% -Dversion=%MPS_VERSION% -Dmps.generator.skipUnmodifiedModels=true -buildfile %ANT_XML_FILE%`

If the build scripts also contain MPS-Solutions or MPS-Languages, which also must be built, then add the appropriate commands for generating the languages/solutions (e.g. clean, generate and assemble). And of course note the correct order of generation of your Ant-Scripts (XML).

`%JAVA_PATH% -Dfile.encoding=windows-1252 -Duser.country=US -Duser.language=en -Duser.variant -cp %ANT_PATH\lib\ant-launcher.jar;%JDK_PATH%\lib\tools.jar org.apache.tools.ant.launch.Launcher -Dmps_home=%MPS_PATH% -Dversion=%MPS_VERSION% -Dmps.generator.skipUnmodifiedModels=true -buildfile %ANT_XML_FILE% clean generate assemble`
Multiple Cardinality Error