| ... | @@ -1250,7 +1250,7 @@ pub const SubprocessCommand = struct { | ... | @@ -1250,7 +1250,7 @@ pub const SubprocessCommand = struct { |
| 1250 | for (child_env.keys(), child_env.values()) |key, value| { | 1250 | for (child_env.keys(), child_env.values()) |key, value| { |
| 1251 | if (sc.parent_env) |parent_env| { | 1251 | if (sc.parent_env) |parent_env| { |
| 1252 | if (parent_env.get(key)) |process_value| { | 1252 | if (parent_env.get(key)) |process_value| { |
| 1253 | if (std.mem.eql(u8, value, process_value)) continue; | 1253 | if (mem.eql(u8, value, process_value)) continue; |
| 1254 | } | 1254 | } |
| 1255 | } | 1255 | } |
| 1256 | try w.print("{s}=", .{key}); | 1256 | try w.print("{s}=", .{key}); |
| ... | @@ -1364,10 +1364,10 @@ pub const Directories = struct { | ... | @@ -1364,10 +1364,10 @@ pub const Directories = struct { |
| 1364 | | 1364 | |
| 1365 | const local_cache = getLocalCacheDirectory(arena, io, cwd, global_cache, local_cache_strat); | 1365 | const local_cache = getLocalCacheDirectory(arena, io, cwd, global_cache, local_cache_strat); |
| 1366 | | 1366 | |
| 1367 | if (std.mem.eql(u8, zig_lib.path orelse "", global_cache.path orelse "")) { | 1367 | if (mem.eql(u8, zig_lib.path orelse "", global_cache.path orelse "")) { |
| 1368 | fatal("zig lib directory '{f}' cannot be equal to global cache directory '{f}'", .{ zig_lib, global_cache }); | 1368 | fatal("zig lib directory '{f}' cannot be equal to global cache directory '{f}'", .{ zig_lib, global_cache }); |
| 1369 | } | 1369 | } |
| 1370 | if (std.mem.eql(u8, zig_lib.path orelse "", local_cache.path orelse "")) { | 1370 | if (mem.eql(u8, zig_lib.path orelse "", local_cache.path orelse "")) { |
| 1371 | fatal("zig lib directory '{f}' cannot be equal to local cache directory '{f}'", .{ zig_lib, local_cache }); | 1371 | fatal("zig lib directory '{f}' cannot be equal to local cache directory '{f}'", .{ zig_lib, local_cache }); |
| 1372 | } | 1372 | } |
| 1373 | | 1373 | |
| ... | @@ -1400,7 +1400,7 @@ pub const Directories = struct { | ... | @@ -1400,7 +1400,7 @@ pub const Directories = struct { |
| 1400 | | 1400 | |
| 1401 | fn getPreopen(preopens: std.process.Preopens, name: []const u8) Cache.Directory { | 1401 | fn getPreopen(preopens: std.process.Preopens, name: []const u8) Cache.Directory { |
| 1402 | return .{ | 1402 | return .{ |
| 1403 | .path = if (std.mem.eql(u8, name, ".")) null else name, | 1403 | .path = if (mem.eql(u8, name, ".")) null else name, |
| 1404 | .handle = switch (preopens.get(name) orelse fatal("preopen not found: {q}", .{name})) { | 1404 | .handle = switch (preopens.get(name) orelse fatal("preopen not found: {q}", .{name})) { |
| 1405 | .file => fatal("preopen {q} is not a directory", .{name}), | 1405 | .file => fatal("preopen {q} is not a directory", .{name}), |
| 1406 | .dir => |d| d, | 1406 | .dir => |d| d, |
| ... | @@ -1607,7 +1607,7 @@ pub fn resolvePath( | ... | @@ -1607,7 +1607,7 @@ pub fn resolvePath( |
| 1607 | assert(Dir.path.isAbsolute(path_resolved)); | 1607 | assert(Dir.path.isAbsolute(path_resolved)); |
| 1608 | assert(Dir.path.isAbsolute(cwd_resolved)); | 1608 | assert(Dir.path.isAbsolute(cwd_resolved)); |
| 1609 | | 1609 | |
| 1610 | if (!std.mem.startsWith(u8, path_resolved, cwd_resolved)) return path_resolved; // not in cwd | 1610 | if (!mem.startsWith(u8, path_resolved, cwd_resolved)) return path_resolved; // not in cwd |
| 1611 | if (path_resolved.len == cwd_resolved.len) { | 1611 | if (path_resolved.len == cwd_resolved.len) { |
| 1612 | // equal to cwd | 1612 | // equal to cwd |
| 1613 | gpa.free(path_resolved); | 1613 | gpa.free(path_resolved); |
| ... | @@ -1634,6 +1634,7 @@ pub const BuildExeSubprocessOptions = struct { | ... | @@ -1634,6 +1634,7 @@ pub const BuildExeSubprocessOptions = struct { |
| 1634 | cache_manifest: ?*Cache.Manifest = null, | 1634 | cache_manifest: ?*Cache.Manifest = null, |
| 1635 | arch_os_abi: ?[]const u8 = null, | 1635 | arch_os_abi: ?[]const u8 = null, |
| 1636 | cpu_features: ?[]const u8 = null, | 1636 | cpu_features: ?[]const u8 = null, |
| | 1637 | progress_node: std.Progress.Node = .none, |
| 1637 | }; | 1638 | }; |
| 1638 | | 1639 | |
| 1639 | pub const BuildExeSubprocessError = error{ | 1640 | pub const BuildExeSubprocessError = error{ |
| ... | @@ -1655,6 +1656,7 @@ pub fn buildExeSubprocess(gpa: Allocator, io: Io, options: BuildExeSubprocessOpt | ... | @@ -1655,6 +1656,7 @@ pub fn buildExeSubprocess(gpa: Allocator, io: Io, options: BuildExeSubprocessOpt |
| 1655 | .stdin = .pipe, | 1656 | .stdin = .pipe, |
| 1656 | .stdout = .pipe, | 1657 | .stdout = .pipe, |
| 1657 | .stderr = .pipe, | 1658 | .stderr = .pipe, |
| | 1659 | .progress_node = options.progress_node, |
| 1658 | }) catch |err| { | 1660 | }) catch |err| { |
| 1659 | log.err("spawning command {t}: {f}", .{ err, cmd }); | 1661 | log.err("spawning command {t}: {f}", .{ err, cmd }); |
| 1660 | return error.AlreadyReported; | 1662 | return error.AlreadyReported; |
| ... | @@ -1722,7 +1724,7 @@ pub fn buildExeSubprocess(gpa: Allocator, io: Io, options: BuildExeSubprocessOpt | ... | @@ -1722,7 +1724,7 @@ pub fn buildExeSubprocess(gpa: Allocator, io: Io, options: BuildExeSubprocessOpt |
| 1722 | | 1724 | |
| 1723 | switch (header.tag) { | 1725 | switch (header.tag) { |
| 1724 | .zig_version => { | 1726 | .zig_version => { |
| 1725 | if (!std.mem.eql(u8, builtin.zig_version_string, body)) { | 1727 | if (!mem.eql(u8, builtin.zig_version_string, body)) { |
| 1726 | log.err("zig protocol version mismatch from command: {f}", .{cmd}); | 1728 | log.err("zig protocol version mismatch from command: {f}", .{cmd}); |
| 1727 | return error.AlreadyReported; | 1729 | return error.AlreadyReported; |
| 1728 | } | 1730 | } |
| ... | @@ -1747,16 +1749,23 @@ pub fn buildExeSubprocess(gpa: Allocator, io: Io, options: BuildExeSubprocessOpt | ... | @@ -1747,16 +1749,23 @@ pub fn buildExeSubprocess(gpa: Allocator, io: Io, options: BuildExeSubprocessOpt |
| 1747 | .sub_path = try Dir.path.join(gpa, &.{ "o", &Cache.binToHex(digest.*) }), | 1749 | .sub_path = try Dir.path.join(gpa, &.{ "o", &Cache.binToHex(digest.*) }), |
| 1748 | }; | 1750 | }; |
| 1749 | }, | 1751 | }, |
| 1750 | .file_system_inputs => { | 1752 | .file_system_inputs => if (options.cache_manifest) |man| { |
| 1751 | received_fs_inputs = true; | 1753 | received_fs_inputs = true; |
| 1752 | @panic("TODO"); | 1754 | var it = mem.splitScalar(u8, body, 0); |
| 1753 | //var it = mem.splitScalar(u8, file_system_inputs.items, 0); | 1755 | while (it.next()) |prefixed_path| { |
| 1754 | //while (it.next()) |input| { | 1756 | const prefix: Server.Message.PathPrefix = @enumFromInt(prefixed_path[0] - 1); |
| 1755 | // _ = try config_man.addPrefixedPathPost(.{ | 1757 | const sub_path = prefixed_path[1..]; |
| 1756 | // .prefix = input[0], | 1758 | _ = man.addPrefixedPathPost(.{ |
| 1757 | // .sub_path = input[1..], | 1759 | .prefix = @intFromEnum(prefix), |
| 1758 | // }); | 1760 | .sub_path = sub_path, |
| 1759 | //} | 1761 | }) catch |err| switch (err) { |
| | 1762 | error.Canceled, error.OutOfMemory => |e| return e, |
| | 1763 | else => |e| { |
| | 1764 | log.err("adding {t} {s} to cache failed: {t}", .{ prefix, sub_path, e }); |
| | 1765 | return error.AlreadyReported; |
| | 1766 | }, |
| | 1767 | }; |
| | 1768 | } |
| 1760 | }, | 1769 | }, |
| 1761 | else => {}, // ignore other messages | 1770 | else => {}, // ignore other messages |
| 1762 | } | 1771 | } |