authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-06-16 19:31:59-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-06-16 19:31:59-07:00
logcb1d1bdf59f2979de9c534c21813d824f9736cfb
tree86a1052e839111dae378a7dfc61d620f8f04f00c
parenteb8201afde98d9ba35d0c8488d418b1b0bef4f35

make `zig build test` check for conforming formatting

There was already `zig build test-fmt` but now `zig build test` depends on that one. The CI scripts no longer need explicit logic since they already do `zig build test`.

5 files changed, 5 insertions(+), 34 deletions(-)

build.zig+5-5
......@@ -428,18 +428,21 @@ pub fn build(b: *std.Build) !void {
428428 }
429429 const optimization_modes = chosen_opt_modes_buf[0..chosen_mode_index];
430430
431 const fmt_include_paths = &.{ "doc", "lib", "src", "test", "tools", "build.zig" };
431 const fmt_include_paths = &.{ "lib", "src", "test", "tools", "build.zig", "build.zig.zon" };
432432 const fmt_exclude_paths = &.{"test/cases"};
433433 const do_fmt = b.addFmt(.{
434434 .paths = fmt_include_paths,
435435 .exclude_paths = fmt_exclude_paths,
436436 });
437 b.step("fmt", "Modify source files in place to have conforming formatting").dependOn(&do_fmt.step);
437438
438 b.step("test-fmt", "Check source files having conforming formatting").dependOn(&b.addFmt(.{
439 const check_fmt = b.step("test-fmt", "Check source files having conforming formatting");
440 check_fmt.dependOn(&b.addFmt(.{
439441 .paths = fmt_include_paths,
440442 .exclude_paths = fmt_exclude_paths,
441443 .check = true,
442444 }).step);
445 test_step.dependOn(check_fmt);
443446
444447 const test_cases_step = b.step("test-cases", "Run the main compiler test cases");
445448 try tests.addCases(b, test_cases_step, test_filters, check_case_exe, target, .{
......@@ -534,9 +537,6 @@ pub fn build(b: *std.Build) !void {
534537
535538 try addWasiUpdateStep(b, version);
536539
537 b.step("fmt", "Modify source files in place to have conforming formatting")
538 .dependOn(&do_fmt.step);
539
540540 const update_mingw_step = b.step("update-mingw", "Update zig's bundled mingw");
541541 const opt_mingw_src_path = b.option([]const u8, "mingw-src", "path to mingw-w64 source directory");
542542 const update_mingw_exe = b.addExecutable(.{
ci/aarch64-linux-debug.sh-7
......@@ -49,13 +49,6 @@ unset CXX
4949
5050ninja install
5151
52# TODO: move this to a build.zig step (check-fmt)
53echo "Looking for non-conforming code formatting..."
54stage3-debug/bin/zig fmt --check .. \
55 --exclude ../test/cases/ \
56 --exclude ../doc/ \
57 --exclude ../build-debug
58
5952# simultaneously test building self-hosted without LLVM and with 32-bit arm
6053stage3-debug/bin/zig build \
6154 -Dtarget=arm-linux-musleabihf \
ci/aarch64-linux-release.sh-7
......@@ -49,13 +49,6 @@ unset CXX
4949
5050ninja install
5151
52# TODO: move this to a build.zig step (check-fmt)
53echo "Looking for non-conforming code formatting..."
54stage3-release/bin/zig fmt --check .. \
55 --exclude ../test/cases/ \
56 --exclude ../doc/ \
57 --exclude ../build-release
58
5952# simultaneously test building self-hosted without LLVM and with 32-bit arm
6053stage3-release/bin/zig build \
6154 -Dtarget=arm-linux-musleabihf \
ci/x86_64-linux-debug.sh-7
......@@ -57,13 +57,6 @@ unset CXX
5757
5858ninja install
5959
60# TODO: move this to a build.zig step (check-fmt)
61echo "Looking for non-conforming code formatting..."
62stage3-debug/bin/zig fmt --check .. \
63 --exclude ../test/cases/ \
64 --exclude ../doc/ \
65 --exclude ../build-debug
66
6760# simultaneously test building self-hosted without LLVM and with 32-bit arm
6861stage3-debug/bin/zig build \
6962 -Dtarget=arm-linux-musleabihf \
ci/x86_64-linux-release.sh-8
......@@ -57,14 +57,6 @@ unset CXX
5757
5858ninja install
5959
60# TODO: move this to a build.zig step (check-fmt)
61echo "Looking for non-conforming code formatting..."
62stage3-release/bin/zig fmt --check .. \
63 --exclude ../test/cases/ \
64 --exclude ../doc/ \
65 --exclude ../build-debug \
66 --exclude ../build-release
67
6860# simultaneously test building self-hosted without LLVM and with 32-bit arm
6961stage3-release/bin/zig build \
7062 -Dtarget=arm-linux-musleabihf \