Only deny warnings for cg_clif build itself

cc #1213
This commit is contained in:
bjorn3 2021-12-30 12:40:23 +01:00
parent 304a50b768
commit 6b4e640dcb
2 changed files with 14 additions and 15 deletions

View File

@ -4,9 +4,6 @@ on:
- push - push
- pull_request - pull_request
env:
RUSTFLAGS: "-Dwarnings" # Deny warnings on CI
jobs: jobs:
rustfmt: rustfmt:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -10,6 +10,13 @@ pub(crate) fn build_backend(
let mut cmd = Command::new("cargo"); let mut cmd = Command::new("cargo");
cmd.arg("build").arg("--target").arg(host_triple); cmd.arg("build").arg("--target").arg(host_triple);
let mut rustflags = env::var("RUSTFLAGS").unwrap_or_default();
// Deny warnings on CI
if env::var("CI").as_ref().map(|val| &**val) == Ok("true") {
rustflags += " -Dwarnings";
}
if use_unstable_features { if use_unstable_features {
cmd.arg("--features").arg("unstable-features"); cmd.arg("--features").arg("unstable-features");
} }
@ -22,25 +29,20 @@ pub(crate) fn build_backend(
_ => unreachable!(), _ => unreachable!(),
} }
// Set the rpath to make the cg_clif executable find librustc_codegen_cranelift without changing
// LD_LIBRARY_PATH
if cfg!(unix) { if cfg!(unix) {
if cfg!(target_os = "macos") { if cfg!(target_os = "macos") {
cmd.env( rustflags += " -Csplit-debuginfo=unpacked \
"RUSTFLAGS",
"-Csplit-debuginfo=unpacked \
-Clink-arg=-Wl,-rpath,@loader_path/../lib \ -Clink-arg=-Wl,-rpath,@loader_path/../lib \
-Zosx-rpath-install-name" -Zosx-rpath-install-name";
.to_string()
+ env::var("RUSTFLAGS").as_deref().unwrap_or(""),
);
} else { } else {
cmd.env( rustflags += " -Clink-arg=-Wl,-rpath=$ORIGIN/../lib ";
"RUSTFLAGS",
"-Clink-arg=-Wl,-rpath=$ORIGIN/../lib ".to_string()
+ env::var("RUSTFLAGS").as_deref().unwrap_or(""),
);
} }
} }
cmd.env("RUSTFLAGS", rustflags);
eprintln!("[BUILD] rustc_codegen_cranelift"); eprintln!("[BUILD] rustc_codegen_cranelift");
crate::utils::spawn_and_wait(cmd); crate::utils::spawn_and_wait(cmd);