Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ fn install(args: InstallOpts) -> Result<()> {
#[cfg(windows)]
check_arguments(&targets, &args.esp_idf_version)?;

check_rust_installation(&args.nightly_version)?;
check_rust_installation(&args.nightly_version, &host_triple)?;

if let Some(ref xtensa_rust) = xtensa_rust {
xtensa_rust.install()?;
Expand Down
10 changes: 7 additions & 3 deletions src/toolchain/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ pub fn get_rustup_home() -> PathBuf {

/// Checks if rustup and the proper nightly version are installed. If rustup is not installed,
/// it returns an error. If nigthly version is not installed, proceed to install it.
pub fn check_rust_installation(nightly_version: &str) -> Result<()> {
pub fn check_rust_installation(nightly_version: &str, host_triple: &HostTriple) -> Result<()> {
info!("{} Checking existing Rust installation", emoji::WRENCH);

match cmd!("rustup", "toolchain", "list")
Expand All @@ -287,7 +287,7 @@ pub fn check_rust_installation(nightly_version: &str) -> Result<()> {
Err(e) => {
if let std::io::ErrorKind::NotFound = e.kind() {
warn!("{} rustup was not found.", emoji::WARN);
install_rustup(nightly_version)?;
install_rustup(nightly_version, host_triple)?;
} else {
return Err(Error::RustupDetectionError(e.to_string())).into_diagnostic();
}
Expand All @@ -298,7 +298,7 @@ pub fn check_rust_installation(nightly_version: &str) -> Result<()> {
}

/// Installs rustup
fn install_rustup(nightly_version: &str) -> Result<(), Error> {
fn install_rustup(nightly_version: &str, host_triple: &HostTriple) -> Result<(), Error> {
#[cfg(windows)]
let rustup_init_path = download_file(
"https://win.rustup.rs/x86_64".to_string(),
Expand All @@ -324,6 +324,8 @@ fn install_rustup(nightly_version: &str) -> Result<(), Error> {
rustup_init_path,
"--default-toolchain",
nightly_version,
"--default-host",
host_triple.to_string(),
"--profile",
"minimal",
"-y"
Expand All @@ -335,6 +337,8 @@ fn install_rustup(nightly_version: &str) -> Result<(), Error> {
rustup_init_path,
"--default-toolchain",
nightly_version,
"--default-host",
host_triple.to_string(),
"--profile",
"minimal",
"-y"
Expand Down