Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to launch the XTend compilation after having generating Xtend code?
How to launch the XTend compilation after having generating Xtend code? [message #1402832] Thu, 17 July 2014 17:22 Go to next message
ARno B is currently offline ARno BFriend
Messages: 9
Registered: July 2014
Junior Member
Hi,
I have a DSL, powered by Xtext, that generates Xtend code.
When I edit a model of my DSL the Xtend code is correctly generated in a dedicated folder (different than xtend-gen) but not compiled.
To compile the generated xtend code, I need to open the xtend files, add a space, and save (refresh, clean, and co do not work).

How can I (programmatically) trigger the Xtend compilation after the generation of my code?


Cheers,
ARno
Re: How to launch the XTend compilation after having generating Xtend code? [message #1402849 is a reply to message #1402832] Thu, 17 July 2014 20:14 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

what about call the builder (clean build) for the project?
(retrieve the IProject and call build on it?)

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to launch the XTend compilation after having generating Xtend code? [message #1402850 is a reply to message #1402849] Thu, 17 July 2014 20:18 Go to previous messageGo to next message
ARno B is currently offline ARno BFriend
Messages: 9
Registered: July 2014
Junior Member
I just tried that and it does not work (nothing happens, no error in the error console):

project.build(IncrementalProjectBuilder::FULL_BUILD, null)

My DSL is here:
github.com/arnobl/kompren/tree/master/kompren-editor/fr.inria.diverse.kompren.xtext
Re: How to launch the XTend compilation after having generating Xtend code? [message #1402851 is a reply to message #1402850] Thu, 17 July 2014 20:20 Go to previous messageGo to next message
ARno B is currently offline ARno BFriend
Messages: 9
Registered: July 2014
Junior Member
Same result for: project.build(IncrementalProjectBuilder::CLEAN_BUILD, null)
Re: How to launch the XTend compilation after having generating Xtend code? [message #1402853 is a reply to message #1402851] Thu, 17 July 2014 20:30 Go to previous messageGo to next message
ARno B is currently offline ARno BFriend
Messages: 9
Registered: July 2014
Junior Member
project.touch(null) or disabling the auto-build of the project to manually build have no effect. :s
Re: How to launch the XTend compilation after having generating Xtend code? [message #1402857 is a reply to message #1402850] Thu, 17 July 2014 20:47 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
make sure

- you called refresh on the project first
- the project has xtext nature and xtext builder added


--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to launch the XTend compilation after having generating Xtend code? [message #1402860 is a reply to message #1402857] Thu, 17 July 2014 21:10 Go to previous messageGo to next message
ARno B is currently offline ARno BFriend
Messages: 9
Registered: July 2014
Junior Member
The project has the xtext nature and text builder since the xtend files are compiled if a modified them manually.

I tried brutal things:
ResourcesPlugin.getWorkspace().getRoot().projects.forEach[proj|
proj.refreshLocal(IResource.DEPTH_INFINITE, null)
proj.touch(null)
proj.build(IncrementalProjectBuilder::CLEAN_BUILD, null)
]
...
myXtendFile.touch(null)
myXtendFile2.touch(null)

but the xtend files are still not compiled when editing my DSL model.

Is there something to add in the mwe2 or something to bind to chain the xtend/xtext builder to my dsl?

[Updated on: Thu, 17 July 2014 21:11]

Report message to a moderator

Re: How to launch the XTend compilation after having generating Xtend code? [message #1402873 is a reply to message #1402860] Fri, 18 July 2014 05:07 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Last question: are the files within a source folder.

Can you give a step by step description on how to reproduce?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to launch the XTend compilation after having generating Xtend code? [message #1402878 is a reply to message #1402873] Fri, 18 July 2014 07:16 Go to previous messageGo to next message
ARno B is currently offline ARno BFriend
Messages: 9
Registered: July 2014
Junior Member
Yes, the files are within a source folder.

To reproduce the problem:
1. Download our Eclipse studio (https://ci.inria.fr/diverse-commons/job/diverse-studio/)
2. Download the following project (https://github.com/arnobl/kompren/raw/master/kompren-examples/eclipseProjectTemplate.zip)
3. Import this last as an existing project into our Eclipse studio and move to the Java perspective
4. Open the file mySlicer.kompren
5. Add the line slicedProperty: ecore.ENamedElement.name at the end of this file
-> The compilation process starts: Xtend files are generated into the folder kompren-gen
-> These xtend files are not then compiled in Java code (into the folder xtend-gen)
When opening one of these xtend files to modify it manually, the xtend compilation starts.
Sometimes (very rarely), the xtend files are automatically compiled. I remove the generated Java files to see whether they are re-compiled but nothing happens.

The problem also appears with a standard Eclipse (4.3 and 4.4) supplemented with the required plugins (this is my case). I pointed you our Eclipse studio just to simplify the replication of the problem.

[Updated on: Fri, 18 July 2014 07:20]

Report message to a moderator

Re: How to launch the XTend compilation after having generating Xtend code? [message #1402882 is a reply to message #1402878] Fri, 18 July 2014 07:48 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

where do i find the code that calls the refesh?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to launch the XTend compilation after having generating Xtend code? [message #1402883 is a reply to message #1402882] Fri, 18 July 2014 07:53 Go to previous messageGo to next message
ARno B is currently offline ARno BFriend
Messages: 9
Registered: July 2014
Junior Member
Here (I just commited):
https://github.com/arnobl/kompren/blob/master/kompren-editor/fr.inria.diverse.kompren.xtext/src/fr/inria/diverse/kompren/generator/KomprenGenerator.xtend

The eclipse studio I pointed you does not contain this commit, but it still does not work for me in my dev eclipse.
Re: How to launch the XTend compilation after having generating Xtend code? [message #1402889 is a reply to message #1402883] Fri, 18 July 2014 08:41 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
sorry i have no further ideas on that.

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to launch the XTend compilation after having generating Xtend code? [message #1402890 is a reply to message #1402889] Fri, 18 July 2014 08:47 Go to previous messageGo to next message
ARno B is currently offline ARno BFriend
Messages: 9
Registered: July 2014
Junior Member
Ok thx :s
Is that possible to launch the compilation programmatically?
I tried that from lines 62 to 66 in the file KomprenGenerator.xtend (see my previous post) but I get the following error message while the files exist:
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: java.io.FileNotFoundException: /KomprenSlicerTemplate/src/main/kompren-gen/myslicer/MySlicer.xtend
Re: How to launch the XTend compilation after having generating Xtend code? [message #1402892 is a reply to message #1402890] Fri, 18 July 2014 08:57 Go to previous message
ARno B is currently offline ARno BFriend
Messages: 9
Registered: July 2014
Junior Member
I have finally a manual workaround better than modifying the xtend files.
If a remove the source folder that should contain the java files, there are re-generated (it works only when I remove the source folder, ie removing a java package has no effect).
Previous Topic:RFC: Can we remove these quirky grammar rules?
Next Topic:Question marks in text file generated by Xtend
Goto Forum:
  


Current Time: Fri Apr 19 06:28:34 GMT 2024

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

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

Back to the top