Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance std.Build.Step.Fmt and use it more #20321

Merged
merged 5 commits into from
Jun 17, 2024
Merged

enhance std.Build.Step.Fmt and use it more #20321

merged 5 commits into from
Jun 17, 2024

Conversation

andrewrk
Copy link
Member

@andrewrk andrewrk commented Jun 17, 2024

Example of a zig fmt failure with this branch:

[nix-shell:~/dev/zig/build-release]$ stage3/bin/zig build test-fmt
test-fmt
└─ zig fmt --check failure
error: /home/andy/dev/zig/src/main.zig: non-conforming formatting
error: the following command exited with error code 1:
/home/andy/dev/zig/build-release/stage3/bin/zig fmt --check /home/andy/dev/zig/lib /home/andy/dev/zig/src /home/andy/dev/zig/test /home/andy/dev/zig/tools /home/andy/dev/zig/build.zig /home/andy/dev/zig/build.zig.zon --exclude /home/andy/dev/zig/test/cases 
Build Summary: 0/2 steps succeeded; 1 failed (disable with --summary none)
test-fmt transitive failure
└─ zig fmt --check failure
error: the following build command failed with exit code 1:
/home/andy/dev/zig/.zig-cache/o/3ac7a20af5c73e65a83d2e9b65218673/build /home/andy/dev/zig/build-release/stage3/bin/zig /home/andy/dev/zig /home/andy/dev/zig/.zig-cache /home/andy/.cache/zig --seed 0x8b717bd6 -Z1af88b3aa2fcdad6 test-fmt

See individual commit messages for more details.

andrewrk added 5 commits June 16, 2024 19:27
There was not a way to pass a progress node to this function until now.
Now there is `captureChildProcess` which gives access to the
`std.process.Child.RunResult`, which is useful for accessing the stdout.

It also accepts and passes an optional `std.Progress.Node` to the child.
When in --check mode, and files are found to not conform, emit them
explicitly as step errors. Previously this stdout data was being
ignored.
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`.
@andrewrk andrewrk added release notes This PR should be mentioned in the release notes. zig build system std.Build, the build runner, `zig build` subcommand, package management labels Jun 17, 2024
@andrewrk andrewrk mentioned this pull request Jun 17, 2024
4 tasks
@andrewrk andrewrk enabled auto-merge June 17, 2024 03:32
@andrewrk andrewrk merged commit fda2458 into master Jun 17, 2024
10 checks passed
@andrewrk andrewrk deleted the build-system-fmt branch June 17, 2024 05:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release notes This PR should be mentioned in the release notes. zig build system std.Build, the build runner, `zig build` subcommand, package management
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant