| author | |
| committer | |
| log | 02438aabe3a04ac8ca2a2e0b2501ba18885652e3 |
| tree | bc2deec16503a82dfc836e65291728f944bd5ba5 |
| parent | 4af763d401b48f7186650335c8e42e8fe29751bf |
2 files changed, 9 insertions(+), 3 deletions(-)
CMakeLists.txt+1-1| ... | ... | @@ -46,7 +46,7 @@ if("${ZIG_VERSION}" STREQUAL "") |
| 46 | 46 | if(NOT GIT_TAG VERSION_EQUAL ZIG_VERSION) |
| 47 | 47 | message(SEND_ERROR "Zig version (${ZIG_VERSION}) does not match Git tag (${GIT_TAG}).") |
| 48 | 48 | endif() |
| 49 | elseif(GIT_DESCRIBE MATCHES "^v?([0-9]+\\.[0-9]+\\.[0-9]+)-([0-9]+)-(.+)$") | |
| 49 | elseif(GIT_DESCRIBE MATCHES "^v?([0-9]+\\.[0-9]+\\.[0-9]+)-([0-9]+)-g(.+)$") | |
| 50 | 50 | # Untagged pre-release. The Zig version is updated to include the number of commits |
| 51 | 51 | # since the last tagged version and the commit hash. The version is formatted in |
| 52 | 52 | # accordance with the https://semver.org specification. |
build.zig+8-2| ... | ... | @@ -256,11 +256,17 @@ pub fn build(b: *Builder) !void { |
| 256 | 256 | std.process.exit(1); |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | // Check that the commit hash is prefixed with a 'g' (a Git convention). | |
| 260 | if (commit_id.len < 1 or commit_id[0] != 'g') { | |
| 261 | std.debug.print("Unexpected `git describe` output: {}\n", .{git_describe}); | |
| 262 | break :v version_string; | |
| 263 | } | |
| 264 | ||
| 259 | 265 | // The version is reformatted in accordance with the https://semver.org specification. |
| 260 | break :v b.fmt("{}-dev.{}+{}", .{ version_string, commit_height, commit_id }); | |
| 266 | break :v b.fmt("{}-dev.{}+{}", .{ version_string, commit_height, commit_id[1..] }); | |
| 261 | 267 | }, |
| 262 | 268 | else => { |
| 263 | std.debug.print("Failed to parse `git describe` output: {}\n", .{git_describe}); | |
| 269 | std.debug.print("Unexpected `git describe` output: {}\n", .{git_describe}); | |
| 264 | 270 | break :v version_string; |
| 265 | 271 | }, |
| 266 | 272 | } |