Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 336323 - Generated Java Files should contain Xtext Version number
Summary: Generated Java Files should contain Xtext Version number
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard: v2.9
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-04 04:24 EST by Andreas Graf CLA
Modified: 2017-10-31 10:58 EDT (History)
3 users (show)

See Also:


Attachments
Patch proposal (9.89 KB, patch)
2015-03-08 17:45 EDT, Karsten Thoms CLA
sven.efftinge: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Graf CLA 2011-02-04 04:24:53 EST
Build Identifier: 

Right now, if you receive a Xtext project from another party, it is difficult to see what Xtext version was used for the project. It would be great if the comments in the generated source code would be changed from 
/*
 * generated by Xtext
 */

to 

/*
 * generated by Xtext <version>
 */




Reproducible: Always
Comment 1 Sebastian Zarnekow CLA 2011-02-04 04:27:29 EST
I'd rather be more specific with the dependencies in the manifest.mf.
Comment 2 Andreas Graf CLA 2014-01-21 04:53:16 EST
This would e.g. help to see which version is actually used in generating, e.g. when building with Tycho etc.
Comment 3 Karsten Thoms CLA 2015-03-08 17:45:18 EDT
Created attachment 251388 [details]
Patch proposal

I think this is a useful extension. Although it is good to specify Xtext dependencies strictly in the manifest, reality is different. I often face existing projects that might have specified a version in the manifest, but it is often just the minimal version which was generated when the project has been created. Dependency versions are often not maintained properly. Thus it is better that somewhere it is clearly stated with which version of Xtext the project was generated. This might even differ in UI and Build.

Find attached a proposal to fulfill this requirement. The Generator component gets an additional property ${version} that can be used for the fileHeader property. Since I think this should be on by default, the fileHeader is by default 
  private String fileHeader = "/*\n * generated by Xtext ${version}\n */";

It is a bit tricky to get the bundle version when the generator is run as an MWE2 workflow in standalone mode without hard-coding it. But in MWE there is a similar trick used. It makes use of the class EMFPlugin, from which a dummy concrete class is derived. From this the MANIFEST.MF from the defining plugin (here: org.eclipse.xtext.generator) can be determined. In the development environment getVersion() will evaluate to "2.8.0.qualifier". It might be discussed if ".qualifier" could be replaced by something (e.g. "2.8.0 DEVELOPMENT"), but with built versions this should be just fine.
Comment 4 Eclipse Genie CLA 2015-03-10 06:38:19 EDT
New Gerrit change created: https://git.eclipse.org/r/43524
Comment 5 Sebastian Zarnekow CLA 2015-04-20 02:28:44 EDT
Merged into master. Thank you, Karsten.
Comment 6 Eclipse Webmaster CLA 2017-10-31 10:47:26 EDT
Requested via bug 522520.

-M.
Comment 7 Eclipse Webmaster CLA 2017-10-31 10:58:33 EDT
Requested via bug 522520.

-M.