Generating Xtext from Multiple Model Files

I have a specific grammar that can be parsed normally. Due to the nature of the model, it makes sense to split the model into multiple files. After cross-referencing, it works fine in the IDE and I'm happy there.

My requirement is to generate a single XML document from multiple input model files.

I find that when my generator

import org.eclipse.xtext.generator.AbstractGenerator
...
class MyModelGenerator extends AbstractGenerator

      

called

override void doGenerate(Resource resource, IFileSystemAccess2 fsa, IGeneratorContext context) {

      

So that the resource contains only changed files. Whereas I need all the model files.

I found Xtend - Generation from Multiple Input Models , which seems to be about what I need. But I've found that most of the interfaces have changed since writing it in 2011.

Reading the release notes, version 2.9.0 introduced a new generator.

I have looked at using the approach I referenced and updating it. The generators seem to be different in different places. I am experimenting with how it works, but I am trying to figure out how it should work.

Is there any documentation on how the generation process should work? Or if there is an example to be appreciated.

+3


source to share





All Articles