aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Build/LogStep.zig
blob: 6d51df8cbd47bb122e0b6b18665dc7c3d2b09e8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const std = @import("../std.zig");
const log = std.log;
const Step = std.Build.Step;
const LogStep = @This();

pub const base_id = .log;

step: Step,
builder: *std.Build,
data: []const u8,

pub fn init(builder: *std.Build, data: []const u8) LogStep {
    return LogStep{
        .builder = builder,
        .step = Step.init(.log, builder.fmt("log {s}", .{data}), builder.allocator, make),
        .data = builder.dupe(data),
    };
}

fn make(step: *Step) anyerror!void {
    const self = @fieldParentPtr(LogStep, "step", step);
    log.info("{s}", .{self.data});
}