authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-02-26 18:33:27-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-02-26 18:33:27-05:00
log1d7e5479b0826776e53b499811198356bc180706
tree975c70f048deaef4cc33516b559046614c53c07b
parent4563f6b4242957971d619aa23263938fdcb442d3
signaturelock-open Commit is signed but in an unrecognized format.

fix .gitignore file and add commit missing std lib file


2 files changed, 38 insertions(+), 3 deletions(-)

.gitignore+3-3
...@@ -10,6 +10,6 @@...@@ -10,6 +10,6 @@
10# -andrewrk10# -andrewrk
1111
12zig-cache/12zig-cache/
13build/13/build/
14build-*/14/build-*/
15docgen_tmp/15/docgen_tmp/
std/build/fmt.zig created+35
...@@ -0,0 +1,35 @@
1const std = @import("../index.zig");
2const build = @import("../build.zig");
3const Step = build.Step;
4const Builder = build.Builder;
5const BufMap = std.BufMap;
6const mem = std.mem;
7
8pub const FmtStep = struct {
9 step: Step,
10 builder: *Builder,
11 argv: [][]const u8,
12
13 pub fn create(builder: *Builder, paths: []const []const u8) *FmtStep {
14 const self = builder.allocator.create(FmtStep) catch unreachable;
15 const name = "zig fmt";
16 self.* = FmtStep{
17 .step = Step.init(name, builder.allocator, make),
18 .builder = builder,
19 .argv = builder.allocator.alloc([]u8, paths.len + 2) catch unreachable,
20 };
21
22 self.argv[0] = builder.zig_exe;
23 self.argv[1] = "fmt";
24 for (paths) |path, i| {
25 self.argv[2 + i] = builder.pathFromRoot(path);
26 }
27 return self;
28 }
29
30 fn make(step: *Step) !void {
31 const self = @fieldParentPtr(FmtStep, "step", step);
32
33 return self.builder.spawnChild(self.argv);
34 }
35};