| ... | @@ -266,12 +266,16 @@ pub fn buildImportLib(comp: *Compilation, lib_name: []const u8) !void { | ... | @@ -266,12 +266,16 @@ pub fn buildImportLib(comp: *Compilation, lib_name: []const u8) !void { |
| 266 | | 266 | |
| 267 | if (try man.hit()) { | 267 | if (try man.hit()) { |
| 268 | const digest = man.final(); | 268 | const digest = man.final(); |
| | 269 | const sub_path = try std.fs.path.join(gpa, &.{ "o", &digest, final_lib_basename }); |
| | 270 | errdefer gpa.free(sub_path); |
| 269 | | 271 | |
| | 272 | comp.mutex.lock(); |
| | 273 | defer comp.mutex.unlock(); |
| 270 | try comp.crt_files.ensureUnusedCapacity(gpa, 1); | 274 | try comp.crt_files.ensureUnusedCapacity(gpa, 1); |
| 271 | comp.crt_files.putAssumeCapacityNoClobber(final_lib_basename, .{ | 275 | comp.crt_files.putAssumeCapacityNoClobber(final_lib_basename, .{ |
| 272 | .full_object_path = .{ | 276 | .full_object_path = .{ |
| 273 | .root_dir = comp.global_cache_directory, | 277 | .root_dir = comp.global_cache_directory, |
| 274 | .sub_path = try std.fs.path.join(gpa, &.{ "o", &digest, final_lib_basename }), | 278 | .sub_path = sub_path, |
| 275 | }, | 279 | }, |
| 276 | .lock = man.toOwnedLock(), | 280 | .lock = man.toOwnedLock(), |
| 277 | }); | 281 | }); |
| ... | @@ -360,6 +364,8 @@ pub fn buildImportLib(comp: *Compilation, lib_name: []const u8) !void { | ... | @@ -360,6 +364,8 @@ pub fn buildImportLib(comp: *Compilation, lib_name: []const u8) !void { |
| 360 | log.warn("failed to write cache manifest for DLL import {s}.lib: {s}", .{ lib_name, @errorName(err) }); | 364 | log.warn("failed to write cache manifest for DLL import {s}.lib: {s}", .{ lib_name, @errorName(err) }); |
| 361 | }; | 365 | }; |
| 362 | | 366 | |
| | 367 | comp.mutex.lock(); |
| | 368 | defer comp.mutex.unlock(); |
| 363 | try comp.crt_files.putNoClobber(gpa, final_lib_basename, .{ | 369 | try comp.crt_files.putNoClobber(gpa, final_lib_basename, .{ |
| 364 | .full_object_path = .{ | 370 | .full_object_path = .{ |
| 365 | .root_dir = comp.global_cache_directory, | 371 | .root_dir = comp.global_cache_directory, |