In a certain software project I'm involved with, (one or more) of the executables which get built to write logs, and it is customary/expected for those logs to include some sort of tag or version information regarding the running process. This is currently done both for release builds, which have release version numbers (e.g. 3.5.1), but also for development builds, where the tag can and is more involved than that. There is a bespoke mechanism which generates code for this tagging, and uses git (i.e. assumes the source code is also a git repository) to obtain commit hashes and such. During build (re)configuration, a source file with functions returning build tags is generated, by examining the git history and/or computing hashes of things.
I want to scrap this mechanism, for the following reasons:
- Code should not rely on the existence of the revision control mechanism it may or may not be developed with. Specifically, one should be able to package a release tarball, unpack and build it with no revision control employed at all (e.g. no
.git
,.hg
,.svn
etc. subdirectories in the repository source). - I don't like bespoke build-related mechanisms or libraries for tasks which are not specific to our project or to our organization; I'd like to use something common, well-known/well-established, which we don't need to maintain and worry about.
- I'd rather have build tags be intentional rather than extentional, i.e. the repository itself is not aware of, and cannot determine, what the build version is; and it is only the person (or program) configuring the build that says "your build tag is 'foo_experimental_2024_11_23+'", or whatever.
I would like to propose something different to the team, but I'm not sure what that would be, especially since I'm not familiar with build-tagging conventions in other projects. Any suggestions?