lobster icon indicating copy to clipboard operation
lobster copied to clipboard

Build version number into executable

Open dcurrie opened this issue 4 years ago • 2 comments

I don't see a way to confirm that I'm running a specific version of Lobster. When I build locally, and run without args I get the build date, which is certainly better than nothing, but doesn't really tell me the state of the sources when I built.

One solution is to automate incorporating the git tag and hash (and branch if being ambitious) into the binary, and have Lobster print that on the console along with the build date. We have a script to do that at work; I can't share it, but Googling around I found a couple similar things

https://www.mattkeeter.com/blog/2018-01-06-versioning/

or

https://github.com/bufferoverflow/proxyme/blob/master/CMakeLists.txt#L5

lobster e% git rev-parse --short HEAD 
21117d5
lobster e% git diff-index --name-only HEAD
lobster e% git name-rev --tags --name-only 21117d5
undefined

These are stuffed into a file with CMake's configure_file

dcurrie avatar Dec 27 '19 21:12 dcurrie

I agree, that would be nice, or better yet, date + hash, e.g. 2019-12-27-21117d5.

Problem with these kinds of systems is that Lobster is currently built with 5 different build system for 6 platforms :) So we'd need to integrate it into some of them for it to make sense. Hence why the simple build date solution so far.

I have plans to at some point move the Win/Mac builds to CMake also, which would simplify this. Sadly its not that simple, as there's a lot of custom settings to account for.

So we could start by adding this to CMake, if you feel like experimenting with it.

aardappel avatar Dec 27 '19 23:12 aardappel

I guess the github AI is aggressive about closing issues... my comment was that this fixes this issue for CMake only!

dcurrie avatar Dec 28 '19 21:12 dcurrie

We are still building for other platforms using their native build tools, e.g. Visual Studio, where adding a commit id/date to the code would be prohibitive complex and undesirable.

Instead, anyone with push access to the Lobster repo can push a tag (for which we use the format "v{YEAR}.{V}" where V is an incrementing integer for that year, e.g. v2023.0, which causes there to be a release on github for all platforms.

If you want a recent version and the last one is out of date, simply ping myself to create one.

That still doesn't add the versioning to the executables, which at this point I don't want to put effort into supporting. Maybe someone could add code to .github/workflows/release.yml that adds a VERSION.txt to the release archives based on the tag?

aardappel avatar Apr 22 '23 16:04 aardappel