commit 5a4b5b549b606bdad026b977fd3fa669b6f7070d (tree)
parent d707e37ec2e095114a14ce3e4cfc6a04bd0dfd53
Author: Andrew Kelley <andrew@ziglang.org>
Date: Thu, 23 Apr 2026 15:21:16 -0700
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.
Diffstat:
3 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/lib/compiler/Maker/Step/Compile.zig b/lib/compiler/Maker/Step/Compile.zig
@@ -20,6 +20,8 @@ const Maker = @import("../../Maker.zig");
zig_process: ?*Step.ZigProcess = null,
/// Persisted to reuse memory on subsequent calls to `make`.
zig_args: std.ArrayList([]const u8) = .empty,
+/// Populated by InstallArtifact.
+installed_path: ?Path = null,
pub fn make(
compile: *Compile,
diff --git a/lib/compiler/Maker/Step/InstallArtifact.zig b/lib/compiler/Maker/Step/InstallArtifact.zig
@@ -55,6 +55,10 @@ pub fn make(
if (conf_ia.flags.dylib_symlinks)
try maker.installSymLinks(arena, dest_path, compile_step_index, step_index);
+
+ const make_comp_step = maker.stepByIndex(compile_step_index);
+ const make_comp = &make_comp_step.extended.compile;
+ make_comp.installed_path = dest_path;
}
}
diff --git a/lib/compiler/Maker/Step/Run.zig b/lib/compiler/Maker/Step/Run.zig
@@ -132,22 +132,20 @@ pub fn make(
const root_module = producer.root_module.get(conf);
const root_module_target = root_module.resolved_target.get(conf).?.result.get(conf);
const os_tag = root_module_target.flags.os_tag.unwrap().?;
-
- if (true) @panic("TODO");
+ const producer_make_comp_step = maker.stepByIndex(producer_index);
+ const producer_make_comp = &producer_make_comp_step.extended.compile;
if (os_tag == .windows) {
// On Windows we don't have rpaths so we have to add .dll search paths to PATH
addPathForDynLibs(producer_index);
}
- const file_path = producer_index.installed_path orelse producer_index.generated_bin.?.path.?;
+ const file_path = producer_make_comp.installed_path orelse maker.generatedPath(producer.generated_bin.value.?).*;
argv_list.appendAssumeCapacity(try mem.concat(arena, u8, &.{
- prefix,
- try convertPathArg(run_index, maker, .{ .root_dir = .cwd(), .sub_path = file_path }),
- suffix,
+ prefix, try convertPathArg(run_index, maker, file_path), suffix,
}));
- _ = try man.addFile(file_path, null);
+ _ = try man.addFilePath(file_path, null);
},
.output_file, .output_directory => {
const prefix = if (arg.prefix.value) |p| p.slice(conf) else "";