mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-22 04:34:44 +00:00
feat: add git_version build option for release version detection
- Add git_version option to build.zig (similar to git_commit) - Update version command to output git_version when available - Falls back to git_commit when not on a tagged release - CI can pass -Dgit_version=$(git describe --tags --exact-match) for releases Fixes #1867
This commit is contained in:
@@ -27,12 +27,14 @@ pub fn build(b: *Build) !void {
|
||||
const manifest = Manifest.init(b);
|
||||
|
||||
const git_commit = b.option([]const u8, "git_commit", "Current git commit");
|
||||
const git_version = b.option([]const u8, "git_version", "Current git version (from tag)");
|
||||
const prebuilt_v8_path = b.option([]const u8, "prebuilt_v8_path", "Path to prebuilt libc_v8.a");
|
||||
const snapshot_path = b.option([]const u8, "snapshot_path", "Path to v8 snapshot");
|
||||
|
||||
var opts = b.addOptions();
|
||||
opts.addOption([]const u8, "version", manifest.version);
|
||||
opts.addOption([]const u8, "git_commit", git_commit orelse "dev");
|
||||
opts.addOption([]const u8, "git_version", git_version orelse "dev");
|
||||
opts.addOption(?[]const u8, "snapshot_path", snapshot_path);
|
||||
|
||||
const enable_tsan = b.option(bool, "tsan", "Enable Thread Sanitizer") orelse false;
|
||||
|
||||
@@ -59,7 +59,11 @@ fn run(allocator: Allocator, main_arena: Allocator) !void {
|
||||
return std.process.cleanExit();
|
||||
},
|
||||
.version => {
|
||||
std.debug.print("{s}\n", .{lp.build_config.git_commit});
|
||||
const version = if (std.mem.eql(u8, lp.build_config.git_version, "dev"))
|
||||
lp.build_config.git_commit
|
||||
else
|
||||
lp.build_config.git_version;
|
||||
std.debug.print("{s}\n", .{version});
|
||||
return std.process.cleanExit();
|
||||
},
|
||||
else => {},
|
||||
|
||||
Reference in New Issue
Block a user