OpenJK
OpenJK copied to clipboard
[Shared] Add git tag to version string
replace ~160 lines of cmake with a single call to git 🤷
If the git tag can't be obtained (e.g. no git
on path) it will default to UNKNOWN
So we have:
-
version
cvar (serverinfo) for the engine (also displayed in console) -
gamename
cvar (serverinfo) for the module (also printed on module load)
Future work
Make the command execute at compile time, not just configuration time. Not an issue for official builds, but for local dev the commit hash will stick around until you reconfigure.
Adding the revision is really useful when trying to figure out why someone experiences a bug and it would've been helpful for debugging issues on multiple occasions in the past. Thanks for working on this pretty much instantly after I suggested it.
However I am not sure how useful the lower version string OpenJK-MP: v1.0.1.0
is. The 1.0.1.0
originates from the last official jka patch where they used a tool for version numbers. OpenJK just targets 1.01, not 1.00 and the string implies you are running v1.0.1.0
of OpenJK, but in reality that string was shown on OpenJK for years (since 2013 I would guess) without actually holding any meaning other than OpenJK being based on the 1.0.1.0
release of vanilla jka. I think it would be far more useful if there was an actual OpenJK version in the lower line. For instance derived from the latest git tag. JK2MV just displays JK2MV: v1.4-386-gHASH
when the latest tag on the branch is 1.4
and the branch is 386
commits ahead of that tag. That way it's easy for developers and users to determine if the build used by someone is close to the latest release/tag or far ahead. The lower line of the version info on OpenJK could use the git tag in a similar way.
Good points. I've swapped the short commit hash for the git tag (v1.2.3-4ga1b2c3d
) and normalised all references to versions across the code.
I think I need to fix Win32 resources still.
The short hash isn't being applied correctly in the action builds CMAKE step as expected, I made a commit here that fixes the issue, as well as some other housekeeping that the workflow file could do with.
https://github.com/taysta/TaystJK/commit/5c25d46a8a547d6f857c5ecab1e60bb5cf59b7a6
Also, it doesn't get the hash correctly if for example you make the build from cmakegui, and it gets run in build folder, this commit fixes it: https://github.com/taysta/TaystJK/commit/87f5d1c121b4b164a88402610df5326bfc8e42de