diff options
| author | John Turner <jturner.usa@gmail.com> | 2025-12-22 19:52:56 -0500 |
|---|---|---|
| committer | John Turner <jturner.usa@gmail.com> | 2025-12-22 19:52:56 -0500 |
| commit | 124f237c9e8c0a09737571aac92095461a2c689d (patch) | |
| tree | 109d12f4d49643d51d585dd7855fdc0c58b20398 /mesonbuild/scripts | |
| parent | 8e53ca4b796242a4fc366a263fab3adecf5e7151 (diff) | |
| parent | 651fe54d12f07dd98ff94f8a8cea2469e746a590 (diff) | |
| download | meson-124f237c9e8c0a09737571aac92095461a2c689d.tar.gz | |
Merge branch 'clippy-json'
Diffstat (limited to 'mesonbuild/scripts')
| -rw-r--r-- | mesonbuild/scripts/clippy.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/mesonbuild/scripts/clippy.py b/mesonbuild/scripts/clippy.py index 0ea7a3429..519d3ab22 100644 --- a/mesonbuild/scripts/clippy.py +++ b/mesonbuild/scripts/clippy.py @@ -6,16 +6,18 @@ from collections import defaultdict import os import tempfile import typing as T +import subprocess from .run_tool import run_tool_on_targets, run_with_buffered_output from .. import build, mlog from ..mesonlib import MachineChoice, PerMachine +from ..tooldetect import detect_ninja if T.TYPE_CHECKING: from ..compilers.rust import RustCompiler class ClippyDriver: - def __init__(self, build: build.Build, tempdir: str): + def __init__(self, build: build.Build, tempdir: str, args: list[str]): self.tools: PerMachine[T.List[str]] = PerMachine([], []) self.warned: T.DefaultDict[str, bool] = defaultdict(lambda: False) self.tempdir = tempdir @@ -24,6 +26,7 @@ class ClippyDriver: if 'rust' in compilers: compiler = T.cast('RustCompiler', compilers['rust']) self.tools[machine] = compiler.get_rust_tool('clippy-driver') + self.args = args def warn_missing_clippy(self, machine: str) -> None: if self.warned[machine]: @@ -67,10 +70,17 @@ class ClippyDriver: cmdlist.append('metadata') cmdlist.append('--out-dir') cmdlist.append(self.tempdir) + cmdlist += self.args yield run_with_buffered_output(cmdlist) def run(args: T.List[str]) -> int: os.chdir(args[0]) build_data = build.load(os.getcwd()) + + # Build as much of the project as possible, or else + # we get errors about missing libraries in the build directory and + # other related errors. + subprocess.run(detect_ninja() + ['clippy-json-prereq', '-k0']) + with tempfile.TemporaryDirectory() as d: - return run_tool_on_targets(ClippyDriver(build_data, d)) + return run_tool_on_targets(ClippyDriver(build_data, d, args[1:])) |
