-
Notifications
You must be signed in to change notification settings - Fork 14
Version.h gets stale on branch switch #52
Comments
Thanks for the suggestion. The logic at present copes if the root CMakeLists.txt is changed (or any other cmake logic or dependent files) which would trigger a cmake rerun, but not if the branch switch doesn't change anything. At least on our own build infrastructure, we always build from a clean slate, so don't encounter this problem directly. I'll see if it's possible to regenerate only if changed, if it's not too expensive (invoking git and not forcing a rebuild of everything). There's also the issue of what a significant branch switch means; change of HEAD tree hash, change of head, what about dirty uncommitted state? In general, we've kept the underlying version control as uncoupled as possible from the code (the hash here is purely informational and would be blank if building from a source release were it not provided separately). In general, I'd suggest that you should re-run cmake or start with a fresh build directory after a branch switch, to be sure of a clean and consistent state. Regards, |
Thanks Roger for the detailed explanation. |
By the way, the latest releases (>=0.3.0) dropped the complex getting of the various versions from git; it's now hardcoded in the root So this will only not be regenerated when switching branches for the same development version. Not 100% perfect, but will regenerate in most typical cases now. |
Assuming the suggestions from #52 (comment) together with the versioning improvements since 0.3.0 address most of this issue, closing. |
Consider the following steps:
git clone git@github.com:ome/ome-files-cpp.git
mkdir build
cd build
cmake ..
make
grep OME_FILES_VCS_SHORTREVISION lib/ome/files/Version.h
#define OME_FILES_VCS_SHORTREVISION "3a25964"
Now if you change branches in the repo which has a different HEAD commit and rebuild with make and call
grep OME_FILES_VCS_SHORTREVISION lib/ome/files/Version.h
again the output has not changed.A fix could be to regenerate Version.h at every make invocation.
The text was updated successfully, but these errors were encountered: