diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2023-02-12 14:28:09 +0000 |
|---|---|---|
| committer | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2023-05-22 17:17:05 +0000 |
| commit | 22befab611db45f5448d09db63e67fb72bd9af0c (patch) | |
| tree | c4d7776f74b6374f0a00fa46ab6271171ac0a9cc | |
| parent | b1d8b7186ccee2ef57886dc3bf17225d11a3935f (diff) | |
| download | rust-22befab611db45f5448d09db63e67fb72bd9af0c.tar.gz rust-22befab611db45f5448d09db63e67fb72bd9af0c.zip | |
Avoid hard-coding rustc path in prepare.rs
| -rw-r--r-- | build_system/mod.rs | 2 | ||||
| -rw-r--r-- | build_system/prepare.rs | 16 |
2 files changed, 9 insertions, 9 deletions
diff --git a/build_system/mod.rs b/build_system/mod.rs index 2f8550dbf0e..58b21f64d37 100644 --- a/build_system/mod.rs +++ b/build_system/mod.rs @@ -149,7 +149,7 @@ pub(crate) fn main() { } if command == Command::Prepare { - prepare::prepare(&dirs); + prepare::prepare(&dirs, &bootstrap_host_compiler.rustc); process::exit(0); } diff --git a/build_system/prepare.rs b/build_system/prepare.rs index 2754b167850..ac2dc47dd7f 100644 --- a/build_system/prepare.rs +++ b/build_system/prepare.rs @@ -9,19 +9,19 @@ use super::rustc_info::{get_default_sysroot, get_rustc_version}; use super::tests::LIBCORE_TESTS_SRC; use super::utils::{copy_dir_recursively, git_command, retry_spawn_and_wait, spawn_and_wait}; -pub(crate) fn prepare(dirs: &Dirs) { +pub(crate) fn prepare(dirs: &Dirs, rustc: &Path) { RelPath::DOWNLOAD.ensure_fresh(dirs); - prepare_stdlib(dirs); - prepare_coretests(dirs); + prepare_stdlib(dirs, rustc); + prepare_coretests(dirs, rustc); super::tests::RAND_REPO.fetch(dirs); super::tests::REGEX_REPO.fetch(dirs); super::tests::PORTABLE_SIMD_REPO.fetch(dirs); } -fn prepare_stdlib(dirs: &Dirs) { - let sysroot_src_orig = get_default_sysroot(Path::new("rustc")).join("lib/rustlib/src/rust"); +fn prepare_stdlib(dirs: &Dirs, rustc: &Path) { + let sysroot_src_orig = get_default_sysroot(rustc).join("lib/rustlib/src/rust"); assert!(sysroot_src_orig.exists()); eprintln!("[COPY] stdlib src"); @@ -36,7 +36,7 @@ fn prepare_stdlib(dirs: &Dirs) { &SYSROOT_SRC.to_path(dirs).join("library"), ); - let rustc_version = get_rustc_version(Path::new("rustc")); + let rustc_version = get_rustc_version(rustc); fs::write(SYSROOT_RUSTC_VERSION.to_path(dirs), &rustc_version).unwrap(); eprintln!("[GIT] init"); @@ -45,8 +45,8 @@ fn prepare_stdlib(dirs: &Dirs) { apply_patches(dirs, "stdlib", &SYSROOT_SRC.to_path(dirs)); } -fn prepare_coretests(dirs: &Dirs) { - let sysroot_src_orig = get_default_sysroot(Path::new("rustc")).join("lib/rustlib/src/rust"); +fn prepare_coretests(dirs: &Dirs, rustc: &Path) { + let sysroot_src_orig = get_default_sysroot(rustc).join("lib/rustlib/src/rust"); assert!(sysroot_src_orig.exists()); eprintln!("[COPY] coretests src"); |
