diff options
| author | Brian Anderson <banderson@mozilla.com> | 2016-09-28 07:56:37 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2016-09-28 09:05:19 -0700 |
| commit | 27588dd7a193ab03b1c233af2eae3e27e22addf5 (patch) | |
| tree | 5ce9efd7f55c8708006f6af9d67e882dfc310c37 /src/bootstrap | |
| parent | c772948b687488a087356cb91432425662e034b9 (diff) | |
| download | rust-27588dd7a193ab03b1c233af2eae3e27e22addf5.tar.gz rust-27588dd7a193ab03b1c233af2eae3e27e22addf5.zip | |
Move nodejs detection into bootstrap
This avoids issues with mingw path conversions.
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/config.rs | 3 | ||||
| -rw-r--r-- | src/bootstrap/sanity.rs | 27 |
2 files changed, 19 insertions, 11 deletions
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 0f69bcfbb64..a8434c3efb3 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -396,9 +396,6 @@ impl Config { self.rustc = Some(PathBuf::from(value).join("bin/rustc")); self.cargo = Some(PathBuf::from(value).join("bin/cargo")); } - "CFG_NODEJS" if value.len() > 0 => { - self.nodejs = Some(PathBuf::from(value)); - } _ => {} } } diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs index 05c35543e3e..962d0666f69 100644 --- a/src/bootstrap/sanity.rs +++ b/src/bootstrap/sanity.rs @@ -40,17 +40,23 @@ pub fn check(build: &mut Build) { panic!("PATH contains invalid character '\"'"); } } - let mut need_cmd = |cmd: &OsStr| { - if !checked.insert(cmd.to_owned()) { - return - } + let have_cmd = |cmd: &OsStr| { for path in env::split_paths(&path).map(|p| p.join(cmd)) { if fs::metadata(&path).is_ok() || fs::metadata(path.with_extension("exe")).is_ok() { - return + return Some(path); } } - panic!("\n\ncouldn't find required command: {:?}\n\n", cmd); + return None; + }; + + let mut need_cmd = |cmd: &OsStr| { + if !checked.insert(cmd.to_owned()) { + return + } + if have_cmd(cmd).is_none() { + panic!("\n\ncouldn't find required command: {:?}\n\n", cmd); + } }; // If we've got a git directory we're gona need git to update @@ -75,8 +81,13 @@ pub fn check(build: &mut Build) { need_cmd("python".as_ref()); - // If a manual nodejs was added to the config, - // of if a nodejs install is detected through config, use it. + // Look for the nodejs command, needed for emscripten testing + if let Some(node) = have_cmd("node".as_ref()) { + build.config.nodejs = Some(node); + } else if let Some(node) = have_cmd("nodejs".as_ref()) { + build.config.nodejs = Some(node); + } + if let Some(ref s) = build.config.nodejs { need_cmd(s.as_ref()); } |
