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

This commit is contained in:
Alexandros Naskos 2020-05-25 11:36:12 +03:00
parent d268e0cf2e
commit 65d827183b
2 changed files with 7 additions and 4 deletions

View File

@ -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);
}

View File

@ -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,