authorgravatar for alex_naskos@hotmail.comAlexandros Naskos <alex_naskos@hotmail.com> 2020-05-25 11:36:12+03:00
committergravatar for alex_naskos@hotmail.comAlexandros Naskos <alex_naskos@hotmail.com> 2020-05-25 11:36:12+03:00
log65d827183bd521cd402826382541d8b16d7718bb
tree1d92c4a61ab5733cebf4bf9a3325be14e6a0b0fc
parentd268e0cf2e3cd152017a165ca80085a5823c45a2

Added custom build step id, made tests.zig steps use it


2 files changed, 7 insertions(+), 4 deletions(-)

lib/std/build.zig+4-1
...@@ -2441,6 +2441,7 @@ pub const Step = struct {...@@ -2441,6 +2441,7 @@ pub const Step = struct {
2441 Run,2441 Run,
2442 CheckFile,2442 CheckFile,
2443 InstallRaw,2443 InstallRaw,
2444 Custom,
2444 };2445 };
24452446
2446 pub fn init(id: Id, name: []const u8, allocator: *Allocator, makeFn: fn (*Step) anyerror!void) Step {2447 pub fn init(id: Id, name: []const u8, allocator: *Allocator, makeFn: fn (*Step) anyerror!void) Step {
...@@ -2479,7 +2480,9 @@ pub const Step = struct {...@@ -2479,7 +2480,9 @@ pub const Step = struct {
24792480
2480 fn typeToId(comptime T: type) Id {2481 fn typeToId(comptime T: type) Id {
2481 inline for (@typeInfo(Id).Enum.fields) |f| {2482 inline for (@typeInfo(Id).Enum.fields) |f| {
2482 if (std.mem.eql(u8, f.name, "TopLevel")) continue;2483 if (std.mem.eql(u8, f.name, "TopLevel") or
2484 std.mem.eql(u8, f.name, "Custom")) continue;
2485
2483 if (T == @field(ThisModule, f.name ++ "Step")) {2486 if (T == @field(ThisModule, f.name ++ "Step")) {
2484 return @field(Id, f.name);2487 return @field(Id, f.name);
2485 }2488 }
test/tests.zig+3-3
...@@ -609,7 +609,7 @@ pub const StackTracesContext = struct {...@@ -609,7 +609,7 @@ pub const StackTracesContext = struct {
609 const allocator = context.b.allocator;609 const allocator = context.b.allocator;
610 const ptr = allocator.create(RunAndCompareStep) catch unreachable;610 const ptr = allocator.create(RunAndCompareStep) catch unreachable;
611 ptr.* = RunAndCompareStep{611 ptr.* = RunAndCompareStep{
612 .step = build.Step.init("StackTraceCompareOutputStep", allocator, make),612 .step = build.Step.init(.Custom, "StackTraceCompareOutputStep", allocator, make),
613 .context = context,613 .context = context,
614 .exe = exe,614 .exe = exe,
615 .name = name,615 .name = name,
...@@ -808,7 +808,7 @@ pub const CompileErrorContext = struct {...@@ -808,7 +808,7 @@ pub const CompileErrorContext = struct {
808 const allocator = context.b.allocator;808 const allocator = context.b.allocator;
809 const ptr = allocator.create(CompileCmpOutputStep) catch unreachable;809 const ptr = allocator.create(CompileCmpOutputStep) catch unreachable;
810 ptr.* = CompileCmpOutputStep{810 ptr.* = CompileCmpOutputStep{
811 .step = build.Step.init("CompileCmpOutput", allocator, make),811 .step = build.Step.init(.Custom, "CompileCmpOutput", allocator, make),
812 .context = context,812 .context = context,
813 .name = name,813 .name = name,
814 .test_index = context.test_index,814 .test_index = context.test_index,
...@@ -1156,7 +1156,7 @@ pub const GenHContext = struct {...@@ -1156,7 +1156,7 @@ pub const GenHContext = struct {
1156 const allocator = context.b.allocator;1156 const allocator = context.b.allocator;
1157 const ptr = allocator.create(GenHCmpOutputStep) catch unreachable;1157 const ptr = allocator.create(GenHCmpOutputStep) catch unreachable;
1158 ptr.* = GenHCmpOutputStep{1158 ptr.* = GenHCmpOutputStep{
1159 .step = build.Step.init("ParseCCmpOutput", allocator, make),1159 .step = build.Step.init(.Custom, "ParseCCmpOutput", allocator, make),
1160 .context = context,1160 .context = context,
1161 .obj = obj,1161 .obj = obj,
1162 .name = name,1162 .name = name,