AAVSO / VStar

VStar is a visualisation and analysis tool for variable star data brought to you by AAVSO
https://www.aavso.org/vstar
GNU Affero General Public License v3.0
10 stars 3 forks source link

Build nuisance: RevisionAccessor.java is generated by build. Unclear if it needs to be committed. #309

Open orionlee opened 1 year ago

orionlee commented 1 year ago

Build process automatically (re-)generates src/org/aavso/tools/vstar/ui/resources/RevisionAccessor.java, containing revision information.

RevisionAccessor.java is thus modified and appears as a modified file that needs to be committed. It is unclear if / when it should be committed.

In principle, since the fie is generated by build (ant build [*]), it should not need to be in the git repo to begin with. However, some workflows, e.g., eclipse build, do not generate it (because they are not ant driven). and will breakdown if we simply remove it from git repo (and add it to .gitignore list).

[*] It's in compile_src target, before the actual javac happens

https://github.com/AAVSO/VStar/blob/0115ad7d12db3c8bf429000e79d88708dd458746/build.xml#L76-L91

orionlee commented 1 year ago

One workaround to the problem is to

  1. generate and store the revision information in a resource file to be bundled to the jar
  2. modify RevisionAccessor.java to read the values from the resource file
  3. Further RevisionAccessor.java so that if the resource file is missing (for eclipse build case), it does not throw exception, and provide some dummy placeholder value instead.
dbenn commented 1 year ago

This seems like a good solution @orionlee