authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-04-23 15:21:16-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-05-25 18:54:34-07:00
log5a4b5b549b606bdad026b977fd3fa669b6f7070d
treeed1246d12e51c178e57163b882dce9069479546f
parentd707e37ec2e095114a14ce3e4cfc6a04bd0dfd53

maker: restore Step.Run logic for adding artifact arg

When an artifact arg is added to a Run step, if the artifact is installed, then the installation path is added rather than the cache artifact path. This is probably something that should change in the future, but the goal of this branch is to generally avoid breakage other than that caused by phase separation.

3 files changed, 11 insertions(+), 7 deletions(-)

lib/compiler/Maker/Step/Compile.zig+2
......@@ -20,6 +20,8 @@ const Maker = @import("../../Maker.zig");
2020zig_process: ?*Step.ZigProcess = null,
2121/// Persisted to reuse memory on subsequent calls to `make`.
2222zig_args: std.ArrayList([]const u8) = .empty,
23/// Populated by InstallArtifact.
24installed_path: ?Path = null,
2325
2426pub fn make(
2527 compile: *Compile,
lib/compiler/Maker/Step/InstallArtifact.zig+4
......@@ -55,6 +55,10 @@ pub fn make(
5555
5656 if (conf_ia.flags.dylib_symlinks)
5757 try maker.installSymLinks(arena, dest_path, compile_step_index, step_index);
58
59 const make_comp_step = maker.stepByIndex(compile_step_index);
60 const make_comp = &make_comp_step.extended.compile;
61 make_comp.installed_path = dest_path;
5862 }
5963 }
6064
lib/compiler/Maker/Step/Run.zig+5-7
......@@ -132,22 +132,20 @@ pub fn make(
132132 const root_module = producer.root_module.get(conf);
133133 const root_module_target = root_module.resolved_target.get(conf).?.result.get(conf);
134134 const os_tag = root_module_target.flags.os_tag.unwrap().?;
135
136 if (true) @panic("TODO");
135 const producer_make_comp_step = maker.stepByIndex(producer_index);
136 const producer_make_comp = &producer_make_comp_step.extended.compile;
137137
138138 if (os_tag == .windows) {
139139 // On Windows we don't have rpaths so we have to add .dll search paths to PATH
140140 addPathForDynLibs(producer_index);
141141 }
142 const file_path = producer_index.installed_path orelse producer_index.generated_bin.?.path.?;
142 const file_path = producer_make_comp.installed_path orelse maker.generatedPath(producer.generated_bin.value.?).*;
143143
144144 argv_list.appendAssumeCapacity(try mem.concat(arena, u8, &.{
145 prefix,
146 try convertPathArg(run_index, maker, .{ .root_dir = .cwd(), .sub_path = file_path }),
147 suffix,
145 prefix, try convertPathArg(run_index, maker, file_path), suffix,
148146 }));
149147
150 _ = try man.addFile(file_path, null);
148 _ = try man.addFilePath(file_path, null);
151149 },
152150 .output_file, .output_directory => {
153151 const prefix = if (arg.prefix.value) |p| p.slice(conf) else "";