Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Infinite loop while generating Java sources
icon9.gif  Infinite loop while generating Java sources [message #1099782] Mon, 02 September 2013 07:43 Go to next message
Michel de Blok is currently offline Michel de BlokFriend
Messages: 8
Registered: August 2013
Junior Member
Hi all,

I am using both the JvmModelGenerator and my own custom generator to generate Java sources in my XText project. The first generates Java from an inferred Jvm model, the second simply uses XTend to generate Java directly from my grammar model.

Reason that I use this approach is that for some sources that are 80% the same all the time it's very tedious to write JvmModel infer methods, especially if they contain annotations. Using the second generator there really simplifies the task.

The problem that occurs now is that the XText builder sometimes runs in an infinite loop. It seems that the sources that I generate with the simple XTend generator are detected as delta's by the incremental XText builder, which causes the builder to run over and over again..

Digging into the incremental builder implementation of XText 2.4.2 I found that the problem lies in the DeltaConverter.isDerived() method: if a Java type in an output folder is not in the index (IResourceDescriptions) then it's considered to be a delta, i.e. a change that triggers the incremental builder.

What's the solution here? Do I need to add the sources that are not generated by the JvmModelGenerator to the index myself? And if so, how do I do this?

Or is there a way to use another DeltaConverter, or delta detection mechanism? I could not find a way to configure this in the RuntimeModules..

Last resort is to rewrite my simple XTend generator to a JvmModel approach, but that would make the generators a lot more complex.

Re: Infinite loop while generating Java sources [message #1100263 is a reply to message #1099782] Mon, 02 September 2013 23:06 Go to previous messageGo to next message
Ian McDevitt is currently offline Ian McDevittFriend
Messages: 70
Registered: December 2012
Location: Belfast
Member
Maybe a series of more output folders would help? The files you generate should go to a separate folder as output. If they are then to form input to another build then add that as a source folder - right click the folder and add Use As Source Folder. You can set its output folder to another folder and so on.
Also set the build order from the Configure Build Path dialog.
Re: Infinite loop while generating Java sources [message #1101342 is a reply to message #1100263] Wed, 04 September 2013 10:30 Go to previous message
Michel de Blok is currently offline Michel de BlokFriend
Messages: 8
Registered: August 2013
Junior Member
I'm already using 7 output folders Wink
(manual|generated|test for both java & resources + generated webapp)

It works if you generate to an output folder that's not in the Eclipse project classpath.
But as soon as you add it to the classpath, because the sources you generate are required by other components, then the same problem occurs.

Changing the build order or classpath order doesn't solve this either..

I'm thinking of rewriting the second generator to a JvmModel inferrering construction and prohibit the generation of Java in any other way Sad

Previous Topic:Encoding related error in Xtend 2.4
Next Topic: No EObjectDescription could be found in Scope
Goto Forum:
  


Current Time: Thu Mar 28 20:18:38 GMT 2024

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

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

Back to the top