Replace OUT_DIR in project.json with general env

OUT_DIR doesn't make sense here, as this is a cargo-specific concept
This commit is contained in:
Aleksey Kladov 2020-07-21 15:12:12 +02:00
parent fe87aec7b6
commit b48336bf94
2 changed files with 7 additions and 9 deletions

View File

@ -259,11 +259,8 @@ impl ProjectWorkspace {
let file_id = load(&file_path)?;
let mut env = Env::default();
if let Some(out_dir) = &krate.out_dir {
// NOTE: cargo and rustc seem to hide non-UTF-8 strings from env! and option_env!()
if let Some(out_dir) = out_dir.to_str().map(|s| s.to_owned()) {
env.set("OUT_DIR", out_dir);
}
for (k, v) in &krate.env {
env.set(k, v.clone());
}
let proc_macro = krate
.proc_macro_dylib_path

View File

@ -5,7 +5,7 @@ use std::path::PathBuf;
use paths::{AbsPath, AbsPathBuf};
use ra_cfg::CfgOptions;
use ra_db::{CrateId, CrateName, Dependency, Edition};
use rustc_hash::FxHashSet;
use rustc_hash::{FxHashMap, FxHashSet};
use serde::{de, Deserialize};
use stdx::split_delim;
@ -24,7 +24,7 @@ pub struct Crate {
pub(crate) deps: Vec<Dependency>,
pub(crate) cfg: CfgOptions,
pub(crate) target: Option<String>,
pub(crate) out_dir: Option<AbsPathBuf>,
pub(crate) env: FxHashMap<String, String>,
pub(crate) proc_macro_dylib_path: Option<AbsPathBuf>,
pub(crate) is_workspace_member: bool,
pub(crate) include: Vec<AbsPathBuf>,
@ -78,7 +78,7 @@ impl ProjectJson {
cfg
},
target: crate_data.target,
out_dir: crate_data.out_dir.map(|it| base.join(it)),
env: crate_data.env,
proc_macro_dylib_path: crate_data
.proc_macro_dylib_path
.map(|it| base.join(it)),
@ -105,7 +105,8 @@ struct CrateData {
#[serde(default)]
cfg: FxHashSet<String>,
target: Option<String>,
out_dir: Option<PathBuf>,
#[serde(default)]
env: FxHashMap<String, String>,
proc_macro_dylib_path: Option<PathBuf>,
is_workspace_member: Option<bool>,
source: Option<CrateSource>,