Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Cascading Xtext Generators
Cascading Xtext Generators [message #1849879] Mon, 07 February 2022 09:19 Go to next message
Ulrich Großmann is currently offline Ulrich GroßmannFriend
Messages: 2
Registered: February 2022
Junior Member
Hi,

I have two independent Xtext DSLs A and B. The generator of A generates files for B. B generates java files.

A -> B -> java

Is it possible that Eclipse automatically calls the generator of DSL B after DSL A generated a file or a bunch of files? If yes, how is this achieved?

In my current Configuration DSL A generates the files but the Generator of B is not called. If i touch the generated .b files manually it works. I use Xtext version 2.23.0.

Best regards,
Uli
Re: Cascading Xtext Generators [message #1849888 is a reply to message #1849879] Mon, 07 February 2022 15:19 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
no, you would need second programmatic toucher / custom touching builder. builders dont see files they generate themselves.

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Cascading Xtext Generators [message #1849889 is a reply to message #1849879] Mon, 07 February 2022 15:19 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 762
Registered: July 2009
Location: Dortmund, Germany
Senior Member

It is a bit tricky. I did this once back in a project. The basic problem is that one execution that generates files can't automatically see that relevant files have been produced that require a second run.

What you need to do is basically what you are doing manually: After one execution refresh the produced files.

If I remember correctly, we kept track of produced files and then started a job after finishing the first run that refreshed the produced workspace resources. Note that you need to decouple the runs.

Sorry, can't share code, only the idea.
Re: Cascading Xtext Generators [message #1849908 is a reply to message #1849879] Tue, 08 February 2022 11:29 Go to previous messageGo to next message
Ulrich Großmann is currently offline Ulrich GroßmannFriend
Messages: 2
Registered: February 2022
Junior Member
Thanks guys, that did the trick!

I implemented a custom BuilderParticipant and added it to my UiModule. At the end of doBuild all generated files are touched.

For touching i use the touch method of com.google.common.io.Files. Is this a good idea? Is there a better way of touching files inside Eclipse?

I tried org.eclipse.core.resources.IFile.touch but nothing happened.

Thanks,
Uli
Re: Cascading Xtext Generators [message #1849919 is a reply to message #1849908] Tue, 08 February 2022 13:52 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 762
Registered: July 2009
Location: Dortmund, Germany
Senior Member

You need to use IResource#refreshLocal. Using "external" manipulation is not good.
Re: Cascading Xtext Generators [message #1849920 is a reply to message #1849919] Tue, 08 February 2022 14:12 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
i meant something like https://www.eclipse.org/forums/index.php?t=msg&th=1106603&goto=1838677&#msg_1838677

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Adapting the generated java code from xtend
Next Topic:Whitespace issue with nested blocks
Goto Forum:
  


Current Time: Thu Apr 25 11:19:28 GMT 2024

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

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

Back to the top