I use Xtext plugin for eclipse to define my language and generate some files from it. The project is big and I would like to use multiple generators to generate my files, in addition to default generator, generated by the plugin.
I tried this solution http://www.eclipse.org/forums/index.php/t/263021/, but it don't work, looks like it related to old version of Xtext.
For example I have by default
class com.company.mylang.generator.MylangGenerator implements IGenerator {...}
I need to add other one
class com.company.mylang.generator.MylangGenerator2 implements IGenerator {...}
that runs as part of eclipse build.
A composite generator could work. Your MylangGenerator could be implemented as a composite and delegate to the other generators, probably depending on some configuration or state in the resource.
class MylangCompositeGenerator implements IGenerator {
@Inject MylangGenerator gen
@Inject MylangGenerator2 gen2
def doGenerate(Resource input, IFileSystemAccess fsa) {
gen.doGenerator(input, fsa)
gen2.doGenerator(input, fsa)
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With