diff options
| author | Jacob Young <15544577+jacobly0@users.noreply.github.com> | 2025-06-20 00:20:56 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-20 00:20:56 -0400 |
| commit | cf1a7bbd44b9542552c7b5dc6532aafb5142bf7a (patch) | |
| tree | 23d82265b3a4500514063f0fa13533b255f88f64 /lib/std/Build/Step/InstallDir.zig | |
| parent | f5a327cd366348a739a282f380acd627815183b5 (diff) | |
| parent | 1f98c98fffb09bf15a9fc04ecd5f1fa38a4bd4b8 (diff) | |
| download | zig-cf1a7bbd44b9542552c7b5dc6532aafb5142bf7a.tar.gz zig-cf1a7bbd44b9542552c7b5dc6532aafb5142bf7a.zip | |
Merge pull request #24193 from jacobly0/x86_64-spring-cleaning
x86_64: increase passing test coverage on windows
Diffstat (limited to 'lib/std/Build/Step/InstallDir.zig')
| -rw-r--r-- | lib/std/Build/Step/InstallDir.zig | 38 |
1 files changed, 10 insertions, 28 deletions
diff --git a/lib/std/Build/Step/InstallDir.zig b/lib/std/Build/Step/InstallDir.zig index 4d4ff78cfc..ece1184d8f 100644 --- a/lib/std/Build/Step/InstallDir.zig +++ b/lib/std/Build/Step/InstallDir.zig @@ -74,31 +74,23 @@ fn make(step: *Step, options: Step.MakeOptions) !void { var all_cached = true; next_entry: while (try it.next()) |entry| { for (install_dir.options.exclude_extensions) |ext| { - if (mem.endsWith(u8, entry.path, ext)) { - continue :next_entry; - } + if (mem.endsWith(u8, entry.path, ext)) continue :next_entry; } if (install_dir.options.include_extensions) |incs| { - var found = false; for (incs) |inc| { - if (mem.endsWith(u8, entry.path, inc)) { - found = true; - break; - } + if (mem.endsWith(u8, entry.path, inc)) break; + } else { + continue :next_entry; } - if (!found) continue :next_entry; } - // relative to src build root - const src_sub_path = try src_dir_path.join(arena, entry.path); + const src_path = try install_dir.options.source_dir.join(b.allocator, entry.path); const dest_path = b.pathJoin(&.{ dest_prefix, entry.path }); - const cwd = fs.cwd(); - switch (entry.kind) { .directory => { - if (need_derived_inputs) try step.addDirectoryWatchInputFromPath(src_sub_path); - try cwd.makePath(dest_path); - // TODO: set result_cached=false if the directory did not already exist. + if (need_derived_inputs) _ = try step.addDirectoryWatchInput(src_path); + const p = try step.installDir(dest_path); + all_cached = all_cached and p == .existed; }, .file => { for (install_dir.options.blank_extensions) |ext| { @@ -108,18 +100,8 @@ fn make(step: *Step, options: Step.MakeOptions) !void { } } - const prev_status = fs.Dir.updateFile( - src_sub_path.root_dir.handle, - src_sub_path.sub_path, - cwd, - dest_path, - .{}, - ) catch |err| { - return step.fail("unable to update file from '{}' to '{s}': {s}", .{ - src_sub_path, dest_path, @errorName(err), - }); - }; - all_cached = all_cached and prev_status == .fresh; + const p = try step.installFile(src_path, dest_path); + all_cached = all_cached and p == .fresh; }, else => continue, } |
