From 5a4b5b549b606bdad026b977fd3fa669b6f7070d Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 23 Apr 2026 15:21:16 -0700 Subject: [PATCH] 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. --- lib/compiler/Maker/Step/Compile.zig | 2 ++ lib/compiler/Maker/Step/InstallArtifact.zig | 4 ++++ lib/compiler/Maker/Step/Run.zig | 12 +++++------- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/compiler/Maker/Step/Compile.zig b/lib/compiler/Maker/Step/Compile.zig index 464acf5ba2509192bfa6fd2e3d86592537ae6bc3..d4d370bb80421b6d277ed1b120a059eac118f616 100644 --- 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 index 2d761566484769b91c8fd347a3631ac4ee7e129b..00d787e3eb554724ca42226397d1f260e91dfeff 100644 --- 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 index 4b7644f06bd440f5d6430caf51525e8b84b7ec1a..7f821d94d4b27b40a33f3df070af0dda3bc1a114 100644 --- 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 ""; -- 2.54.0