New way of building with the Model Compiler

October 18, 2017

The classic Model RealTime build system was initially designed to build the model from the Eclipse IDE and is closely dependent on the CDT. It has a few weak points which makes it hard to integrate Model RealTime into the auto-build systems of real production projects. One major drawback is the necessity to have an Model RealTime running instance to perform batch builds. Another example is lack of possibility to improve rules for transforming models to C++ code, and close binding to CDT components which has a negative influence on build performance.

To address these problems, we designed a completely new build tool which is called the Model Compiler. It is a stand-alone utility for code generation built as a plain Java program – modelcompiler.jar. It is independent of the Eclipse IDE and CDT, meaning that it can be run outside of Model RealTime. It can generate make files which completely drives the build in every stage (code generation, compilation and linking). It produces the same code as the classic builder, but its architecture provides much more flexibility to extend the code generation rules.

The ModelCompiler tool comes with the Model RealTime installation and can be run with the following command

java <JVM options> -jar modelcompiler.jar <options> <files

Here is the list of main options to successfully run the Model Compiler:

*--root=<path>* - root folder relative to which references in model and TC files will be resolved

*--out=<path>*  - the location where all generated files will be placed

*--build*       - executes complete build cycle (source, make files generation, compilation…)

*--help*        - detailed documentation about all available options

Advanced options allow to:

--genModelRules=<arg>        generate rules on how to transform model files into source files

--genSource="<elements>“   generate code for a specific set of model elements

Here is an example how the Model Compiler can be invoked to build HelloWorld.tc

java -jar modelcompiler.jar --root=C:\myworkspace --out C:\outputdir --build C:\workspace\project\HelloWorld.tc

The Model Compiler prints detailed output with information from the ongoing build:

You can learn more about the Model Compiler here. Have you already tried to integrate it and want to share your feedback? Mail your findings to model-realtime@hcl-software.com.