| ... | @@ -6419,6 +6419,38 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: std.Pr | ... | @@ -6419,6 +6419,38 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: std.Pr |
| 6419 | | 6419 | |
| 6420 | if (out_dep_path) |dep_file_path| { | 6420 | if (out_dep_path) |dep_file_path| { |
| 6421 | const dep_basename = fs.path.basename(dep_file_path); | 6421 | const dep_basename = fs.path.basename(dep_file_path); |
| | 6422 | |
| | 6423 | if (comp.file_system_inputs != null) { |
| | 6424 | // Use the same file size limit as the cache code does for dependency files. |
| | 6425 | const dep_file_contents = try zig_cache_tmp_dir.readFileAlloc(dep_basename, gpa, .limited(Cache.manifest_file_size_max)); |
| | 6426 | defer gpa.free(dep_file_contents); |
| | 6427 | |
| | 6428 | var str_buf: std.ArrayList(u8) = .empty; |
| | 6429 | defer str_buf.deinit(gpa); |
| | 6430 | |
| | 6431 | var it: std.Build.Cache.DepTokenizer = .{ .bytes = dep_file_contents }; |
| | 6432 | while (it.next()) |token| { |
| | 6433 | const input_path: Compilation.Path = switch (token) { |
| | 6434 | .target, .target_must_resolve => continue, |
| | 6435 | .prereq => |file_path| try .fromUnresolved(arena, comp.dirs, &.{file_path}), |
| | 6436 | .prereq_must_resolve => p: { |
| | 6437 | try token.resolve(gpa, &str_buf); |
| | 6438 | break :p try .fromUnresolved(arena, comp.dirs, &.{str_buf.items}); |
| | 6439 | }, |
| | 6440 | else => |err| { |
| | 6441 | try err.printError(gpa, &str_buf); |
| | 6442 | log.err("failed parsing {s}: {s}", .{ dep_basename, str_buf.items }); |
| | 6443 | return error.InvalidDepFile; |
| | 6444 | }, |
| | 6445 | }; |
| | 6446 | |
| | 6447 | // There may be concurrent calls to `appendFileSystemInput` from other C objects. |
| | 6448 | comp.mutex.lock(); |
| | 6449 | defer comp.mutex.unlock(); |
| | 6450 | try comp.appendFileSystemInput(input_path); |
| | 6451 | } |
| | 6452 | } |
| | 6453 | |
| 6422 | // Add the files depended on to the cache system. | 6454 | // Add the files depended on to the cache system. |
| 6423 | try man.addDepFilePost(zig_cache_tmp_dir, dep_basename); | 6455 | try man.addDepFilePost(zig_cache_tmp_dir, dep_basename); |
| 6424 | switch (comp.cache_use) { | 6456 | switch (comp.cache_use) { |