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 Itemis MPS Gradle Plugins can be used for a deployment of the Gradle environment.
Download the required library from GIT and import the required header files into your Gradle environment:
import de.itemis.mps.gradle.BuildLanguages
import de.itemis.mps.gradle.RunAntScript
import org.gradle.api.DefaultTask
Add a corresponding dependency to your build.gradle.kts:
buildscript {
dependencies {
classpath(fileTree(mapOf("dir" to "path/de/itemis/mps/mps-gradle-plugin", "include" to listOf("*.jar"))))
}
}
Finally, run the required BuildLanguages or RunAntScript-tasks of MPS Gradle Wrapper:
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 Apache Ant 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