Closed Reokodoku closed 2 months ago
Also, the version is not taken from build.zig.zon because there is no function or variable to get it from there (the only way is to parse the zon file, but I don't think that is necessary).
As a side note, I was actually considering doing that, as parsing it would be pretty easy. Also, https://github.com/ziglang/zig/issues/14531 won't be implemented until zig 0.14.0, so...
Looks pretty good to me. Just a small thing: when git
is not available, it builds with the version being the one in build.zig.zon
(no -dev
) or anything. Sure, it cannot get the commit number nor id, but it can add a single -dev
, to make it clear that it's not a release build.
This PR adds the
--version
argument (as well as-v
) to get information about the version of hevi built.When git is available, the build system tries to get the information to generate the version string from
git describe --tags
. The format of the version taken from git isx.x.x-dev.n+h
, wheren
is the commit number (starting with the last tag) and whereh
is the hash of the last commit.If git is unavailable or an error occurs, the version string defaults to the one written in
build.zig
.Also, the version is not taken from
build.zig.zon
because there is no function or variable to get it from there (the only way is to parse the zon file, but I don't think that is necessary).