mirror of
https://github.com/ziglang/zig.git
synced 2024-11-26 15:12:31 +00:00
fix .gitignore file and add commit missing std lib file
This commit is contained in:
parent
4563f6b424
commit
1d7e5479b0
6
.gitignore
vendored
6
.gitignore
vendored
@ -10,6 +10,6 @@
|
||||
# -andrewrk
|
||||
|
||||
zig-cache/
|
||||
build/
|
||||
build-*/
|
||||
docgen_tmp/
|
||||
/build/
|
||||
/build-*/
|
||||
/docgen_tmp/
|
||||
|
35
std/build/fmt.zig
Normal file
35
std/build/fmt.zig
Normal file
@ -0,0 +1,35 @@
|
||||
const std = @import("../index.zig");
|
||||
const build = @import("../build.zig");
|
||||
const Step = build.Step;
|
||||
const Builder = build.Builder;
|
||||
const BufMap = std.BufMap;
|
||||
const mem = std.mem;
|
||||
|
||||
pub const FmtStep = struct {
|
||||
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(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);
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user