Skip to content

Commit

Permalink
check whether the required Linux release is present for std.build.Watch
Browse files Browse the repository at this point in the history
Watch Mode is not yet being used but this change is going to be necessary anyway.
  • Loading branch information
Techatrix authored and llogick committed Nov 18, 2024
1 parent 3bb4ae7 commit 60db614
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/build_runner/0.12.0.zig
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,16 @@ pub fn main() !void {
seed,
);

const watch_suported = comptime switch (builtin.os.tag) {
.linux => builtin.zig_version.order(file_watch_version) != .lt,
.windows => builtin.zig_version.order(file_watch_windows_version) != .lt,
const watch_suported = switch (builtin.os.tag) {
.linux => blk: {
if (comptime builtin.zig_version.order(file_watch_version) == .lt) break :blk false;

// std.build.Watch requires `FAN_REPORT_TARGET_FID` which is Linux 5.17+
const utsname = std.posix.uname();
const version = std.SemanticVersion.parse(&utsname.release) catch break :blk true;
break :blk version.order(.{ .major = 5, .minor = 17, .patch = 0 }) != .lt;
},
.windows => comptime builtin.zig_version.order(file_watch_windows_version) != .lt,
else => false,
};
if (!watch_suported) return;
Expand Down

0 comments on commit 60db614

Please sign in to comment.