| ... | ... | @@ -2967,13 +2967,17 @@ pub fn cImport(comp: *Compilation, c_src: []const u8) !CImportResult { |
| 2967 | 2967 | |
| 2968 | 2968 | try out_zig_file.writeAll(formatted); |
| 2969 | 2969 | |
| 2970 | | man.writeManifest() catch |err| { |
| 2971 | | log.warn("failed to write cache manifest for C import: {s}", .{@errorName(err)}); |
| 2972 | | }; |
| 2973 | | |
| 2974 | 2970 | break :digest digest; |
| 2975 | 2971 | } else man.final(); |
| 2976 | 2972 | |
| 2973 | // Write the updated manifest. This is a no-op if the manifest is not dirty. Note that it is |
| 2974 | // possible we had a hit and the manifest is dirty, for example if the file mtime changed but |
| 2975 | // the contents were the same, we hit the cache but the manifest is dirty and we need to update |
| 2976 | // it to prevent doing a full file content comparison the next time around. |
| 2977 | man.writeManifest() catch |err| { |
| 2978 | log.warn("failed to write cache manifest for C import: {s}", .{@errorName(err)}); |
| 2979 | }; |
| 2980 | |
| 2977 | 2981 | const out_zig_path = try comp.local_cache_directory.join(comp.gpa, &[_][]const u8{ |
| 2978 | 2982 | "o", &digest, cimport_zig_basename, |
| 2979 | 2983 | }); |
| ... | ... | @@ -3288,13 +3292,17 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: *std.P |
| 3288 | 3292 | defer o_dir.close(); |
| 3289 | 3293 | const tmp_basename = std.fs.path.basename(out_obj_path); |
| 3290 | 3294 | try std.fs.rename(zig_cache_tmp_dir, tmp_basename, o_dir, o_basename); |
| 3291 | | |
| 3292 | | man.writeManifest() catch |err| { |
| 3293 | | log.warn("failed to write cache manifest when compiling '{s}': {s}", .{ c_object.src.src_path, @errorName(err) }); |
| 3294 | | }; |
| 3295 | 3295 | break :blk digest; |
| 3296 | 3296 | }; |
| 3297 | 3297 | |
| 3298 | // Write the updated manifest. This is a no-op if the manifest is not dirty. Note that it is |
| 3299 | // possible we had a hit and the manifest is dirty, for example if the file mtime changed but |
| 3300 | // the contents were the same, we hit the cache but the manifest is dirty and we need to update |
| 3301 | // it to prevent doing a full file content comparison the next time around. |
| 3302 | man.writeManifest() catch |err| { |
| 3303 | log.warn("failed to write cache manifest when compiling '{s}': {s}", .{ c_object.src.src_path, @errorName(err) }); |
| 3304 | }; |
| 3305 | |
| 3298 | 3306 | const o_basename = try std.fmt.allocPrint(arena, "{s}{s}", .{ o_basename_noext, o_ext }); |
| 3299 | 3307 | |
| 3300 | 3308 | c_object.status = .{ |