Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Changing output directory for code generated files with Xtext
Changing output directory for code generated files with Xtext [message #1276561] Mon, 24 March 2014 18:32 Go to next message
George Best is currently offline George BestFriend
Messages: 4
Registered: March 2014
Junior Member
I have a question regarding the output directory of code generated files:

Is is possible to define the output directory (default "./src-gen") of the Xtext code generator to be the same, where the concrete syntax/grammar file (...mydsl) - which is processed/saved via the editor - is located?

If yes, can this be done in the <MyDsl>OutputConfigurationProvider (head.outputDirectory) or is there another approach within Xtext?

At the moment I can only configure it to be relative to the eclipse project path and this is not what I need.

Thank you for your help!
Re: Changing output directory for code generated files with Xtext [message #1276876 is a reply to message #1276561] Tue, 25 March 2014 06:14 Go to previous messageGo to next message
Uli Merkel is currently offline Uli MerkelFriend
Messages: 248
Registered: June 2013
Senior Member
The generated DSL has a couple of preference pages.
On the "Compiler" page, you can set preferences for the "output folder"
including the path of the output directory.
Re: Changing output directory for code generated files with Xtext [message #1277002 is a reply to message #1276876] Tue, 25 March 2014 10:35 Go to previous messageGo to next message
George Best is currently offline George BestFriend
Messages: 4
Registered: March 2014
Junior Member
Thanks, but I intended that this should not be changed manually via eclipse preferences.
Re: Changing output directory for code generated files with Xtext [message #1277061 is a reply to message #1277002] Tue, 25 March 2014 12:38 Go to previous message
Uli Merkel is currently offline Uli MerkelFriend
Messages: 248
Registered: June 2013
Senior Member
resource.getURI() will give you infos about your input file.

I use it to make my output file similar to the input file with:

override void doGenerate(Resource resource, IFileSystemAccess fsa) {
var String scriptFileName = resource.getURI().lastSegment.toString();
var String outFileBase = scriptFileName.substring(0,scriptFileName.lastIndexOf("."));
fsa.generateFile( outFileBase + '.CIF',
makeTheCif(resource.contents.head as Model));
Previous Topic:Exceptions at startup when running test workspace from IDE
Next Topic:Customizing ScopeProvider for cross references using JvmReferenceType (XBase)
Goto Forum:
  


Current Time: Mon Jan 20 07:35:23 GMT 2020

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

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

Back to the top