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");...@@ -20,6 +20,8 @@ const Maker = @import("../../Maker.zig");
20zig_process: ?*Step.ZigProcess = null,20zig_process: ?*Step.ZigProcess = null,
21/// Persisted to reuse memory on subsequent calls to `make`.21/// Persisted to reuse memory on subsequent calls to `make`.
22zig_args: std.ArrayList([]const u8) = .empty,22zig_args: std.ArrayList([]const u8) = .empty,
23/// Populated by InstallArtifact.
24installed_path: ?Path = null,
2325
24pub fn make(26pub fn make(
25 compile: *Compile,27 compile: *Compile,
lib/compiler/Maker/Step/InstallArtifact.zig+4
...@@ -55,6 +55,10 @@ pub fn make(...@@ -55,6 +55,10 @@ pub fn make(
5555
56 if (conf_ia.flags.dylib_symlinks)56 if (conf_ia.flags.dylib_symlinks)
57 try maker.installSymLinks(arena, dest_path, compile_step_index, step_index);57 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;
58 }62 }
59 }63 }
6064
lib/compiler/Maker/Step/Run.zig+5-7
...@@ -132,22 +132,20 @@ pub fn make(...@@ -132,22 +132,20 @@ pub fn make(
132 const root_module = producer.root_module.get(conf);132 const root_module = producer.root_module.get(conf);
133 const root_module_target = root_module.resolved_target.get(conf).?.result.get(conf);133 const root_module_target = root_module.resolved_target.get(conf).?.result.get(conf);
134 const os_tag = root_module_target.flags.os_tag.unwrap().?;134 const os_tag = root_module_target.flags.os_tag.unwrap().?;
135135 const producer_make_comp_step = maker.stepByIndex(producer_index);
136 if (true) @panic("TODO");136 const producer_make_comp = &producer_make_comp_step.extended.compile;
137137
138 if (os_tag == .windows) {138 if (os_tag == .windows) {
139 // On Windows we don't have rpaths so we have to add .dll search paths to PATH139 // On Windows we don't have rpaths so we have to add .dll search paths to PATH
140 addPathForDynLibs(producer_index);140 addPathForDynLibs(producer_index);
141 }141 }
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
144 argv_list.appendAssumeCapacity(try mem.concat(arena, u8, &.{144 argv_list.appendAssumeCapacity(try mem.concat(arena, u8, &.{
145 prefix,145 prefix, try convertPathArg(run_index, maker, file_path), suffix,
146 try convertPathArg(run_index, maker, .{ .root_dir = .cwd(), .sub_path = file_path }),
147 suffix,
148 }));146 }));
149147
150 _ = try man.addFile(file_path, null);148 _ = try man.addFilePath(file_path, null);
151 },149 },
152 .output_file, .output_directory => {150 .output_file, .output_directory => {
153 const prefix = if (arg.prefix.value) |p| p.slice(conf) else "";151 const prefix = if (arg.prefix.value) |p| p.slice(conf) else "";