From f2cff7451c7aeaccaebdf1fb2caf617dcfd0e7cb Mon Sep 17 00:00:00 2001 From: xdustinface Date: Fri, 2 Jan 2026 12:20:38 +0100 Subject: [PATCH] chore: use separate target dirs for pre-commit Right now the clippy and verify-ffi steps in pre-commit are forced to rebuild all dependencies every time you switch between running tests or CLI and running pre-commit because of different configurations, which makes running clippy and verify-ffi quite slow. Having separate target dirs prevents those rebuilds by keeping the caches for the different build configurations alive. --- contrib/run_clippy.py | 1 + contrib/verify_ffi.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/run_clippy.py b/contrib/run_clippy.py index 9b3448896..054a61098 100755 --- a/contrib/run_clippy.py +++ b/contrib/run_clippy.py @@ -9,6 +9,7 @@ "--workspace", "--all-features", "--all-targets", + "--target-dir", "target/clippy", ] # Exclude dash-fuzz on Windows (honggfuzz doesn't support Windows) diff --git a/contrib/verify_ffi.py b/contrib/verify_ffi.py index a4d0393f2..e591b4460 100755 --- a/contrib/verify_ffi.py +++ b/contrib/verify_ffi.py @@ -13,7 +13,8 @@ def build_ffi_crates(repo_root: Path) -> bool: """Build all FFI crates to regenerate headers.""" print(" Building FFI crates...") result = subprocess.run( - ["cargo", "build", "--quiet"] + [f"-p={crate}" for crate in FFI_CRATES], + ["cargo", "build", "--quiet", "--target-dir", "target/verify-ffi"] + + [f"-p={crate}" for crate in FFI_CRATES], cwd=repo_root, capture_output=True, text=True