aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_project_model/src/lib.rs7
-rw-r--r--crates/ra_project_model/src/project_json.rs9
2 files changed, 7 insertions, 9 deletions
diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs
index 05f2e7b7a..2bb156610 100644
--- a/crates/ra_project_model/src/lib.rs
+++ b/crates/ra_project_model/src/lib.rs
@@ -259,11 +259,8 @@ impl ProjectWorkspace {
259 let file_id = load(&file_path)?; 259 let file_id = load(&file_path)?;
260 260
261 let mut env = Env::default(); 261 let mut env = Env::default();
262 if let Some(out_dir) = &krate.out_dir { 262 for (k, v) in &krate.env {
263 // NOTE: cargo and rustc seem to hide non-UTF-8 strings from env! and option_env!() 263 env.set(k, v.clone());
264 if let Some(out_dir) = out_dir.to_str().map(|s| s.to_owned()) {
265 env.set("OUT_DIR", out_dir);
266 }
267 } 264 }
268 let proc_macro = krate 265 let proc_macro = krate
269 .proc_macro_dylib_path 266 .proc_macro_dylib_path
diff --git a/crates/ra_project_model/src/project_json.rs b/crates/ra_project_model/src/project_json.rs
index e0052ac6d..e9a333191 100644
--- a/crates/ra_project_model/src/project_json.rs
+++ b/crates/ra_project_model/src/project_json.rs
@@ -5,7 +5,7 @@ use std::path::PathBuf;
5use paths::{AbsPath, AbsPathBuf}; 5use paths::{AbsPath, AbsPathBuf};
6use ra_cfg::CfgOptions; 6use ra_cfg::CfgOptions;
7use ra_db::{CrateId, CrateName, Dependency, Edition}; 7use ra_db::{CrateId, CrateName, Dependency, Edition};
8use rustc_hash::FxHashSet; 8use rustc_hash::{FxHashMap, FxHashSet};
9use serde::{de, Deserialize}; 9use serde::{de, Deserialize};
10use stdx::split_delim; 10use stdx::split_delim;
11 11
@@ -24,7 +24,7 @@ pub struct Crate {
24 pub(crate) deps: Vec<Dependency>, 24 pub(crate) deps: Vec<Dependency>,
25 pub(crate) cfg: CfgOptions, 25 pub(crate) cfg: CfgOptions,
26 pub(crate) target: Option<String>, 26 pub(crate) target: Option<String>,
27 pub(crate) out_dir: Option<AbsPathBuf>, 27 pub(crate) env: FxHashMap<String, String>,
28 pub(crate) proc_macro_dylib_path: Option<AbsPathBuf>, 28 pub(crate) proc_macro_dylib_path: Option<AbsPathBuf>,
29 pub(crate) is_workspace_member: bool, 29 pub(crate) is_workspace_member: bool,
30 pub(crate) include: Vec<AbsPathBuf>, 30 pub(crate) include: Vec<AbsPathBuf>,
@@ -78,7 +78,7 @@ impl ProjectJson {
78 cfg 78 cfg
79 }, 79 },
80 target: crate_data.target, 80 target: crate_data.target,
81 out_dir: crate_data.out_dir.map(|it| base.join(it)), 81 env: crate_data.env,
82 proc_macro_dylib_path: crate_data 82 proc_macro_dylib_path: crate_data
83 .proc_macro_dylib_path 83 .proc_macro_dylib_path
84 .map(|it| base.join(it)), 84 .map(|it| base.join(it)),
@@ -105,7 +105,8 @@ struct CrateData {
105 #[serde(default)] 105 #[serde(default)]
106 cfg: FxHashSet<String>, 106 cfg: FxHashSet<String>,
107 target: Option<String>, 107 target: Option<String>,
108 out_dir: Option<PathBuf>, 108 #[serde(default)]
109 env: FxHashMap<String, String>,
109 proc_macro_dylib_path: Option<PathBuf>, 110 proc_macro_dylib_path: Option<PathBuf>,
110 is_workspace_member: Option<bool>, 111 is_workspace_member: Option<bool>,
111 source: Option<CrateSource>, 112 source: Option<CrateSource>,