zig/lib/std/build/LogStep.zig
Andrew Kelley dd547f06c6 std.build: extract steps to separate files
There are intended to be no functional changes in this commit.
2022-12-11 12:48:17 -07:00

26 lines
629 B
Zig

const std = @import("../std.zig");
const log = std.log;
const build = @import("../build.zig");
const Step = build.Step;
const Builder = build.Builder;
const LogStep = @This();
pub const base_id = .log;
step: Step,
builder: *Builder,
data: []const u8,
pub fn init(builder: *Builder, 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});
}