Skip to main content



      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 13:22 Go to next message
Eclipse UserFriend
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 16:14 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: How to launch the XTend compilation after having generating Xtend code? [message #1402850 is a reply to message #1402849] Thu, 17 July 2014 16:18 Go to previous messageGo to next message
Eclipse UserFriend
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 16:20 Go to previous messageGo to next message
Eclipse UserFriend
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 16:30 Go to previous messageGo to next message
Eclipse UserFriend
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 16:47 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: How to launch the XTend compilation after having generating Xtend code? [message #1402860 is a reply to message #1402857] Thu, 17 July 2014 17:10 Go to previous messageGo to next message
Eclipse UserFriend
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 17:11] by 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 01:07 Go to previous messageGo to next message
Eclipse UserFriend
Last question: are the files within a source folder.

Can you give a step by step description on how to reproduce?
Re: How to launch the XTend compilation after having generating Xtend code? [message #1402878 is a reply to message #1402873] Fri, 18 July 2014 03:16 Go to previous messageGo to next message
Eclipse UserFriend
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 03:20] by 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 03:48 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

where do i find the code that calls the refesh?
Re: How to launch the XTend compilation after having generating Xtend code? [message #1402883 is a reply to message #1402882] Fri, 18 July 2014 03:53 Go to previous messageGo to next message
Eclipse UserFriend
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 04:41 Go to previous messageGo to next message
Eclipse UserFriend
sorry i have no further ideas on that.
Re: How to launch the XTend compilation after having generating Xtend code? [message #1402890 is a reply to message #1402889] Fri, 18 July 2014 04:47 Go to previous messageGo to next message
Eclipse UserFriend
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 04:57 Go to previous message
Eclipse UserFriend
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: Sun Jul 13 01:08:23 EDT 2025

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

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

Back to the top