Commit 4563f6b424
Changed files (3)
std/build.zig
@@ -15,6 +15,8 @@ const BufSet = std.BufSet;
const BufMap = std.BufMap;
const fmt_lib = std.fmt;
+pub const FmtStep = @import("build/fmt.zig").FmtStep;
+
pub const Builder = struct {
uninstall_tls: TopLevelStep,
install_tls: TopLevelStep,
@@ -205,6 +207,10 @@ pub const Builder = struct {
return remove_dir_step;
}
+ pub fn addFmt(self: *Builder, paths: []const []const u8) *FmtStep {
+ return FmtStep.create(self, paths);
+ }
+
pub fn version(self: *const Builder, major: u32, minor: u32, patch: u32) Version {
return Version{
.major = major,
build.zig
@@ -55,6 +55,8 @@ pub fn build(b: *Builder) !void {
var test_stage2 = b.addTest("src-self-hosted/test.zig");
test_stage2.setBuildMode(builtin.Mode.Debug);
+ const fmt_build_zig = b.addFmt([][]const u8{"build.zig"});
+
var exe = b.addExecutable("zig", "src-self-hosted/main.zig");
exe.setBuildMode(mode);
@@ -106,6 +108,11 @@ pub fn build(b: *Builder) !void {
}
const modes = chosen_modes[0..chosen_mode_index];
+ // run stage1 `zig fmt` on this build.zig file just to make sure it works
+ test_step.dependOn(&fmt_build_zig.step);
+ const fmt_step = b.step("test-fmt", "Run zig fmt against build.zig to make sure it works");
+ fmt_step.dependOn(&fmt_build_zig.step);
+
test_step.dependOn(tests.addPkgTests(b, test_filter, "test/stage1/behavior.zig", "behavior", "Run the behavior tests", modes));
test_step.dependOn(tests.addPkgTests(b, test_filter, "std/index.zig", "std", "Run the standard library tests", modes));
CMakeLists.txt
@@ -448,6 +448,7 @@ set(ZIG_STD_FILES
"buf_set.zig"
"buffer.zig"
"build.zig"
+ "build/fmt.zig"
"c/darwin.zig"
"c/freebsd.zig"
"c/index.zig"