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 {...@@ -428,18 +428,21 @@ pub fn build(b: *std.Build) !void {
428 }428 }
429 const optimization_modes = chosen_opt_modes_buf[0..chosen_mode_index];429 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" };
432 const fmt_exclude_paths = &.{"test/cases"};432 const fmt_exclude_paths = &.{"test/cases"};
433 const do_fmt = b.addFmt(.{433 const do_fmt = b.addFmt(.{
434 .paths = fmt_include_paths,434 .paths = fmt_include_paths,
435 .exclude_paths = fmt_exclude_paths,435 .exclude_paths = fmt_exclude_paths,
436 });436 });
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(.{
439 .paths = fmt_include_paths,441 .paths = fmt_include_paths,
440 .exclude_paths = fmt_exclude_paths,442 .exclude_paths = fmt_exclude_paths,
441 .check = true,443 .check = true,
442 }).step);444 }).step);
445 test_step.dependOn(check_fmt);
443446
444 const test_cases_step = b.step("test-cases", "Run the main compiler test cases");447 const test_cases_step = b.step("test-cases", "Run the main compiler test cases");
445 try tests.addCases(b, test_cases_step, test_filters, check_case_exe, target, .{448 try tests.addCases(b, test_cases_step, test_filters, check_case_exe, target, .{
...@@ -534,9 +537,6 @@ pub fn build(b: *std.Build) !void {...@@ -534,9 +537,6 @@ pub fn build(b: *std.Build) !void {
534537
535 try addWasiUpdateStep(b, version);538 try addWasiUpdateStep(b, version);
536539
537 b.step("fmt", "Modify source files in place to have conforming formatting")
538 .dependOn(&do_fmt.step);
539
540 const update_mingw_step = b.step("update-mingw", "Update zig's bundled mingw");540 const update_mingw_step = b.step("update-mingw", "Update zig's bundled mingw");
541 const opt_mingw_src_path = b.option([]const u8, "mingw-src", "path to mingw-w64 source directory");541 const opt_mingw_src_path = b.option([]const u8, "mingw-src", "path to mingw-w64 source directory");
542 const update_mingw_exe = b.addExecutable(.{542 const update_mingw_exe = b.addExecutable(.{
ci/aarch64-linux-debug.sh-7
...@@ -49,13 +49,6 @@ unset CXX...@@ -49,13 +49,6 @@ unset CXX
4949
50ninja install50ninja 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
59# simultaneously test building self-hosted without LLVM and with 32-bit arm52# simultaneously test building self-hosted without LLVM and with 32-bit arm
60stage3-debug/bin/zig build \53stage3-debug/bin/zig build \
61 -Dtarget=arm-linux-musleabihf \54 -Dtarget=arm-linux-musleabihf \
ci/aarch64-linux-release.sh-7
...@@ -49,13 +49,6 @@ unset CXX...@@ -49,13 +49,6 @@ unset CXX
4949
50ninja install50ninja 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
59# simultaneously test building self-hosted without LLVM and with 32-bit arm52# simultaneously test building self-hosted without LLVM and with 32-bit arm
60stage3-release/bin/zig build \53stage3-release/bin/zig build \
61 -Dtarget=arm-linux-musleabihf \54 -Dtarget=arm-linux-musleabihf \
ci/x86_64-linux-debug.sh-7
...@@ -57,13 +57,6 @@ unset CXX...@@ -57,13 +57,6 @@ unset CXX
5757
58ninja install58ninja 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
67# simultaneously test building self-hosted without LLVM and with 32-bit arm60# simultaneously test building self-hosted without LLVM and with 32-bit arm
68stage3-debug/bin/zig build \61stage3-debug/bin/zig build \
69 -Dtarget=arm-linux-musleabihf \62 -Dtarget=arm-linux-musleabihf \
ci/x86_64-linux-release.sh-8
...@@ -57,14 +57,6 @@ unset CXX...@@ -57,14 +57,6 @@ unset CXX
5757
58ninja install58ninja 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
68# simultaneously test building self-hosted without LLVM and with 32-bit arm60# simultaneously test building self-hosted without LLVM and with 32-bit arm
69stage3-release/bin/zig build \61stage3-release/bin/zig build \
70 -Dtarget=arm-linux-musleabihf \62 -Dtarget=arm-linux-musleabihf \