2 use std::path::{Path, PathBuf};
3 use std::process::Command;
5 use super::utils::is_ci;
7 pub(crate) fn build_backend(
10 use_unstable_features: bool,
12 let mut cmd = Command::new("cargo");
13 cmd.arg("build").arg("--target").arg(host_triple);
15 cmd.env("CARGO_BUILD_INCREMENTAL", "true"); // Force incr comp even in release mode
17 let mut rustflags = env::var("RUSTFLAGS").unwrap_or_default();
20 // Deny warnings on CI
21 rustflags += " -Dwarnings";
23 // Disabling incr comp reduces cache size and incr comp doesn't save as much on CI anyway
24 cmd.env("CARGO_BUILD_INCREMENTAL", "false");
27 if use_unstable_features {
28 cmd.arg("--features").arg("unstable-features");
39 cmd.env("RUSTFLAGS", rustflags);
41 eprintln!("[BUILD] rustc_codegen_cranelift");
42 super::utils::spawn_and_wait(cmd);
44 Path::new("target").join(host_triple).join(channel)