mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
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`.
This commit is contained in:
parent
eb8201afde
commit
cb1d1bdf59
10
build.zig
10
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 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 fmt_exclude_paths = &.{"test/cases"};
|
||||||
const do_fmt = b.addFmt(.{
|
const do_fmt = b.addFmt(.{
|
||||||
.paths = fmt_include_paths,
|
.paths = fmt_include_paths,
|
||||||
.exclude_paths = fmt_exclude_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,
|
.paths = fmt_include_paths,
|
||||||
.exclude_paths = fmt_exclude_paths,
|
.exclude_paths = fmt_exclude_paths,
|
||||||
.check = true,
|
.check = true,
|
||||||
}).step);
|
}).step);
|
||||||
|
test_step.dependOn(check_fmt);
|
||||||
|
|
||||||
const test_cases_step = b.step("test-cases", "Run the main compiler test cases");
|
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, .{
|
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);
|
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 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 opt_mingw_src_path = b.option([]const u8, "mingw-src", "path to mingw-w64 source directory");
|
||||||
const update_mingw_exe = b.addExecutable(.{
|
const update_mingw_exe = b.addExecutable(.{
|
||||||
|
|||||||
@ -49,13 +49,6 @@ unset CXX
|
|||||||
|
|
||||||
ninja install
|
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
|
# simultaneously test building self-hosted without LLVM and with 32-bit arm
|
||||||
stage3-debug/bin/zig build \
|
stage3-debug/bin/zig build \
|
||||||
-Dtarget=arm-linux-musleabihf \
|
-Dtarget=arm-linux-musleabihf \
|
||||||
|
|||||||
@ -49,13 +49,6 @@ unset CXX
|
|||||||
|
|
||||||
ninja install
|
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
|
# simultaneously test building self-hosted without LLVM and with 32-bit arm
|
||||||
stage3-release/bin/zig build \
|
stage3-release/bin/zig build \
|
||||||
-Dtarget=arm-linux-musleabihf \
|
-Dtarget=arm-linux-musleabihf \
|
||||||
|
|||||||
@ -57,13 +57,6 @@ unset CXX
|
|||||||
|
|
||||||
ninja install
|
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
|
# simultaneously test building self-hosted without LLVM and with 32-bit arm
|
||||||
stage3-debug/bin/zig build \
|
stage3-debug/bin/zig build \
|
||||||
-Dtarget=arm-linux-musleabihf \
|
-Dtarget=arm-linux-musleabihf \
|
||||||
|
|||||||
@ -57,14 +57,6 @@ unset CXX
|
|||||||
|
|
||||||
ninja install
|
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
|
# simultaneously test building self-hosted without LLVM and with 32-bit arm
|
||||||
stage3-release/bin/zig build \
|
stage3-release/bin/zig build \
|
||||||
-Dtarget=arm-linux-musleabihf \
|
-Dtarget=arm-linux-musleabihf \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user