mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 08:34:33 +00:00
try to invoke rustup directly
This commit is contained in:
parent
4638984513
commit
421413c5cd
2 changed files with 18 additions and 6 deletions
|
@ -3,8 +3,8 @@ use libloading::{Error, Library};
|
||||||
use roc_builtins::bitcode;
|
use roc_builtins::bitcode;
|
||||||
use roc_error_macros::internal_error;
|
use roc_error_macros::internal_error;
|
||||||
use roc_mono::ir::OptLevel;
|
use roc_mono::ir::OptLevel;
|
||||||
use roc_utils::get_lib_path;
|
|
||||||
use roc_utils::{cargo, clang, zig};
|
use roc_utils::{cargo, clang, zig};
|
||||||
|
use roc_utils::{get_lib_path, rustup};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
@ -632,11 +632,11 @@ pub fn rebuild_host(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut cargo_cmd = cargo();
|
let mut cargo_cmd = if cfg!(windows) { rustup() } else { cargo() };
|
||||||
|
|
||||||
if cfg!(windows) {
|
if cfg!(windows) {
|
||||||
// on windows, we need the `+nightly` toolchain so we can use `-Z export-executable-symbols`
|
// on windows, we need the `+nightly` toolchain so we can use `-Z export-executable-symbols`
|
||||||
cargo_cmd.arg("+nightly");
|
cargo_cmd.args(["run", "nightly", "cargo"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
cargo_cmd.arg("build").current_dir(cargo_dir);
|
cargo_cmd.arg("build").current_dir(cargo_dir);
|
||||||
|
|
|
@ -127,9 +127,6 @@ pub fn get_lib_path() -> Option<PathBuf> {
|
||||||
/// Also makes it easy to track where we use cargo in the codebase.
|
/// Also makes it easy to track where we use cargo in the codebase.
|
||||||
pub fn cargo() -> Command {
|
pub fn cargo() -> Command {
|
||||||
let command_str = if cfg!(windows) {
|
let command_str = if cfg!(windows) {
|
||||||
// on windows, we need the version of cargo installed by rustup. The meaning of `cargo` is
|
|
||||||
// different within a process that runs rust. So we need to explicitly refer to where
|
|
||||||
// rustup put the binary
|
|
||||||
r"%HOMEPATH%\.cargo\bin\cargo.exe"
|
r"%HOMEPATH%\.cargo\bin\cargo.exe"
|
||||||
} else {
|
} else {
|
||||||
"cargo"
|
"cargo"
|
||||||
|
@ -142,6 +139,21 @@ pub fn cargo() -> Command {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Gives a friendly error if cargo is not installed.
|
||||||
|
/// Also makes it easy to track where we use cargo in the codebase.
|
||||||
|
pub fn rustup() -> Command {
|
||||||
|
// on windows, we need the version of cargo installed by rustup. The meaning of `cargo` is
|
||||||
|
// different within a process that runs rust. So we need to explicitly refer to where
|
||||||
|
// rustup put the binary
|
||||||
|
let command_str = "rustup";
|
||||||
|
|
||||||
|
if check_command_available(command_str) {
|
||||||
|
Command::new(command_str)
|
||||||
|
} else {
|
||||||
|
panic!("I could not find the rustup command.\nVisit https://rustup.rs/ to install cargo.",)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Gives a friendly error if clang is not installed.
|
/// Gives a friendly error if clang is not installed.
|
||||||
/// Also makes it easy to track where we use clang in the codebase.
|
/// Also makes it easy to track where we use clang in the codebase.
|
||||||
pub fn clang() -> Command {
|
pub fn clang() -> Command {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue