rework cargo invocation

This commit is contained in:
Folkert 2022-11-11 12:28:28 +01:00
parent 8787a1bed2
commit 926136b7e3
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
2 changed files with 10 additions and 10 deletions

View file

@ -632,12 +632,16 @@ pub fn rebuild_host(
}, },
); );
let mut cargo_cmd = if cfg!(windows) { rustup() } else { cargo() }; let mut cargo_cmd = if cfg!(windows) {
// on windows, we need the nightly toolchain so we can use `-Z export-executable-symbols`
// using `+nightly` only works when running cargo through rustup
let mut cmd = rustup();
cmd.args(["run", "nightly", "cargo"]);
if cfg!(windows) { cmd
// on windows, we need the `+nightly` toolchain so we can use `-Z export-executable-symbols` } else {
cargo_cmd.args(["run", "nightly", "cargo"]); cargo()
} };
cargo_cmd.arg("build").current_dir(cargo_dir); cargo_cmd.arg("build").current_dir(cargo_dir);
// Rust doesn't expose size without editing the cargo.toml. Instead just use release. // Rust doesn't expose size without editing the cargo.toml. Instead just use release.

View file

@ -126,11 +126,7 @@ pub fn get_lib_path() -> Option<PathBuf> {
/// Gives a friendly error if cargo is not installed. /// Gives a friendly error if cargo is not installed.
/// 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 = "cargo";
r"%HOMEPATH%\.cargo\bin\cargo.exe"
} else {
"cargo"
};
if check_command_available(command_str) { if check_command_available(command_str) {
Command::new(command_str) Command::new(command_str)