Rust: rename target_dir to cargo_target_dir, add to extraction options

Also removed the now unused `extract_dependencies` one.
This commit is contained in:
Paolo Tranquilli
2024-11-08 09:53:50 +01:00
parent 4f6fda0100
commit 083394073a
3 changed files with 10 additions and 10 deletions

View File

@@ -23,14 +23,15 @@ options:
title: Controls compression for the TRAP files written by the extractor. title: Controls compression for the TRAP files written by the extractor.
description: > description: >
This option is only intended for use in debugging the extractor. Accepted This option is only intended for use in debugging the extractor. Accepted
values are 'gzip' (the default, to write gzip-compressed TRAP) and 'none' values are 'gzip' (to write gzip-compressed TRAP) and 'none'
(to write uncompressed TRAP). (currently the default, to write uncompressed TRAP).
type: string type: string
pattern: "^(none|gzip)$" pattern: "^(none|gzip)$"
extract_dependencies: cargo_target_dir:
title: Whether to extract dependencies. title: Directory to use for cargo output files.
description: > description: >
Extract the source code of dependencies and the standard libraries in addition to This value is an optional path to use as `CARGO_TARGET_DIR` for the internal
normal source code. 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 type: string
pattern: "^(false|true)$"

View File

@@ -37,8 +37,7 @@ pub struct Config {
pub scratch_dir: PathBuf, pub scratch_dir: PathBuf,
pub trap_dir: PathBuf, pub trap_dir: PathBuf,
pub source_archive_dir: PathBuf, pub source_archive_dir: PathBuf,
pub target_dir: Option<PathBuf>, pub cargo_target_dir: Option<PathBuf>,
pub extract_dependencies: bool,
pub verbose: u8, pub verbose: u8,
pub compression: Compression, pub compression: Compression,
pub inputs: Vec<PathBuf>, pub inputs: Vec<PathBuf>,

View File

@@ -131,7 +131,7 @@ fn main() -> anyhow::Result<()> {
extractor.extract_without_semantics(file, "no manifest found"); extractor.extract_without_semantics(file, "no manifest found");
} }
let target_dir = &cfg let target_dir = &cfg
.target_dir .cargo_target_dir
.unwrap_or_else(|| cfg.scratch_dir.join("target")); .unwrap_or_else(|| cfg.scratch_dir.join("target"));
for (manifest, files) in map.values().filter(|(_, files)| !files.is_empty()) { for (manifest, files) in map.values().filter(|(_, files)| !files.is_empty()) {
if let Some((ref db, ref vfs)) = RustAnalyzer::load_workspace(manifest, target_dir) { if let Some((ref db, ref vfs)) = RustAnalyzer::load_workspace(manifest, target_dir) {