mirror of
https://github.com/rust-lang/rust
synced 2024-10-04 15:50:51 +00:00
Auto merge of #37611 - Mark-Simulacrum:tari-nodejs-runner-detect, r=alexcrichton
compile-test: allow overriding nodejs binary location Add a command-line argument to manually specify which nodejs binary should be used, which disables the default search. Original work done by @tari. Fixes #34188.
This commit is contained in:
commit
fd983d02e1
|
@ -129,6 +129,7 @@ struct Build {
|
|||
submodules: Option<bool>,
|
||||
gdb: Option<String>,
|
||||
vendor: Option<bool>,
|
||||
nodejs: Option<String>,
|
||||
}
|
||||
|
||||
/// TOML representation of how the LLVM build is configured.
|
||||
|
@ -234,6 +235,7 @@ pub fn parse(build: &str, file: Option<PathBuf>) -> Config {
|
|||
}
|
||||
config.rustc = build.rustc.map(PathBuf::from);
|
||||
config.cargo = build.cargo.map(PathBuf::from);
|
||||
config.nodejs = build.nodejs.map(PathBuf::from);
|
||||
config.gdb = build.gdb.map(PathBuf::from);
|
||||
set(&mut config.compiler_docs, build.compiler_docs);
|
||||
set(&mut config.docs, build.docs);
|
||||
|
|
|
@ -81,15 +81,16 @@ pub fn check(build: &mut Build) {
|
|||
|
||||
need_cmd("python".as_ref());
|
||||
|
||||
// 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());
|
||||
} else {
|
||||
// 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 gdb) = build.config.gdb {
|
||||
|
|
|
@ -1456,8 +1456,11 @@ fn make_run_args(&self) -> ProcArgs {
|
|||
|
||||
// If this is emscripten, then run tests under nodejs
|
||||
if self.config.target.contains("emscripten") {
|
||||
let nodejs = self.config.nodejs.clone().unwrap_or("nodejs".to_string());
|
||||
args.push(nodejs);
|
||||
if let Some(ref p) = self.config.nodejs {
|
||||
args.push(p.clone());
|
||||
} else {
|
||||
self.fatal("no NodeJS binary found (--nodejs)");
|
||||
}
|
||||
}
|
||||
|
||||
let exe_file = self.make_exe_name();
|
||||
|
|
Loading…
Reference in a new issue