Inline prepare_tool_cmd

Removing the tool argument in the previous commit means it's no longer
restricted to just bootstrap tools despite being written as such.
Inlining it prevents accidental use.
This commit is contained in:
Mark Rousskov 2019-06-07 11:15:45 -06:00
parent 0e14818321
commit 7234d8cb5e

View file

@ -655,22 +655,13 @@ impl<'a> Builder<'a> {
pub fn tool_cmd(&self, tool: Tool) -> Command {
let mut cmd = Command::new(self.tool_exe(tool));
let compiler = self.compiler(0, self.config.build);
self.prepare_tool_cmd(compiler, &mut cmd);
cmd
}
/// Prepares the `cmd` provided to be able to run the `compiler` provided.
///
/// Notably this munges the dynamic library lookup path to point to the
/// right location to run `compiler`.
fn prepare_tool_cmd(&self, compiler: Compiler, cmd: &mut Command) {
let host = &compiler.host;
// Prepares the `cmd` provided to be able to run the `compiler` provided.
//
// Notably this munges the dynamic library lookup path to point to the
// right location to run `compiler`.
let mut lib_paths: Vec<PathBuf> = vec![
if compiler.stage == 0 {
self.build.rustc_snapshot_libdir()
} else {
PathBuf::from(&self.sysroot_libdir(compiler, compiler.host))
},
self.build.rustc_snapshot_libdir(),
self.cargo_out(compiler, Mode::ToolBootstrap, *host).join("deps"),
];
@ -692,6 +683,7 @@ impl<'a> Builder<'a> {
}
}
add_lib_path(lib_paths, cmd);
add_lib_path(lib_paths, &mut cmd);
cmd
}
}