diff options
Diffstat (limited to 'crates/ra_project_model/src/cargo_workspace.rs')
-rw-r--r-- | crates/ra_project_model/src/cargo_workspace.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs index eeeb10233..97fa48b8b 100644 --- a/crates/ra_project_model/src/cargo_workspace.rs +++ b/crates/ra_project_model/src/cargo_workspace.rs | |||
@@ -39,6 +39,9 @@ pub struct CargoFeatures { | |||
39 | 39 | ||
40 | /// Runs cargo check on launch to figure out the correct values of OUT_DIR | 40 | /// Runs cargo check on launch to figure out the correct values of OUT_DIR |
41 | pub load_out_dirs_from_check: bool, | 41 | pub load_out_dirs_from_check: bool, |
42 | |||
43 | /// Fine grained controls for additional `OUT_DIR` env variables | ||
44 | pub out_dir_overrides: FxHashMap<PackageId, PathBuf>, | ||
42 | } | 45 | } |
43 | 46 | ||
44 | impl Default for CargoFeatures { | 47 | impl Default for CargoFeatures { |
@@ -48,6 +51,7 @@ impl Default for CargoFeatures { | |||
48 | all_features: true, | 51 | all_features: true, |
49 | features: Vec::new(), | 52 | features: Vec::new(), |
50 | load_out_dirs_from_check: false, | 53 | load_out_dirs_from_check: false, |
54 | out_dir_overrides: FxHashMap::default(), | ||
51 | } | 55 | } |
52 | } | 56 | } |
53 | } | 57 | } |
@@ -191,6 +195,10 @@ impl CargoWorkspace { | |||
191 | if cargo_features.load_out_dirs_from_check { | 195 | if cargo_features.load_out_dirs_from_check { |
192 | out_dir_by_id = load_out_dirs(cargo_toml, cargo_features); | 196 | out_dir_by_id = load_out_dirs(cargo_toml, cargo_features); |
193 | } | 197 | } |
198 | // We explicitly extend afterwards to allow overriding the value returned by cargo | ||
199 | out_dir_by_id.extend( | ||
200 | cargo_features.out_dir_overrides.iter().map(|(id, path)| (id.clone(), path.clone())), | ||
201 | ); | ||
194 | 202 | ||
195 | let mut pkg_by_id = FxHashMap::default(); | 203 | let mut pkg_by_id = FxHashMap::default(); |
196 | let mut packages = Arena::default(); | 204 | let mut packages = Arena::default(); |