From 7fa49fc283b3452ffd203c8a9ce9c2f6973369c0 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 29 Apr 2026 15:53:30 -0700 Subject: [PATCH] maker: add the --listen and --seed args back to run --- BRANCH_TODO | 1 - lib/compiler/Maker/Step/Run.zig | 7 +++++++ lib/std/Build.zig | 13 ++++++++----- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/BRANCH_TODO b/BRANCH_TODO index 66c225ddad..5fece6c3c7 100644 --- a/BRANCH_TODO +++ b/BRANCH_TODO @@ -2,7 +2,6 @@ * make addExtra return Index using reflection * remove Cache from configurer * implement the build options -* don't forget to add -listen arg back * get zig init template working * finish migrating the rest of the build steps * make zig-pkg path root configurable in maker (make sure --system still works) diff --git a/lib/compiler/Maker/Step/Run.zig b/lib/compiler/Maker/Step/Run.zig index 53d9c8cdb4..d3fe6f48ed 100644 --- a/lib/compiler/Maker/Step/Run.zig +++ b/lib/compiler/Maker/Step/Run.zig @@ -183,6 +183,13 @@ pub fn make( } } + man.hash.add(conf_run.flags.test_runner_mode); + if (conf_run.flags.test_runner_mode) { + try argv_list.ensureUnusedCapacity(gpa, 2); + argv_list.appendAssumeCapacity(try allocPrint(arena, "--seed=0x{x}", .{graph.random_seed})); + argv_list.appendAssumeCapacity("--listen=-"); + } + switch (conf_run.stdin.u) { .bytes => |bytes| { man.hash.addBytes(bytes.slice(conf)); diff --git a/lib/std/Build.zig b/lib/std/Build.zig index 4e958a47fa..774d7563d2 100644 --- a/lib/std/Build.zig +++ b/lib/std/Build.zig @@ -796,16 +796,19 @@ pub fn addSystemCommand(b: *Build, argv: []const []const u8) *Step.Run { /// Creates a `Step.Run` with an executable built with `addExecutable`. /// Add command line arguments with methods of `Step.Run`. +/// +/// It doesn't have to target the host. In some cases cross-compiled binaries +/// can even be executed. +/// +/// This is declarative; it constructs a build step that may or may not be run +/// depending on the options provided by the user to the build command. pub fn addRunArtifact(b: *Build, exe: *Step.Compile) *Step.Run { - // It doesn't have to be native. We catch that if you actually try to run it. - // Consider that this is declarative; the run step may not be run unless a user - // option is supplied. // Avoid the common case of the step name looking like "run test test". const step_name = if (exe.kind.isTest() and mem.eql(u8, exe.name, "test")) - b.fmt("run {s}", .{@tagName(exe.kind)}) + b.fmt("run {t}", .{exe.kind}) else - b.fmt("run {s} {s}", .{ @tagName(exe.kind), exe.name }); + b.fmt("run {t} {s}", .{ exe.kind, exe.name }); const run_step = Step.Run.create(b, step_name); run_step.producer = exe;