aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/scripts/run_tool.py
AgeCommit message (Collapse)AuthorFilesLines
12 daysclang-tidy: run tool only on source files participating in targetsSahnvour1-0/+20
clang-tidy can't be ran as is on every source file and header
2024-12-19scripts: add "clippy" internal toolPaolo Bonzini1-0/+10
Similar to the "ninja scan-build" target for C, add a clippy internal tool that runs clippy-driver on all crates in the project. The approach used is more efficient than with "ninja scan-build", and does not require rerunning Meson in a separate build directory; it uses the introspection data to find the compiler arguments for the target and invokes clippy-driver with a slightly modified command line. This could actually be applied to scan-build as well, reusing the run_tool_on_targets() function. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-12-19scripts: convert run_tool to asyncioPaolo Bonzini1-32/+88
This improves the handling of keyboard interrupt, and also makes it easy to buffer the output and not mix errors from different subprocesses. This is useful for clang-tidy and will be used by clippy as well. In addition, the new code supports MESON_NUM_PROCESSES. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-12-19scripts: rename run_tool to run_clang_toolPaolo Bonzini1-1/+1
Differentiate from the "run_tool_on_targets" function that will be introduced in the next commit. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-08-25Better handle CTRL-C during clang-tidy/formatMark A. Tsuchida1-4/+18
It was possible (with some frequency) for the clang-tidy/format target to continue starting new subprocesses after a CTRL-C, because we were not canceling the already queued tasks and waiting for all of them. This makes a best-effort attempt to cancel all further subprocesses. It is not 100%, because there is a race that is hard to avoid (without major restructuring, at least): new subprocesses may be started after KeyboardInterrupt (or any other exception) is raised but before we get to the cancellation. When the race happens, the calling ninja may exit before Meson exits, causing some output (from clang-tidy/format and Meson's traceback) to be printed after returning to the shell prompt. But this is an improvement over potentially launching all the remaining tasks after having returned to the shell, which is what used to happen rather often. In practice, it appears that we cleanly exit with a pretty high probability unless CTRL-C is hit very early after starting (presumably before the thread pool has launched subprocesses on all its threads).
2023-12-13Use SPDX-License-Identifier consistentlyDylan Baker1-11/+1
This replaces all of the Apache blurbs at the start of each file with an `# SPDX-License-Identifier: Apache-2.0` string. It also fixes existing uses to be consistent in capitalization, and to be placed above any copyright notices. This removes nearly 3000 lines of boilerplate from the project (only python files), which no developer cares to look at. SPDX is in common use, particularly in the Linux kernel, and is the recommended format for Meson's own `project(license: )` field
2023-03-21Fix run_tool() when git is not installedAlyssa Ross1-3/+3
Previously, it would raise an exception.
2022-08-26Fix purely white space issues reported by flake8Alf Henrik Sauge1-1/+1
2022-03-29move a bunch of imports into TYPE_CHECKING blocksEli Schwartz1-1/+4
These are only used for type checking, so don't bother importing them at runtime. Generally add future annotations at the same time, to make sure that existing uses of these imports don't need to be quoted.
2021-11-14Share common code between clang tidy and formatXavier Claessens1-0/+65