Skip to content

Commit 47a335b

Browse files
author
Jonathan Turner
authored
Rollup merge of rust-lang#36803 - brson:node, r=alexcrichton
Move nodejs detection into bootstrap This avoids issues with mingw path conversions. r? @alexcrichton
2 parents 9143c3c + 27588dd commit 47a335b

File tree

3 files changed

+19
-15
lines changed

3 files changed

+19
-15
lines changed

configure

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,6 @@ valopt datadir "${CFG_PREFIX}/share" "install data"
645645
valopt infodir "${CFG_PREFIX}/share/info" "install additional info"
646646
valopt llvm-root "" "set LLVM root"
647647
valopt python "" "set path to python"
648-
valopt nodejs "" "set path to nodejs"
649648
valopt jemalloc-root "" "set directory where libjemalloc_pic.a is located"
650649
valopt build "${DEFAULT_BUILD}" "GNUs ./configure syntax LLVM build triple"
651650
valopt android-cross-path "" "Android NDK standalone path (deprecated)"
@@ -762,9 +761,6 @@ if [ $(echo $python_version | grep -c '^Python 2\.7') -ne 1 ]; then
762761
err "Found $python_version, but Python 2.7 is required"
763762
fi
764763

765-
# Checking for node, but not required
766-
probe CFG_NODEJS nodejs node
767-
768764
# If we have no git directory then we are probably a tarball distribution
769765
# and shouldn't attempt to load submodules
770766
if [ ! -e ${CFG_SRC_DIR}.git ]

src/bootstrap/config.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,9 +396,6 @@ impl Config {
396396
self.rustc = Some(PathBuf::from(value).join("bin/rustc"));
397397
self.cargo = Some(PathBuf::from(value).join("bin/cargo"));
398398
}
399-
"CFG_NODEJS" if value.len() > 0 => {
400-
self.nodejs = Some(PathBuf::from(value));
401-
}
402399
_ => {}
403400
}
404401
}

src/bootstrap/sanity.rs

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,23 @@ pub fn check(build: &mut Build) {
4040
panic!("PATH contains invalid character '\"'");
4141
}
4242
}
43-
let mut need_cmd = |cmd: &OsStr| {
44-
if !checked.insert(cmd.to_owned()) {
45-
return
46-
}
43+
let have_cmd = |cmd: &OsStr| {
4744
for path in env::split_paths(&path).map(|p| p.join(cmd)) {
4845
if fs::metadata(&path).is_ok() ||
4946
fs::metadata(path.with_extension("exe")).is_ok() {
50-
return
47+
return Some(path);
5148
}
5249
}
53-
panic!("\n\ncouldn't find required command: {:?}\n\n", cmd);
50+
return None;
51+
};
52+
53+
let mut need_cmd = |cmd: &OsStr| {
54+
if !checked.insert(cmd.to_owned()) {
55+
return
56+
}
57+
if have_cmd(cmd).is_none() {
58+
panic!("\n\ncouldn't find required command: {:?}\n\n", cmd);
59+
}
5460
};
5561

5662
// If we've got a git directory we're gona need git to update
@@ -75,8 +81,13 @@ pub fn check(build: &mut Build) {
7581

7682
need_cmd("python".as_ref());
7783

78-
// If a manual nodejs was added to the config,
79-
// of if a nodejs install is detected through config, use it.
84+
// Look for the nodejs command, needed for emscripten testing
85+
if let Some(node) = have_cmd("node".as_ref()) {
86+
build.config.nodejs = Some(node);
87+
} else if let Some(node) = have_cmd("nodejs".as_ref()) {
88+
build.config.nodejs = Some(node);
89+
}
90+
8091
if let Some(ref s) = build.config.nodejs {
8192
need_cmd(s.as_ref());
8293
}

0 commit comments

Comments
 (0)