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 {
24412441 Run,
24422442 CheckFile,
24432443 InstallRaw,
2444 Custom,
24442445 };
24452446
24462447 pub fn init(id: Id, name: []const u8, allocator: *Allocator, makeFn: fn (*Step) anyerror!void) Step {
......@@ -2479,7 +2480,9 @@ pub const Step = struct {
24792480
24802481 fn typeToId(comptime T: type) Id {
24812482 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
24832486 if (T == @field(ThisModule, f.name ++ "Step")) {
24842487 return @field(Id, f.name);
24852488 }
test/tests.zig+3-3
......@@ -609,7 +609,7 @@ pub const StackTracesContext = struct {
609609 const allocator = context.b.allocator;
610610 const ptr = allocator.create(RunAndCompareStep) catch unreachable;
611611 ptr.* = RunAndCompareStep{
612 .step = build.Step.init("StackTraceCompareOutputStep", allocator, make),
612 .step = build.Step.init(.Custom, "StackTraceCompareOutputStep", allocator, make),
613613 .context = context,
614614 .exe = exe,
615615 .name = name,
......@@ -808,7 +808,7 @@ pub const CompileErrorContext = struct {
808808 const allocator = context.b.allocator;
809809 const ptr = allocator.create(CompileCmpOutputStep) catch unreachable;
810810 ptr.* = CompileCmpOutputStep{
811 .step = build.Step.init("CompileCmpOutput", allocator, make),
811 .step = build.Step.init(.Custom, "CompileCmpOutput", allocator, make),
812812 .context = context,
813813 .name = name,
814814 .test_index = context.test_index,
......@@ -1156,7 +1156,7 @@ pub const GenHContext = struct {
11561156 const allocator = context.b.allocator;
11571157 const ptr = allocator.create(GenHCmpOutputStep) catch unreachable;
11581158 ptr.* = GenHCmpOutputStep{
1159 .step = build.Step.init("ParseCCmpOutput", allocator, make),
1159 .step = build.Step.init(.Custom, "ParseCCmpOutput", allocator, make),
11601160 .context = context,
11611161 .obj = obj,
11621162 .name = name,