Commit 65d827183b

Alexandros Naskos <alex_naskos@hotmail.com>
2020-05-25 10:36:12
Added custom build step id, made tests.zig steps use it
1 parent d268e0c
Changed files (2)
lib
test
lib/std/build.zig
@@ -2441,6 +2441,7 @@ pub const Step = struct {
         Run,
         CheckFile,
         InstallRaw,
+        Custom,
     };
 
     pub fn init(id: Id, name: []const u8, allocator: *Allocator, makeFn: fn (*Step) anyerror!void) Step {
@@ -2479,7 +2480,9 @@ pub const Step = struct {
 
     fn typeToId(comptime T: type) Id {
         inline for (@typeInfo(Id).Enum.fields) |f| {
-            if (std.mem.eql(u8, f.name, "TopLevel")) continue;
+            if (std.mem.eql(u8, f.name, "TopLevel") or
+                std.mem.eql(u8, f.name, "Custom")) continue;
+
             if (T == @field(ThisModule, f.name ++ "Step")) {
                 return @field(Id, f.name);
             }
test/tests.zig
@@ -609,7 +609,7 @@ pub const StackTracesContext = struct {
             const allocator = context.b.allocator;
             const ptr = allocator.create(RunAndCompareStep) catch unreachable;
             ptr.* = RunAndCompareStep{
-                .step = build.Step.init("StackTraceCompareOutputStep", allocator, make),
+                .step = build.Step.init(.Custom, "StackTraceCompareOutputStep", allocator, make),
                 .context = context,
                 .exe = exe,
                 .name = name,
@@ -808,7 +808,7 @@ pub const CompileErrorContext = struct {
             const allocator = context.b.allocator;
             const ptr = allocator.create(CompileCmpOutputStep) catch unreachable;
             ptr.* = CompileCmpOutputStep{
-                .step = build.Step.init("CompileCmpOutput", allocator, make),
+                .step = build.Step.init(.Custom, "CompileCmpOutput", allocator, make),
                 .context = context,
                 .name = name,
                 .test_index = context.test_index,
@@ -1156,7 +1156,7 @@ pub const GenHContext = struct {
             const allocator = context.b.allocator;
             const ptr = allocator.create(GenHCmpOutputStep) catch unreachable;
             ptr.* = GenHCmpOutputStep{
-                .step = build.Step.init("ParseCCmpOutput", allocator, make),
+                .step = build.Step.init(.Custom, "ParseCCmpOutput", allocator, make),
                 .context = context,
                 .obj = obj,
                 .name = name,