Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [SOLVED] Enable Java generation with a partial compilation
[SOLVED] Enable Java generation with a partial compilation [message #1763285] Fri, 12 May 2017 11:23 Go to next message
Stéphane Galland is currently offline Stéphane GallandFriend
Messages: 123
Registered: July 2014
Location: Belfort, France
Senior Member
Dear all.

Let two DSL files, f1.dsl and f2.dsl.

The content of f1.dsl is:
class XXX {
    DD
}


The content of f2.dsl is:
class YYY {
    var x : XXX
}


The YYY cannot be generated because the XXX type was not found. This latest type was not found because the Java class is not generated due to the syntax error in f1.dsl.

I would like to enable the generation of YYY class, because its content is a valid code.
In order to do, I'm thinking about a partial generation of the Java file, i.e. I would like to generate the Java file as much as possible.

I know IStubGenerator that I'm using in my batch compiler. But it's only for creating the top types, not the methods. I would like to create this specific compilation process in my Eclipse product.

What is the best way to do that? What are the classes to be used as a starting point for my explorations?
I could assume that I must update my JvmModelInferrer in order to avoid the generation failures. Should I do more?

Thank you by advance.

Cheers.
Stéphane.

[Updated on: Fri, 12 May 2017 12:22]

Report message to a moderator

Re: Enable Java generation with a partial compilation [message #1763287 is a reply to message #1763285] Fri, 12 May 2017 11:28 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14733
Registered: July 2009
Senior Member
for me this sounds like your impl of the inferrer is bad. if you do it right it should work without any chicken and egg problems.

if this an inferrer problem ? or an generation problem?
the inferrer should be called anyway, i dont know how broken your model files are and how well the error recovery can find anything to infer from.

the main problem is that the generator wont run.
you might investigate org.eclipse.xtext.ui.generator.EclipseBasedShouldGenerate





Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: Enable Java generation with a partial compilation [message #1763296 is a reply to message #1763287] Fri, 12 May 2017 12:21 Go to previous message
Stéphane Galland is currently offline Stéphane GallandFriend
Messages: 123
Registered: July 2014
Location: Belfort, France
Senior Member
Dear Christian.

Thank you for your pointer.
I have moved my injection configuration for IShouldGenerate from EclipseBasedShouldGenerate to IShouldGenerate.Always.
This quick fix causes my Eclipse product to react as I want.

Thank you.
Stéphane.

[Updated on: Fri, 12 May 2017 12:23]

Report message to a moderator

Previous Topic:Compare and merge/mark on Regeneration Xtext-Xtend
Next Topic:GeneratedClass is already defined
Goto Forum:
  


Current Time: Wed Nov 13 22:25:28 GMT 2024

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

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

Back to the top