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

Rollup of 8 pull requests #138768

Merged
merged 18 commits into from
Mar 21, 2025
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
a0c3dd4
Optimize io::Write::write_fmt for constant strings
thaliaarchi Mar 1, 2025
027423d
Fix: add ohos target notes
LuuuXXX Mar 19, 2025
b5069da
Check attrs: Don't try to retrieve the name of list stems
fmease Mar 19, 2025
0199d04
Document results of non-positive logarithms
syvb Mar 19, 2025
8f27449
make it possible to override CI/non-CI environment behaviour
onur-ozkan Mar 20, 2025
b126655
add test for `Config::is_running_on_ci`
onur-ozkan Mar 20, 2025
b5eaeaf
update completion files
onur-ozkan Mar 20, 2025
b9f59f6
interpret memory access hooks: also pass through the Pointer used for…
RalfJung Mar 19, 2025
660509d
Fix the "used_with_archive" test on Fuchsia
Jeff-A-Martin Mar 20, 2025
ff46ea8
Handle spans of `~const`, `const` and `async` trait bounds in macro …
oli-obk Mar 20, 2025
1530b03
Rollup merge of #137357 - syvb:sv/log-docs, r=tgross35
matthiaskrgr Mar 21, 2025
809378b
Rollup merge of #138650 - thaliaarchi:io-write-fmt-known, r=ibraheemdev
matthiaskrgr Mar 21, 2025
ff8738a
Rollup merge of #138694 - LuuuXXX:fix-platform-support-book, r=jieyouxu
matthiaskrgr Mar 21, 2025
7c1b128
Rollup merge of #138713 - RalfJung:memory-hook-pointers, r=oli-obk
matthiaskrgr Mar 21, 2025
1135a63
Rollup merge of #138724 - fmease:list-stems-bear-no-name, r=nnethercote
matthiaskrgr Mar 21, 2025
828f33c
Rollup merge of #138743 - onur-ozkan:override-is-ci-behaviour, r=Kobzol
matthiaskrgr Mar 21, 2025
4447953
Rollup merge of #138751 - Jeff-A-Martin:used-with-archive-test-fuchsi…
matthiaskrgr Mar 21, 2025
5ba395a
Rollup merge of #138754 - oli-obk:push-vtqtnwluyxop, r=compiler-errors
matthiaskrgr Mar 21, 2025
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
Prev Previous commit
Next Next commit
make it possible to override CI/non-CI environment behaviour
Signed-off-by: onur-ozkan <work@onurozkan.dev>
onur-ozkan committed Mar 20, 2025
commit 8f274491a172e635abc447eaa44438e9239b0f05
15 changes: 8 additions & 7 deletions src/bootstrap/src/bin/main.rs
Original file line number Diff line number Diff line change
@@ -14,7 +14,6 @@ use bootstrap::{
Build, CONFIG_CHANGE_HISTORY, Config, Flags, Subcommand, debug, find_recent_config_change_ids,
human_readable_changes, t,
};
use build_helper::ci::CiEnv;
#[cfg(feature = "tracing")]
use tracing::instrument;

@@ -70,12 +69,14 @@ fn main() {
}

// check_version warnings are not printed during setup, or during CI
let changelog_suggestion =
if matches!(config.cmd, Subcommand::Setup { .. }) || CiEnv::is_ci() || config.dry_run() {
None
} else {
check_version(&config)
};
let changelog_suggestion = if matches!(config.cmd, Subcommand::Setup { .. })
|| config.is_running_on_ci
|| config.dry_run()
{
None
} else {
check_version(&config)
};

// NOTE: Since `./configure` generates a `bootstrap.toml`, distro maintainers will see the
// changelog warning, not the `x.py setup` message.
11 changes: 5 additions & 6 deletions src/bootstrap/src/core/build_steps/format.rs
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@ use std::process::Command;
use std::sync::Mutex;
use std::sync::mpsc::SyncSender;

use build_helper::ci::CiEnv;
use build_helper::git::get_git_modified_files;
use ignore::WalkBuilder;

@@ -104,7 +103,7 @@ struct RustfmtConfig {

// Prints output describing a collection of paths, with lines such as "formatted modified file
// foo/bar/baz" or "skipped 20 untracked files".
fn print_paths(verb: &str, adjective: Option<&str>, paths: &[String]) {
fn print_paths(build: &Builder<'_>, verb: &str, adjective: Option<&str>, paths: &[String]) {
let len = paths.len();
let adjective =
if let Some(adjective) = adjective { format!("{adjective} ") } else { String::new() };
@@ -115,7 +114,7 @@ fn print_paths(verb: &str, adjective: Option<&str>, paths: &[String]) {
} else {
println!("fmt: {verb} {len} {adjective}files");
}
if len > 1000 && !CiEnv::is_ci() {
if len > 1000 && !build.config.is_running_on_ci {
println!("hint: if this number seems too high, try running `git fetch origin master`");
}
}
@@ -135,7 +134,7 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
// `--all` is specified or we are in CI. We check all files in CI to avoid bugs in
// `get_modified_rs_files` letting regressions slip through; we also care about CI time less
// since this is still very fast compared to building the compiler.
let all = all || CiEnv::is_ci();
let all = all || build.config.is_running_on_ci;

let mut builder = ignore::types::TypesBuilder::new();
builder.add_defaults();
@@ -190,7 +189,7 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
)
.map(|x| x.to_string())
.collect();
print_paths("skipped", Some("untracked"), &untracked_paths);
print_paths(build, "skipped", Some("untracked"), &untracked_paths);

for untracked_path in untracked_paths {
// The leading `/` makes it an exact match against the
@@ -319,7 +318,7 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
});
let mut paths = formatted_paths.into_inner().unwrap();
paths.sort();
print_paths(if check { "checked" } else { "formatted" }, adjective, &paths);
print_paths(build, if check { "checked" } else { "formatted" }, adjective, &paths);

drop(tx);

4 changes: 1 addition & 3 deletions src/bootstrap/src/core/build_steps/gcc.rs
Original file line number Diff line number Diff line change
@@ -12,8 +12,6 @@ use std::fs;
use std::path::{Path, PathBuf};
use std::sync::OnceLock;

use build_helper::ci::CiEnv;

use crate::core::builder::{Builder, Cargo, Kind, RunConfig, ShouldRun, Step};
use crate::core::config::TargetSelection;
use crate::utils::build_stamp::{BuildStamp, generate_smart_stamp_hash};
@@ -202,7 +200,7 @@ fn build_gcc(metadata: &Meta, builder: &Builder<'_>, target: TargetSelection) {
// source directories as read-only on Linux.
// Therefore, as a part of the build in CI, we first copy the whole source directory
// to the build directory, and perform the build from there.
let src_dir = if CiEnv::is_ci() {
let src_dir = if builder.config.is_running_on_ci {
let src_dir = builder.gcc_out(target).join("src");
if src_dir.exists() {
builder.remove_dir(&src_dir);
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/llvm.rs
Original file line number Diff line number Diff line change
@@ -266,7 +266,7 @@ pub(crate) fn is_ci_llvm_available(config: &Config, asserts: bool) -> bool {
/// Returns true if we're running in CI with modified LLVM (and thus can't download it)
pub(crate) fn is_ci_llvm_modified(config: &Config) -> bool {
// If not running in a CI environment, return false.
if !CiEnv::is_ci() {
if !config.is_running_on_ci {
return false;
}

2 changes: 1 addition & 1 deletion src/bootstrap/src/core/builder/tests.rs
Original file line number Diff line number Diff line change
@@ -264,7 +264,7 @@ fn ci_rustc_if_unchanged_logic() {
let mut paths = vec!["compiler"];

// Handle library tree the same way as in `Config::download_ci_rustc_commit`.
if build_helper::ci::CiEnv::is_ci() {
if builder.config.is_running_on_ci {
paths.push("library");
}

11 changes: 7 additions & 4 deletions src/bootstrap/src/core/config/config.rs
Original file line number Diff line number Diff line change
@@ -415,6 +415,8 @@ pub struct Config {

/// Command for visual diff display, e.g. `diff-tool --color=always`.
pub compiletest_diff_tool: Option<String>,

pub is_running_on_ci: bool,
}

#[derive(Clone, Debug, Default)]
@@ -1422,6 +1424,7 @@ impl Config {
config.llvm_profile_generate = flags.llvm_profile_generate;
config.enable_bolt_settings = flags.enable_bolt_settings;
config.bypass_bootstrap_lock = flags.bypass_bootstrap_lock;
config.is_running_on_ci = flags.ci.unwrap_or(CiEnv::is_ci());

// Infer the rest of the configuration.

@@ -2425,7 +2428,7 @@ impl Config {

// CI should always run stage 2 builds, unless it specifically states otherwise
#[cfg(not(test))]
if flags.stage.is_none() && build_helper::ci::CiEnv::is_ci() {
if flags.stage.is_none() && config.is_running_on_ci {
match config.cmd {
Subcommand::Test { .. }
| Subcommand::Miri { .. }
@@ -2647,7 +2650,7 @@ impl Config {
if !self.llvm_from_ci {
// This happens when LLVM submodule is updated in CI, we should disable ci-rustc without an error
// to not break CI. For non-CI environments, we should return an error.
if CiEnv::is_ci() {
if self.is_running_on_ci {
println!("WARNING: LLVM submodule has changes, `download-rustc` will be disabled.");
return None;
} else {
@@ -3036,7 +3039,7 @@ impl Config {
//
// If you update "library" logic here, update `builder::tests::ci_rustc_if_unchanged_logic` test
// logic accordingly.
if !CiEnv::is_ci() {
if !self.is_running_on_ci {
allowed_paths.push(":!library");
}

@@ -3064,7 +3067,7 @@ impl Config {
.expect("git-commit-info is missing in the project root")
};

if CiEnv::is_ci() && {
if self.is_running_on_ci && {
let head_sha =
output(helpers::git(Some(&self.src)).arg("rev-parse").arg("HEAD").as_command_mut());
let head_sha = head_sha.trim();
3 changes: 3 additions & 0 deletions src/bootstrap/src/core/config/flags.rs
Original file line number Diff line number Diff line change
@@ -179,6 +179,9 @@ pub struct Flags {
/// arguments passed to subcommands
#[arg(global = true, last(true), value_name = "ARGS")]
pub free_args: Vec<String>,
/// Make bootstrap to behave as it's running on the CI environment or not.
#[arg(global = true, long, value_name = "bool")]
pub ci: Option<bool>,
}

impl Flags {
3 changes: 1 addition & 2 deletions src/bootstrap/src/core/download.rs
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@ use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};
use std::sync::OnceLock;

use build_helper::ci::CiEnv;
use xz2::bufread::XzDecoder;

use crate::core::config::BUILDER_CONFIG_FILENAME;
@@ -262,7 +261,7 @@ impl Config {
"--fail",
]);
// Don't print progress in CI; the \r wrapping looks bad and downloads don't take long enough for progress to be useful.
if CiEnv::is_ci() {
if self.is_running_on_ci {
curl.arg("--silent");
} else {
curl.arg("--progress-bar");
3 changes: 1 addition & 2 deletions src/bootstrap/src/utils/render_tests.rs
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@ use std::io::{BufRead, BufReader, Read, Write};
use std::process::{ChildStdout, Stdio};
use std::time::Duration;

use build_helper::ci::CiEnv;
use termcolor::{Color, ColorSpec, WriteColor};

use crate::core::builder::Builder;
@@ -187,7 +186,7 @@ impl<'a> Renderer<'a> {

if self.builder.config.verbose_tests {
self.render_test_outcome_verbose(outcome, test);
} else if CiEnv::is_ci() {
} else if self.builder.config.is_running_on_ci {
self.render_test_outcome_ci(outcome, test);
} else {
self.render_test_outcome_terse(outcome, test);