zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit cb1d1bdf59f2979de9c534c21813d824f9736cfb (tree)
parent eb8201afde98d9ba35d0c8488d418b1b0bef4f35
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Sun, 16 Jun 2024 19:31:59 -0700

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`.

Diffstat:
Mbuild.zig | 10+++++-----
Mci/aarch64-linux-debug.sh | 7-------
Mci/aarch64-linux-release.sh | 7-------
Mci/x86_64-linux-debug.sh | 7-------
Mci/x86_64-linux-release.sh | 8--------
5 files changed, 5 insertions(+), 34 deletions(-)

diff --git a/build.zig b/build.zig @@ -428,18 +428,21 @@ pub fn build(b: *std.Build) !void { } const optimization_modes = chosen_opt_modes_buf[0..chosen_mode_index]; - const fmt_include_paths = &.{ "doc", "lib", "src", "test", "tools", "build.zig" }; + const fmt_include_paths = &.{ "lib", "src", "test", "tools", "build.zig", "build.zig.zon" }; const fmt_exclude_paths = &.{"test/cases"}; const do_fmt = b.addFmt(.{ .paths = fmt_include_paths, .exclude_paths = fmt_exclude_paths, }); + b.step("fmt", "Modify source files in place to have conforming formatting").dependOn(&do_fmt.step); - b.step("test-fmt", "Check source files having conforming formatting").dependOn(&b.addFmt(.{ + const check_fmt = b.step("test-fmt", "Check source files having conforming formatting"); + check_fmt.dependOn(&b.addFmt(.{ .paths = fmt_include_paths, .exclude_paths = fmt_exclude_paths, .check = true, }).step); + test_step.dependOn(check_fmt); const test_cases_step = b.step("test-cases", "Run the main compiler test cases"); try tests.addCases(b, test_cases_step, test_filters, check_case_exe, target, .{ @@ -534,9 +537,6 @@ pub fn build(b: *std.Build) !void { try addWasiUpdateStep(b, version); - b.step("fmt", "Modify source files in place to have conforming formatting") - .dependOn(&do_fmt.step); - const update_mingw_step = b.step("update-mingw", "Update zig's bundled mingw"); const opt_mingw_src_path = b.option([]const u8, "mingw-src", "path to mingw-w64 source directory"); const update_mingw_exe = b.addExecutable(.{ diff --git a/ci/aarch64-linux-debug.sh b/ci/aarch64-linux-debug.sh @@ -49,13 +49,6 @@ unset CXX ninja install -# TODO: move this to a build.zig step (check-fmt) -echo "Looking for non-conforming code formatting..." -stage3-debug/bin/zig fmt --check .. \ - --exclude ../test/cases/ \ - --exclude ../doc/ \ - --exclude ../build-debug - # simultaneously test building self-hosted without LLVM and with 32-bit arm stage3-debug/bin/zig build \ -Dtarget=arm-linux-musleabihf \ diff --git a/ci/aarch64-linux-release.sh b/ci/aarch64-linux-release.sh @@ -49,13 +49,6 @@ unset CXX ninja install -# TODO: move this to a build.zig step (check-fmt) -echo "Looking for non-conforming code formatting..." -stage3-release/bin/zig fmt --check .. \ - --exclude ../test/cases/ \ - --exclude ../doc/ \ - --exclude ../build-release - # simultaneously test building self-hosted without LLVM and with 32-bit arm stage3-release/bin/zig build \ -Dtarget=arm-linux-musleabihf \ diff --git a/ci/x86_64-linux-debug.sh b/ci/x86_64-linux-debug.sh @@ -57,13 +57,6 @@ unset CXX ninja install -# TODO: move this to a build.zig step (check-fmt) -echo "Looking for non-conforming code formatting..." -stage3-debug/bin/zig fmt --check .. \ - --exclude ../test/cases/ \ - --exclude ../doc/ \ - --exclude ../build-debug - # simultaneously test building self-hosted without LLVM and with 32-bit arm stage3-debug/bin/zig build \ -Dtarget=arm-linux-musleabihf \ diff --git a/ci/x86_64-linux-release.sh b/ci/x86_64-linux-release.sh @@ -57,14 +57,6 @@ unset CXX ninja install -# TODO: move this to a build.zig step (check-fmt) -echo "Looking for non-conforming code formatting..." -stage3-release/bin/zig fmt --check .. \ - --exclude ../test/cases/ \ - --exclude ../doc/ \ - --exclude ../build-debug \ - --exclude ../build-release - # simultaneously test building self-hosted without LLVM and with 32-bit arm stage3-release/bin/zig build \ -Dtarget=arm-linux-musleabihf \