Skip to content

Commit f269cdd

Browse files
committed
Move disabling incr comp and denying warnings to the CI config
1 parent 603b280 commit f269cdd

File tree

6 files changed

+18
-21
lines changed

6 files changed

+18
-21
lines changed

.cirrus.yml

+3
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,7 @@ task:
1313
- ./y.sh prepare
1414
test_script:
1515
- . $HOME/.cargo/env
16+
# Disabling incr comp reduces cache size and incr comp doesn't save as much
17+
# on CI anyway.
18+
- export CARGO_BUILD_INCREMENTAL=false
1619
- ./y.sh test

.github/workflows/main.yml

+8
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ defaults:
1010

1111
permissions: {}
1212

13+
env:
14+
# Disabling incr comp reduces cache size and incr comp doesn't save as much
15+
# on CI anyway.
16+
CARGO_BUILD_INCREMENTAL: false
17+
# Rust's CI denies warnings. Deny them here too to ensure subtree syncs don't
18+
# fail because of warnings.
19+
RUSTFLAGS: "-Dwarnings"
20+
1321
jobs:
1422
rustfmt:
1523
runs-on: ubuntu-latest

build_system/build_backend.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::path::PathBuf;
33
use crate::path::{Dirs, RelPath};
44
use crate::rustc_info::get_file_name;
55
use crate::shared_utils::{rustflags_from_env, rustflags_to_cmd_env};
6-
use crate::utils::{is_ci, is_ci_opt, maybe_incremental, CargoProject, Compiler, LogGroup};
6+
use crate::utils::{is_ci, is_ci_opt, CargoProject, Compiler, LogGroup};
77

88
pub(crate) static CG_CLIF: CargoProject = CargoProject::new(&RelPath::SOURCE, "cg_clif");
99

@@ -16,16 +16,12 @@ pub(crate) fn build_backend(
1616
let _group = LogGroup::guard("Build backend");
1717

1818
let mut cmd = CG_CLIF.build(&bootstrap_host_compiler, dirs);
19-
maybe_incremental(&mut cmd);
2019

2120
let mut rustflags = rustflags_from_env("RUSTFLAGS");
2221

2322
rustflags.push("-Zallow-features=rustc_private".to_owned());
2423

2524
if is_ci() {
26-
// Deny warnings on CI
27-
rustflags.push("-Dwarnings".to_owned());
28-
2925
if !is_ci_opt() {
3026
cmd.env("CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS", "true");
3127
cmd.env("CARGO_PROFILE_RELEASE_OVERFLOW_CHECKS", "true");

build_system/build_sysroot.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ use std::process::Command;
66
use crate::path::{Dirs, RelPath};
77
use crate::rustc_info::get_file_name;
88
use crate::utils::{
9-
maybe_incremental, remove_dir_if_exists, spawn_and_wait, try_hard_link, CargoProject, Compiler,
10-
LogGroup,
9+
remove_dir_if_exists, spawn_and_wait, try_hard_link, CargoProject, Compiler, LogGroup,
1110
};
1211
use crate::{config, CodegenBackend, SysrootKind};
1312

@@ -270,7 +269,6 @@ fn build_clif_sysroot_for_triple(
270269
}
271270
compiler.rustflags.extend(rustflags);
272271
let mut build_cmd = STANDARD_LIBRARY.build(&compiler, dirs);
273-
maybe_incremental(&mut build_cmd);
274272
if channel == "release" {
275273
build_cmd.arg("--release");
276274
}

build_system/main.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,17 @@ fn main() {
6161
env::set_var("CG_CLIF_DISABLE_INCR_CACHE", "1");
6262

6363
if is_ci() {
64-
// Disabling incr comp reduces cache size and incr comp doesn't save as much on CI anyway
65-
env::set_var("CARGO_BUILD_INCREMENTAL", "false");
66-
6764
if !is_ci_opt() {
6865
// Enable the Cranelift verifier
6966
env::set_var("CG_CLIF_ENABLE_VERIFIER", "1");
7067
}
7168
}
7269

70+
// Force incr comp even in release mode unless in CI or incremental builds are explicitly disabled
71+
if env::var_os("CARGO_BUILD_INCREMENTAL").is_none() {
72+
env::set_var("CARGO_BUILD_INCREMENTAL", "true");
73+
}
74+
7375
let mut args = env::args().skip(1);
7476
let command = match args.next().as_deref() {
7577
Some("prepare") => Command::Prepare,

build_system/utils.rs

-10
Original file line numberDiff line numberDiff line change
@@ -288,13 +288,3 @@ impl Drop for LogGroup {
288288
IN_GROUP.store(false, Ordering::SeqCst);
289289
}
290290
}
291-
292-
pub(crate) fn maybe_incremental(cmd: &mut Command) {
293-
if is_ci() || std::env::var("CARGO_BUILD_INCREMENTAL").map_or(false, |val| val == "false") {
294-
// Disabling incr comp reduces cache size and incr comp doesn't save as much on CI anyway
295-
cmd.env("CARGO_BUILD_INCREMENTAL", "false");
296-
} else {
297-
// Force incr comp even in release mode unless in CI or incremental builds are explicitly disabled
298-
cmd.env("CARGO_BUILD_INCREMENTAL", "true");
299-
}
300-
}

0 commit comments

Comments
 (0)