Skip to content

Commit 8c28161

Browse files
committed
Add get_host_target function
1 parent d1d8e38 commit 8c28161

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/bootstrap/src/core/config/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ use crate::core::download::is_download_ci_available;
4949
use crate::utils::channel;
5050
use crate::utils::exec::command;
5151
use crate::utils::execution_context::ExecutionContext;
52-
use crate::utils::helpers::exe;
52+
use crate::utils::helpers::{exe, get_host_target};
5353
use crate::{GitInfo, OnceLock, TargetSelection, check_ci_llvm, helpers, t};
5454

5555
/// Each path in this list is considered "allowed" in the `download-rustc="if-unchanged"` logic.
@@ -349,7 +349,7 @@ impl Config {
349349
stderr_is_tty: std::io::stderr().is_terminal(),
350350

351351
// set by build.rs
352-
host_target: TargetSelection::from_user(env!("BUILD_TRIPLE")),
352+
host_target: get_host_target(),
353353

354354
src: {
355355
let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));

src/bootstrap/src/utils/helpers.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,11 @@ pub fn symlink_dir(config: &Config, original: &Path, link: &Path) -> io::Result<
178178
}
179179
}
180180

181+
/// Return the host target on which we are currently running.
182+
pub fn get_host_target() -> TargetSelection {
183+
TargetSelection::from_user(env!("BUILD_TRIPLE"))
184+
}
185+
181186
/// Rename a file if from and to are in the same filesystem or
182187
/// copy and remove the file otherwise
183188
pub fn move_file<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<()> {

0 commit comments

Comments
 (0)