Skip to main content



      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 07:23 Go to next message
Eclipse UserFriend
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 08:22] by Moderator

Re: Enable Java generation with a partial compilation [message #1763287 is a reply to message #1763285] Fri, 12 May 2017 07:28 Go to previous messageGo to next message
Eclipse UserFriend
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



Re: Enable Java generation with a partial compilation [message #1763296 is a reply to message #1763287] Fri, 12 May 2017 08:21 Go to previous message
Eclipse UserFriend
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 08:23] by Moderator

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


Current Time: Thu Jul 17 04:44:00 EDT 2025

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

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

Back to the top