authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-02 22:02:40-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-04 00:27:09-08:00
logb32a38ad2753df8df40008e279fb9f645de29c47
tree33dacb6e05d4944a61aa4af9900c5b78b746b1f9
parent1070c2a71a89175461273eba9f49bb85bdc83ecd

build: fix file system watching compilation on macOS


2 files changed, 12 insertions(+), 11 deletions(-)

lib/compiler/build_runner.zig+1-1
...@@ -544,7 +544,7 @@ pub fn main(init: process.Init.Minimal) !void {...@@ -544,7 +544,7 @@ pub fn main(init: process.Init.Minimal) !void {
544 var w: Watch = w: {544 var w: Watch = w: {
545 if (!watch) break :w undefined;545 if (!watch) break :w undefined;
546 if (!Watch.have_impl) fatal("--watch not yet implemented for {t}", .{builtin.os.tag});546 if (!Watch.have_impl) fatal("--watch not yet implemented for {t}", .{builtin.os.tag});
547 break :w try .init();547 break :w try .init(graph.cache.cwd);
548 };548 };
549549
550 const now = Io.Clock.Timestamp.now(io, .awake) catch |err| fatal("failed to collect timestamp: {t}", .{err});550 const now = Io.Clock.Timestamp.now(io, .awake) catch |err| fatal("failed to collect timestamp: {t}", .{err});
lib/std/Build/Watch.zig+11-10
...@@ -99,7 +99,8 @@ const Os = switch (builtin.os.tag) {...@@ -99,7 +99,8 @@ const Os = switch (builtin.os.tag) {
99 };99 };
100 };100 };
101101
102 fn init() !Watch {102 fn init(cwd_path: []const u8) !Watch {
103 _ = cwd_path;
103 return .{104 return .{
104 .dir_table = .{},105 .dir_table = .{},
105 .dir_count = 0,106 .dir_count = 0,
...@@ -427,7 +428,8 @@ const Os = switch (builtin.os.tag) {...@@ -427,7 +428,8 @@ const Os = switch (builtin.os.tag) {
427 }428 }
428 };429 };
429430
430 fn init() !Watch {431 fn init(cwd_path: []const u8) !Watch {
432 _ = cwd_path;
431 return .{433 return .{
432 .dir_table = .{},434 .dir_table = .{},
433 .dir_count = 0,435 .dir_count = 0,
...@@ -658,14 +660,13 @@ const Os = switch (builtin.os.tag) {...@@ -658,14 +660,13 @@ const Os = switch (builtin.os.tag) {
658 const EV = std.c.EV;660 const EV = std.c.EV;
659 const NOTE = std.c.NOTE;661 const NOTE = std.c.NOTE;
660662
661 fn init() !Watch {663 fn init(cwd_path: []const u8) !Watch {
662 const kq_fd = try posix.kqueue();664 _ = cwd_path;
663 errdefer posix.close(kq_fd);
664 return .{665 return .{
665 .dir_table = .{},666 .dir_table = .{},
666 .dir_count = 0,667 .dir_count = 0,
667 .os = .{668 .os = .{
668 .kq_fd = kq_fd,669 .kq_fd = try posix.kqueue(),
669 .handles = .empty,670 .handles = .empty,
670 },671 },
671 .generation = 0,672 .generation = 0,
...@@ -841,9 +842,9 @@ const Os = switch (builtin.os.tag) {...@@ -841,9 +842,9 @@ const Os = switch (builtin.os.tag) {
841 .macos => struct {842 .macos => struct {
842 fse: FsEvents,843 fse: FsEvents,
843844
844 fn init() !Watch {845 fn init(cwd_path: []const u8) !Watch {
845 return .{846 return .{
846 .os = .{ .fse = try .init() },847 .os = .{ .fse = try .init(cwd_path) },
847 .dir_count = 0,848 .dir_count = 0,
848 .dir_table = undefined,849 .dir_table = undefined,
849 .generation = undefined,850 .generation = undefined,
...@@ -863,8 +864,8 @@ const Os = switch (builtin.os.tag) {...@@ -863,8 +864,8 @@ const Os = switch (builtin.os.tag) {
863 else => void,864 else => void,
864};865};
865866
866pub fn init() !Watch {867pub fn init(cwd_path: []const u8) !Watch {
867 return Os.init();868 return Os.init(cwd_path);
868}869}
869870
870pub const Match = struct {871pub const Match = struct {