From 083394073a7d90adfea856af5d684cf7c8990601 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Fri, 8 Nov 2024 09:53:50 +0100 Subject: [PATCH] Rust: rename `target_dir` to `cargo_target_dir`, add to extraction options Also removed the now unused `extract_dependencies` one. --- rust/codeql-extractor.yml | 15 ++++++++------- rust/extractor/src/config.rs | 3 +-- rust/extractor/src/main.rs | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/rust/codeql-extractor.yml b/rust/codeql-extractor.yml index e33d2c0c715..c7558c17efe 100644 --- a/rust/codeql-extractor.yml +++ b/rust/codeql-extractor.yml @@ -23,14 +23,15 @@ options: title: Controls compression for the TRAP files written by the extractor. description: > This option is only intended for use in debugging the extractor. Accepted - values are 'gzip' (the default, to write gzip-compressed TRAP) and 'none' - (to write uncompressed TRAP). + values are 'gzip' (to write gzip-compressed TRAP) and 'none' + (currently the default, to write uncompressed TRAP). type: string pattern: "^(none|gzip)$" - extract_dependencies: - title: Whether to extract dependencies. + cargo_target_dir: + title: Directory to use for cargo output files. description: > - Extract the source code of dependencies and the standard libraries in addition to - normal source code. + This value is an optional path to use as `CARGO_TARGET_DIR` for the internal + cargo commands the extractor uses. Pointing it to a persistent directory may + reduce execution time of consecutive extractor runs. By default, a new scratch + directory is used for each run. type: string - pattern: "^(false|true)$" diff --git a/rust/extractor/src/config.rs b/rust/extractor/src/config.rs index 91182870bc6..f477663f607 100644 --- a/rust/extractor/src/config.rs +++ b/rust/extractor/src/config.rs @@ -37,8 +37,7 @@ pub struct Config { pub scratch_dir: PathBuf, pub trap_dir: PathBuf, pub source_archive_dir: PathBuf, - pub target_dir: Option, - pub extract_dependencies: bool, + pub cargo_target_dir: Option, pub verbose: u8, pub compression: Compression, pub inputs: Vec, diff --git a/rust/extractor/src/main.rs b/rust/extractor/src/main.rs index 48e56db5971..1f963a0990e 100644 --- a/rust/extractor/src/main.rs +++ b/rust/extractor/src/main.rs @@ -131,7 +131,7 @@ fn main() -> anyhow::Result<()> { extractor.extract_without_semantics(file, "no manifest found"); } let target_dir = &cfg - .target_dir + .cargo_target_dir .unwrap_or_else(|| cfg.scratch_dir.join("target")); for (manifest, files) in map.values().filter(|(_, files)| !files.is_empty()) { if let Some((ref db, ref vfs)) = RustAnalyzer::load_workspace(manifest, target_dir) {