diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2024-04-05 13:56:21 +0000 |
|---|---|---|
| committer | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2024-04-05 13:59:28 +0000 |
| commit | f269cdd80582ec92972483641676e4a933b583a0 (patch) | |
| tree | 4101f3183e2c344e8c33b0fe2ca5e6e997228a56 | |
| parent | 603b2800f7fa61947b35419f1a5a33e265792001 (diff) | |
| download | rust-f269cdd80582ec92972483641676e4a933b583a0.tar.gz rust-f269cdd80582ec92972483641676e4a933b583a0.zip | |
Move disabling incr comp and denying warnings to the CI config
| -rw-r--r-- | .cirrus.yml | 3 | ||||
| -rw-r--r-- | .github/workflows/main.yml | 8 | ||||
| -rw-r--r-- | build_system/build_backend.rs | 6 | ||||
| -rw-r--r-- | build_system/build_sysroot.rs | 4 | ||||
| -rw-r--r-- | build_system/main.rs | 8 | ||||
| -rw-r--r-- | build_system/utils.rs | 10 |
6 files changed, 18 insertions, 21 deletions
diff --git a/.cirrus.yml b/.cirrus.yml index aa1a2bad2cf..97c2f45d31e 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -13,4 +13,7 @@ task: - ./y.sh prepare test_script: - . $HOME/.cargo/env + # Disabling incr comp reduces cache size and incr comp doesn't save as much + # on CI anyway. + - export CARGO_BUILD_INCREMENTAL=false - ./y.sh test diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8488f437f85..fee5a078396 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,6 +10,14 @@ defaults: permissions: {} +env: + # Disabling incr comp reduces cache size and incr comp doesn't save as much + # on CI anyway. + CARGO_BUILD_INCREMENTAL: false + # Rust's CI denies warnings. Deny them here too to ensure subtree syncs don't + # fail because of warnings. + RUSTFLAGS: "-Dwarnings" + jobs: rustfmt: runs-on: ubuntu-latest diff --git a/build_system/build_backend.rs b/build_system/build_backend.rs index d90111adf77..20f1bba2272 100644 --- a/build_system/build_backend.rs +++ b/build_system/build_backend.rs @@ -3,7 +3,7 @@ use std::path::PathBuf; use crate::path::{Dirs, RelPath}; use crate::rustc_info::get_file_name; use crate::shared_utils::{rustflags_from_env, rustflags_to_cmd_env}; -use crate::utils::{is_ci, is_ci_opt, maybe_incremental, CargoProject, Compiler, LogGroup}; +use crate::utils::{is_ci, is_ci_opt, CargoProject, Compiler, LogGroup}; pub(crate) static CG_CLIF: CargoProject = CargoProject::new(&RelPath::SOURCE, "cg_clif"); @@ -16,16 +16,12 @@ pub(crate) fn build_backend( let _group = LogGroup::guard("Build backend"); let mut cmd = CG_CLIF.build(&bootstrap_host_compiler, dirs); - maybe_incremental(&mut cmd); let mut rustflags = rustflags_from_env("RUSTFLAGS"); rustflags.push("-Zallow-features=rustc_private".to_owned()); if is_ci() { - // Deny warnings on CI - rustflags.push("-Dwarnings".to_owned()); - if !is_ci_opt() { cmd.env("CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS", "true"); cmd.env("CARGO_PROFILE_RELEASE_OVERFLOW_CHECKS", "true"); diff --git a/build_system/build_sysroot.rs b/build_system/build_sysroot.rs index 1ed896c6bf0..10c3f9cfa2c 100644 --- a/build_system/build_sysroot.rs +++ b/build_system/build_sysroot.rs @@ -6,8 +6,7 @@ use std::process::Command; use crate::path::{Dirs, RelPath}; use crate::rustc_info::get_file_name; use crate::utils::{ - maybe_incremental, remove_dir_if_exists, spawn_and_wait, try_hard_link, CargoProject, Compiler, - LogGroup, + remove_dir_if_exists, spawn_and_wait, try_hard_link, CargoProject, Compiler, LogGroup, }; use crate::{config, CodegenBackend, SysrootKind}; @@ -270,7 +269,6 @@ fn build_clif_sysroot_for_triple( } compiler.rustflags.extend(rustflags); let mut build_cmd = STANDARD_LIBRARY.build(&compiler, dirs); - maybe_incremental(&mut build_cmd); if channel == "release" { build_cmd.arg("--release"); } diff --git a/build_system/main.rs b/build_system/main.rs index e8cf486e966..8a80d13ba9b 100644 --- a/build_system/main.rs +++ b/build_system/main.rs @@ -61,15 +61,17 @@ fn main() { env::set_var("CG_CLIF_DISABLE_INCR_CACHE", "1"); if is_ci() { - // Disabling incr comp reduces cache size and incr comp doesn't save as much on CI anyway - env::set_var("CARGO_BUILD_INCREMENTAL", "false"); - if !is_ci_opt() { // Enable the Cranelift verifier env::set_var("CG_CLIF_ENABLE_VERIFIER", "1"); } } + // Force incr comp even in release mode unless in CI or incremental builds are explicitly disabled + if env::var_os("CARGO_BUILD_INCREMENTAL").is_none() { + env::set_var("CARGO_BUILD_INCREMENTAL", "true"); + } + let mut args = env::args().skip(1); let command = match args.next().as_deref() { Some("prepare") => Command::Prepare, diff --git a/build_system/utils.rs b/build_system/utils.rs index 149f1618f5c..7b84ce37859 100644 --- a/build_system/utils.rs +++ b/build_system/utils.rs @@ -288,13 +288,3 @@ impl Drop for LogGroup { IN_GROUP.store(false, Ordering::SeqCst); } } - -pub(crate) fn maybe_incremental(cmd: &mut Command) { - if is_ci() || std::env::var("CARGO_BUILD_INCREMENTAL").map_or(false, |val| val == "false") { - // Disabling incr comp reduces cache size and incr comp doesn't save as much on CI anyway - cmd.env("CARGO_BUILD_INCREMENTAL", "false"); - } else { - // Force incr comp even in release mode unless in CI or incremental builds are explicitly disabled - cmd.env("CARGO_BUILD_INCREMENTAL", "true"); - } -} |
