mirror of
https://github.com/ziglang/zig.git
synced 2024-11-16 17:15:37 +00:00
d29871977f
We already have a LICENSE file that covers the Zig Standard Library. We no longer need to remind everyone that the license is MIT in every single file. Previously this was introduced to clarify the situation for a fork of Zig that made Zig's LICENSE file harder to find, and replaced it with their own license that required annual payments to their company. However that fork now appears to be dead. So there is no need to reinforce the copyright notice in every single file.
38 lines
962 B
Zig
38 lines
962 B
Zig
const std = @import("../std.zig");
|
|
const build = @import("../build.zig");
|
|
const Step = build.Step;
|
|
const Builder = build.Builder;
|
|
const BufMap = std.BufMap;
|
|
const mem = std.mem;
|
|
|
|
const FmtStep = @This();
|
|
|
|
pub const base_id = .fmt;
|
|
|
|
step: Step,
|
|
builder: *Builder,
|
|
argv: [][]const u8,
|
|
|
|
pub fn create(builder: *Builder, paths: []const []const u8) *FmtStep {
|
|
const self = builder.allocator.create(FmtStep) catch unreachable;
|
|
const name = "zig fmt";
|
|
self.* = FmtStep{
|
|
.step = Step.init(.fmt, name, builder.allocator, make),
|
|
.builder = builder,
|
|
.argv = builder.allocator.alloc([]u8, paths.len + 2) catch unreachable,
|
|
};
|
|
|
|
self.argv[0] = builder.zig_exe;
|
|
self.argv[1] = "fmt";
|
|
for (paths) |path, i| {
|
|
self.argv[2 + i] = builder.pathFromRoot(path);
|
|
}
|
|
return self;
|
|
}
|
|
|
|
fn make(step: *Step) !void {
|
|
const self = @fieldParentPtr(FmtStep, "step", step);
|
|
|
|
return self.builder.spawnChild(self.argv);
|
|
}
|