2 use std::path::{Path, PathBuf};
3 use std::process::Command;
5 pub(crate) fn build_backend(
8 use_unstable_features: bool,
10 let mut cmd = Command::new("cargo");
11 cmd.arg("build").arg("--target").arg(host_triple);
13 cmd.env("CARGO_BUILD_INCREMENTAL", "true"); // Force incr comp even in release mode
15 let mut rustflags = env::var("RUSTFLAGS").unwrap_or_default();
17 if env::var("CI").as_ref().map(|val| &**val) == Ok("true") {
18 // Deny warnings on CI
19 rustflags += " -Dwarnings";
21 // Disabling incr comp reduces cache size and incr comp doesn't save as much on CI anyway
22 cmd.env("CARGO_BUILD_INCREMENTAL", "false");
25 if use_unstable_features {
26 cmd.arg("--features").arg("unstable-features");
37 cmd.env("RUSTFLAGS", rustflags);
39 eprintln!("[BUILD] rustc_codegen_cranelift");
40 super::utils::spawn_and_wait(cmd);
42 Path::new("target").join(host_triple).join(channel)