Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext Generator Chaining
Xtext Generator Chaining [message #1767074] Fri, 30 June 2017 11:59 Go to next message
Desmond Hume is currently offline Desmond HumeFriend
Messages: 9
Registered: October 2016
Junior Member
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 #1767075 is a reply to message #1767074] Fri, 30 June 2017 12:01 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14497
Registered: July 2009
Senior Member
This is not possible since eclipse does not notify a builder of changes it did itself

Thus you need to create another builder that runs after the xtext builder and touches the files the xtext builder created


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext Generator Chaining [message #1767078 is a reply to message #1767075] Fri, 30 June 2017 12:25 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14497
Registered: July 2009
Senior Member
https://www.eclipse.org/forums/index.php/m/1753519/?srch=incrementalprojectbuilder+touch#msg_1753519

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext Generator Chaining [message #1767079 is a reply to message #1767078] Fri, 30 June 2017 12:33 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7597
Registered: July 2009
Senior Member
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
Previous Topic:Generalization of Numbers
Next Topic:Unicode beyond U+FFFF accepted in DSL - how to?
Goto Forum:
  


Current Time: Thu Jun 08 21:45:51 GMT 2023

Powered by FUDForum. Page generated in 0.02355 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top