Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit e7bc81c

Browse files
committed
Disable incr comp globally on CI
1 parent 41d5478 commit e7bc81c

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

build_system/build_backend.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ use std::env;
22
use std::path::{Path, PathBuf};
33
use std::process::Command;
44

5+
use super::utils::is_ci;
6+
57
pub(crate) fn build_backend(
68
channel: &str,
79
host_triple: &str,
@@ -14,12 +16,9 @@ pub(crate) fn build_backend(
1416

1517
let mut rustflags = env::var("RUSTFLAGS").unwrap_or_default();
1618

17-
if env::var("CI").as_ref().map(|val| &**val) == Ok("true") {
19+
if is_ci() {
1820
// Deny warnings on CI
1921
rustflags += " -Dwarnings";
20-
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");
2322
}
2423

2524
if use_unstable_features {

build_system/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ use std::env;
22
use std::path::PathBuf;
33
use std::process;
44

5+
use self::utils::is_ci;
6+
57
mod build_backend;
68
mod build_sysroot;
79
mod config;
@@ -48,6 +50,11 @@ pub fn main() {
4850
// The target dir is expected in the default location. Guard against the user changing it.
4951
env::set_var("CARGO_TARGET_DIR", "target");
5052

53+
if is_ci() {
54+
// Disabling incr comp reduces cache size and incr comp doesn't save as much on CI anyway
55+
env::set_var("CARGO_BUILD_INCREMENTAL", "false");
56+
}
57+
5158
let mut args = env::args().skip(1);
5259
let command = match args.next().as_deref() {
5360
Some("prepare") => {

build_system/utils.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use std::env;
12
use std::fs;
23
use std::io::Write;
34
use std::path::Path;
@@ -55,3 +56,7 @@ pub(crate) fn copy_dir_recursively(from: &Path, to: &Path) {
5556
}
5657
}
5758
}
59+
60+
pub(crate) fn is_ci() -> bool {
61+
env::var("CI").as_ref().map(|val| &**val) == Ok("true")
62+
}

0 commit comments

Comments
 (0)