moving nodejs detection logic to configure and adding

a nodejs cmd sanity check
This commit is contained in:
Jake Goldsborough 2016-09-07 13:13:37 -07:00
parent 0adcf46cdf
commit 7e46f2ceaa
2 changed files with 5 additions and 1 deletions

View File

@ -79,6 +79,7 @@ pub struct Config {
pub musl_root: Option<PathBuf>, pub musl_root: Option<PathBuf>,
pub prefix: Option<String>, pub prefix: Option<String>,
pub codegen_tests: bool, pub codegen_tests: bool,
pub nodejs: Option<PathBuf>,
} }
/// Per-target configuration stored in the global configuration structure. /// Per-target configuration stored in the global configuration structure.
@ -391,6 +392,9 @@ impl Config {
self.rustc = Some(PathBuf::from(value).join("bin/rustc")); self.rustc = Some(PathBuf::from(value).join("bin/rustc"));
self.cargo = Some(PathBuf::from(value).join("bin/cargo")); self.cargo = Some(PathBuf::from(value).join("bin/cargo"));
} }
"CFG_NODEJS" if value.len() > 0 => {
self.nodejs = Some(PathBuf::from(value));
}
_ => {} _ => {}
} }
} }

View File

@ -76,7 +76,7 @@ pub fn check(build: &mut Build) {
need_cmd("python".as_ref()); need_cmd("python".as_ref());
// If a manual nodejs was added to the config, // If a manual nodejs was added to the config,
// of if a nodejs install is detected through bootstrap.py, use it. // of if a nodejs install is detected through config, use it.
if build.config.nodejs.is_some() { if build.config.nodejs.is_some() {
need_cmd("nodejs".as_ref()) need_cmd("nodejs".as_ref())
} }