From 3b069907305497af5ef6cdb1d6adddd05636aa51 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 7 Mar 2023 00:40:32 -0700 Subject: [PATCH] std.Build.CompileStep: tweak the default step name --- lib/std/Build/CompileStep.zig | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/std/Build/CompileStep.zig b/lib/std/Build/CompileStep.zig index df9abfbc6d..9b9fc02e74 100644 --- a/lib/std/Build/CompileStep.zig +++ b/lib/std/Build/CompileStep.zig @@ -310,8 +310,20 @@ pub fn create(owner: *std.Build, options: Options) *CompileStep { panic("invalid name: '{s}'. It looks like a file path, but it is supposed to be the library or application name.", .{name}); } - const step_name = owner.fmt("compile {s} {s} {s}", .{ - name, + // Avoid the common case of the step name looking like "zig test test". + const name_adjusted = if (options.kind == .@"test" and mem.eql(u8, name, "test")) + "" + else + owner.fmt("{s} ", .{name}); + + const step_name = owner.fmt("{s} {s}{s} {s}", .{ + switch (options.kind) { + .exe => "zig build-exe", + .lib => "zig build-lib", + .obj => "zig build-obj", + .test_exe, .@"test" => "zig test", + }, + name_adjusted, @tagName(options.optimize), options.target.zigTriple(owner.allocator) catch @panic("OOM"), });