Multiple Generator calls on Xtext language [message #1841475] |
Tue, 18 May 2021 07:35  |
Eclipse User |
|
|
|
We are having a project where we are using Xtext to generate a grammar and create from this language a java output file. Next to that we want to create also a kind of json output file. which has another extension. For this we want to split the generators to not mix the java generation and the json generation. Is there anyway we can call 2 Igenerators when compiling dsl grammar?
Example: We have 1 language common which generates java file for this we have one IGenerator2 which calls like standard CommonGenerator. Now we want to create second generator for json file with CommonLineageGenerator.
I have read several threads now were i found the following
component = org.eclipse.xtext.generator.GeneratorComponent {
register = CommonStandaloneSetup{}
outlet = {
path = "${runtimeProject}/src-gen"
}
}
component = org.eclipse.xtext.generator.GeneratorComponent {
register = CommonStandaloneSetup2{}
outlet = {
path = "${runtimeProject}/src-gen"
}
}
Where the StandaloneSetup contains an override of the Igenerator2 bindings
return Guice.createInjector(new CommonRuntimeModule())
return Guice.createInjector(new CommonRuntimeModule() {
override Class<? extends IGenerator2> bindIGenerator2() {
return CommonTracingGenerator;
}
});
We are also using mwe2 , to generate our language configuration.
When executing our compilation it now seems although that he is only taking one Generator. Is there anyway we can accomplish this. A wrapper is also possibility but we really want to avoid of mixing the two types of generations.
kr
|
|
|
|
Powered by
FUDForum. Page generated in 0.03921 seconds