4

I have a grammar defined which can be parsed ok. Due to the nature of the model it makes sense to split the model across multiple files. Following cross references in the IDE is working fine and I am all happy there.

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

What I find is that when my generator

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

is called

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

That the resource only contains the files that modified. Whereas, what I need is all of the model files.

I have found Xtend – Generating from multiple input models which seems to address what I need. But what I have found is that most of the interfaces have changed since it's writing 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 different in places. I am experimenting with ways that might work, but I am trying to understand the way it was intended to work.

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

Petec
  • 271
  • 1
  • 6
  • the intention is to work on only one file. you will get even passed the changed files only, not all files. can you give more context aboot your usecase? there might be better strategies to achive your goal than "generate from multiple resources via changing igenerator(2)) – Christian Dietrich May 11 '17 at 06:16
  • I think one file at a time is a limitation on an otherwise impressive tool. my use case is to generate several xml configurations for code generators. I cannot change away from these tools because of the safety critical nature of what they generator. The model I have describes and defines an application (in terms of modules) and the data types it uses. It makes sense in terms of the domain and also the intended process the that files are split. – Petec May 12 '17 at 02:13
  • 1
    I have the same problem. I have many different models that are independent but for one file I need all models at once. You can imagine the file as a overview of all models. At the moment I can't generate that file because I only get the chaged models. – magoeke May 18 '17 at 13:27

0 Answers0