Where to set generator parameters Follow
Hi!
I have declared a couple of parameters in my mapping configuration. I may be blind, but: where can I set them?
Christian
I have declared a couple of parameters in my mapping configuration. I may be blind, but: where can I set them?
Christian
Please sign in to leave a comment.
The default facets workflow looks like that:
Generate -> TextGen -> JavaCompile -> Make (`the end of make marker')
Note: JavaCompile facet is provided by j.m.baseLanguage, it won't be invoked if your code doesn't contain java
Generate step consists of the following targets:
configure (init generator) -> preloadModels -> generate (generates models)
To be able to push parameters you need to insert your target somewhere between configure and generate.
1. Declare parameters in a separate model.
right click on your language -> New -> Model -> call it <name_of_the_language>.parameters
model settings:
Advanced -> Do not generate
Common -> Used languages -> add j.m.lang.generator.generationParameters
create root "generation parameters"
declare parameters with types
2. Use parameters in generator.
a. add parameter reference into mapping configuration, parameters section
b. use them in queries: genContext.<parameter_name>
3. Declare facet.
Create plugin aspect in your language. Import two languages: j.m.make.facet and j.m.lang.generator.generationParameters.
Create root 'Facet'. Add target:
4. Advanced topic: introducing per-module settings
Make allows to declare per-module parameters in a special make.properties file, which should be placed in the same folder as module file.
a. declare property in your facet's target
b. Create make.properties file in the module's folder.
c. Handle custom parameters:
Projects to play with:
For MPS 2.0.1: runJava_201.zip (74KB)
For MPS 2.0: runJava_20.zip (73KB)