Xtext Generator Chaining [message #1767074] |
Fri, 30 June 2017 07:59  |
Eclipse User |
|
|
|
Dear all,
I have 2 languages where the generator of A transforms into B and the generator of B transforms into XML. When I edit a file of A it generates (and overrides) the corresponding B-file. However, I still have to open and update/save the B-file in order to invoke the generation of XML.
I was wondering if it is possible to trigger the second generator after the first one has finished?
What I tried so far is to inject the B-generator and then invoke it after the generation. This approach works in general. However, debugging revealed an arbitrary number of generator invocations afterwards. Both generators are called at least 3-4 times each time I save a file. .
@Inject BDslGenerator bDslGenerator
override void doGenerate(Resource resource, IFileSystemAccess2 fsa, IGeneratorContext context) {
... // generation code for language A -> B
val uri = ... // URI of generated B-file
val Resource nextResource = resourceSetProvider.get.getResource(uri, true)
bDslGenerator.doGenerate(nextResource, fsa, context)
}
|
|
|
|
|
Re: Xtext Generator Chaining [message #1767079 is a reply to message #1767078] |
Fri, 30 June 2017 08:33  |
Eclipse User |
|
|
|
Hi
Auto-build can be helpful for simple requirements, but as things get more complicated you may want to migrate build to an activity manually triggered by running an MWE2 launch configuration.
I find that MWE2 provides a good orchestration of multiple steps; much better than ANT. By locating support in a dedicated build plugin the build clutter can be removed from other plugins breaking some dependency loops.
Regards
Ed Willink
|
|
|
Powered by
FUDForum. Page generated in 0.02980 seconds