Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Xtext Generator Chaining
Xtext Generator Chaining [message #1767074] Fri, 30 June 2017 07:59 Go to next message
Eclipse UserFriend
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 08:01 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Xtext Generator Chaining [message #1767078 is a reply to message #1767075] Fri, 30 June 2017 08:25 Go to previous messageGo to next message
Eclipse UserFriend
https://www.eclipse.org/forums/index.php/m/1753519/?srch=incrementalprojectbuilder+touch#msg_1753519
Re: Xtext Generator Chaining [message #1767079 is a reply to message #1767078] Fri, 30 June 2017 08:33 Go to previous message
Eclipse UserFriend
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: Sun May 11 05:30:38 EDT 2025

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

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

Back to the top