| Summary: | Generated Java Files should contain Xtext Version number | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Andreas Graf <graf> | ||||
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> | ||||
| Status: | CLOSED FIXED | QA Contact: | |||||
| Severity: | enhancement | ||||||
| Priority: | P3 | CC: | karsten.thoms, sebastian.zarnekow, sven.efftinge | ||||
| Version: | unspecified | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 7 | ||||||
| See Also: | https://git.eclipse.org/r/43524 | ||||||
| Whiteboard: | v2.9 | ||||||
| Attachments: |
|
||||||
|
Description
Andreas Graf
I'd rather be more specific with the dependencies in the manifest.mf. This would e.g. help to see which version is actually used in generating, e.g. when building with Tycho etc. 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.
New Gerrit change created: https://git.eclipse.org/r/43524 Merged into master. Thank you, Karsten. Requested via bug 522520. -M. Requested via bug 522520. -M. |