Skip to content

Commit

Permalink
Make version_commit_* optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnau478 committed Dec 12, 2024
1 parent 3fab74e commit edc5bde
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ fn getVersion(b: *std.Build) SemanticVersion {
"--tags",
"--abbrev=10",
}, &code, .Ignore) catch {
version.pre = b.fmt("dev.{d}", .{b.option(usize, "version_commit_num", "The commit index since last release").?});
version.build = b.option([]const u8, "version_commit_id", "The commit ID").?;
version.pre = b.fmt("dev.{d}", .{b.option(usize, "version_commit_num", "The commit index since last release") orelse 0});
if (b.option([]const u8, "version_commit_id", "The commit ID")) |commit_id| {
version.build = commit_id;
}
return version;
}, "\n\r");

Expand Down

0 comments on commit edc5bde

Please sign in to comment.