Remove all checks for CI in the build system

And introduce the CG_CLIF_EXPENSIVE_CHECKS env var in the place.
This commit is contained in:
bjorn3 2024-04-02 14:17:35 +00:00
parent f269cdd805
commit 1bab6df32b
4 changed files with 14 additions and 26 deletions

View file

@ -44,6 +44,9 @@ jobs:
runs-on: ${{ matrix.os }}
timeout-minutes: 60
env:
CG_CLIF_EXPENSIVE_CHECKS: 1
strategy:
fail-fast: false
matrix:
@ -182,10 +185,10 @@ jobs:
run: ./y.sh prepare
- name: Build
run: CI_OPT=1 ./y.sh build --sysroot none
run: ./y.sh build --sysroot none
- name: Benchmark
run: CI_OPT=1 ./y.sh bench
run: ./y.sh bench
dist:
@ -237,10 +240,10 @@ jobs:
run: ./y.sh prepare
- name: Build backend
run: CI_OPT=1 ./y.sh build --sysroot none
run: ./y.sh build --sysroot none
- name: Build sysroot
run: CI_OPT=1 ./y.sh build
run: ./y.sh build
- name: Package prebuilt cg_clif
run: tar cvfJ cg_clif.tar.xz dist

View file

@ -1,9 +1,10 @@
use std::env;
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, CargoProject, Compiler, LogGroup};
use crate::utils::{CargoProject, Compiler, LogGroup};
pub(crate) static CG_CLIF: CargoProject = CargoProject::new(&RelPath::SOURCE, "cg_clif");
@ -21,11 +22,10 @@ pub(crate) fn build_backend(
rustflags.push("-Zallow-features=rustc_private".to_owned());
if is_ci() {
if !is_ci_opt() {
cmd.env("CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS", "true");
cmd.env("CARGO_PROFILE_RELEASE_OVERFLOW_CHECKS", "true");
}
if env::var("CG_CLIF_EXPENSIVE_CHECKS").is_ok() {
// Enabling debug assertions implicitly enables the clif ir verifier
cmd.env("CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS", "true");
cmd.env("CARGO_PROFILE_RELEASE_OVERFLOW_CHECKS", "true");
}
if use_unstable_features {

View file

@ -6,7 +6,7 @@
use std::path::PathBuf;
use std::process;
use self::utils::{is_ci, is_ci_opt, Compiler};
use self::utils::Compiler;
mod abi_cafe;
mod bench;
@ -60,13 +60,6 @@ fn main() {
}
env::set_var("CG_CLIF_DISABLE_INCR_CACHE", "1");
if is_ci() {
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");

View file

@ -254,14 +254,6 @@ pub(crate) fn copy_dir_recursively(from: &Path, to: &Path) {
}
}
pub(crate) fn is_ci() -> bool {
env::var("CI").is_ok()
}
pub(crate) fn is_ci_opt() -> bool {
env::var("CI_OPT").is_ok()
}
static IN_GROUP: AtomicBool = AtomicBool::new(false);
pub(crate) struct LogGroup {
is_gha: bool,