Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [Xtext 2.1] Implementing a custom post build step
[Xtext 2.1] Implementing a custom post build step [message #758773] Thu, 24 November 2011 14:09 Go to next message
Cedric Moonen is currently offline Cedric MoonenFriend
Messages: 274
Registered: August 2009
Senior Member
In my build process, I need to have a many to one code generation: several Xtext resources will lead to the generation of one single file (in fact, this file will contain a list of IDs).
I don't want to implement this many to one generation in my IGenerator implementation since it will be invoked multiple times if several resources are saved at the same time. Furthermore, in a headless build, it will be invoked for each resource which is not really efficient.

I was thinking of creating my own IXtextBuilderParticipant but there's quite some code already in the existing BuilderParticipant which I don't want to duplicate in my own builder. Furthermore, I can't really extend BuilderParticipant since all the member variables were declared private.

What would be the appropriate way to implement something like that ?
Re: [Xtext 2.1] Implementing a custom post build step [message #758947 is a reply to message #758773] Fri, 25 November 2011 11:28 Go to previous messageGo to next message
Klaus Birken is currently offline Klaus BirkenFriend
Messages: 4
Registered: November 2011
Junior Member
There is a blogpost by Karsten Thoms on generating from multiple input models:

However, I just tried to implement an IGenerator which has to generate some textual file from the Resource and do some postprocessing afterwards, i.e., calling some external tool on the generated textfile and create a binary file in the same directory. Starting e.g. in xtend we have

class MyGenerator implements IGenerator {
   override void doGenerate (Resource resource, IFileSystemAccess fsa) {
      // fsa doesn't provide access to the target directory.. how do we find the target directory?
      // ...

How can this be done? The doGenerate() function is called by the framework, how can I hook in there?


Re: [Xtext 2.1] Implementing a custom post build step [message #758957 is a reply to message #758947] Fri, 25 November 2011 11:48 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13769
Registered: July 2009
Senior Member

you could try to downcast IFileSystemAccess to a impl like EclipseResourceFileSystemAccess2 or JavaIoFileSystemAccess
and search the information there (getFile/getFolder) or bind a complete own IFileSystemAccess
that allows you to retrieve that information.

there are already some bugs arround this to make the information more "accessable"


Need professional support for Xtext, Xpand, EMF?
Go to:
Twitter : @chrdietrich
Blog :
Previous Topic:testing with ValidationTestHelper
Next Topic:use glpk jar in org.xtext.example.mydsl.ui.popup.actions
Goto Forum:

Current Time: Fri Mar 05 20:32:56 GMT 2021

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

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

Back to the top