Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify the use of CiEnv #128342

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2087,7 +2087,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
let git_config = builder.config.git_config();
cmd.arg("--git-repository").arg(git_config.git_repository);
cmd.arg("--nightly-branch").arg(git_config.nightly_branch);
cmd.force_coloring_in_ci(builder.ci_env);
cmd.force_coloring_in_ci();

#[cfg(feature = "build-metrics")]
builder.metrics.begin_test_suite(
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2157,7 +2157,7 @@ impl<'a> Builder<'a> {
// Try to use a sysroot-relative bindir, in case it was configured absolutely.
cargo.env("RUSTC_INSTALL_BINDIR", self.config.bindir_relative());

cargo.force_coloring_in_ci(self.ci_env);
cargo.force_coloring_in_ci();

// When we build Rust dylibs they're all intended for intermediate
// usage, so make sure we pass the -Cprefer-dynamic flag instead of
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2092,7 +2092,7 @@ impl Config {

// CI should always run stage 2 builds, unless it specifically states otherwise
#[cfg(not(test))]
if flags.stage.is_none() && crate::CiEnv::current() != crate::CiEnv::None {
if flags.stage.is_none() && build_helper::ci::CiEnv::is_ci() {
match config.cmd {
Subcommand::Test { .. }
| Subcommand::Miri { .. }
Expand Down
4 changes: 1 addition & 3 deletions src/bootstrap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use std::sync::OnceLock;
use std::time::SystemTime;
use std::{env, io, str};

use build_helper::ci::{gha, CiEnv};
use build_helper::ci::gha;
use build_helper::exit;
use sha2::digest::Digest;
use termcolor::{ColorChoice, StandardStream, WriteColor};
Expand Down Expand Up @@ -168,7 +168,6 @@ pub struct Build {
crates: HashMap<String, Crate>,
crate_paths: HashMap<PathBuf, String>,
is_sudo: bool,
ci_env: CiEnv,
delayed_failures: RefCell<Vec<String>>,
prerelease_version: Cell<Option<u32>>,

Expand Down Expand Up @@ -400,7 +399,6 @@ impl Build {
crates: HashMap::new(),
crate_paths: HashMap::new(),
is_sudo,
ci_env: CiEnv::current(),
delayed_failures: RefCell::new(Vec::new()),
prerelease_version: Cell::new(None),

Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/src/utils/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ impl BootstrapCommand {
}

/// If in a CI environment, forces the command to run with colors.
pub fn force_coloring_in_ci(&mut self, ci_env: CiEnv) {
if ci_env != CiEnv::None {
pub fn force_coloring_in_ci(&mut self) {
if CiEnv::is_ci() {
// Due to use of stamp/docker, the output stream of bootstrap is not
// a TTY in CI, so coloring is by-default turned off.
// The explicit `TERM=xterm` environment is needed for
Expand Down
Loading