Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e3b0b1c

Browse files
committedMar 15, 2025
Auto merge of #138395 - Kobzol:ci-download-gcc, r=<try>
Download GCC from CI on test builders This should reduce the duration of the `x86_64-gnu-llvm-18` job, which runs on PR CI, which is currently the only one that builds GCC (outside of the x64 dist builder). Since we handle the GCC download in the GCC step, and not eagerly in config, we can set this flag globally across all test builders, as it won't do anything unless they actually try to build GCC. Opening as a draft to test if it works on CI, because I still need to implement logic to avoid the download if there are any local modifications to GCC (essentially the "if-unchanged" mode, although I want to try something a bit different). r? `@ghost`
2 parents 4d30011 + fc33895 commit e3b0b1c

File tree

4 files changed

+69
-9
lines changed

4 files changed

+69
-9
lines changed
 

‎config.example.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@
171171
# Note that this will attempt to download GCC even if there are local
172172
# modifications to the `src/gcc` submodule.
173173
# Currently, this is only supported for the `x86_64-unknown-linux-gnu` target.
174-
# download-ci-gcc = false
174+
#download-ci-gcc = false
175175

176176
# =============================================================================
177177
# General build configuration options

‎src/bootstrap/src/bin/main.rs

+64-7
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
1+
#![allow(unused)]
12
//! bootstrap, the Rust build system
23
//!
34
//! This is the entry point for the build system used to compile the `rustc`
45
//! compiler. Lots of documentation can be found in the `README.md` file in the
56
//! parent directory, and otherwise documentation can be found throughout the `build`
67
//! directory in each respective module.
78
8-
use std::fs::{self, OpenOptions};
9-
use std::io::{self, BufRead, BufReader, IsTerminal, Write};
10-
use std::str::FromStr;
11-
use std::{env, process};
12-
139
use bootstrap::{
1410
Build, CONFIG_CHANGE_HISTORY, Config, Flags, Subcommand, debug, find_recent_config_change_ids,
1511
human_readable_changes, t,
1612
};
1713
use build_helper::ci::CiEnv;
14+
use build_helper::git::get_closest_merge_commit;
15+
use std::fs::{self, OpenOptions};
16+
use std::io::{self, BufRead, BufReader, IsTerminal, Write};
17+
use std::process::Command;
18+
use std::str::FromStr;
19+
use std::{env, process};
1820
#[cfg(feature = "tracing")]
1921
use tracing::instrument;
2022

@@ -34,7 +36,62 @@ fn main() {
3436
debug!("parsing config based on flags");
3537
let config = Config::parse(flags);
3638

37-
let mut build_lock;
39+
let merge_commit1 =
40+
get_closest_merge_commit(Some(&config.src), &config.git_config(), &[]).unwrap();
41+
let merge_commit2 = String::from_utf8(
42+
Command::new("git")
43+
.args([
44+
"rev-list",
45+
&format!("--author=bors@rust-lang.org"),
46+
"-n1",
47+
"--first-parent",
48+
"HEAD",
49+
])
50+
.output()
51+
.unwrap()
52+
.stdout,
53+
)
54+
.unwrap();
55+
let merge_commit3 = String::from_utf8(
56+
Command::new("git")
57+
.args([
58+
"rev-list",
59+
&format!("--author=bors@rust-lang.org"),
60+
"-n1",
61+
"--first-parent",
62+
"HEAD^1",
63+
])
64+
.output()
65+
.unwrap()
66+
.stdout,
67+
)
68+
.unwrap();
69+
let current_commit = String::from_utf8(
70+
Command::new("git").arg("rev-parse").arg("HEAD").output().unwrap().stdout,
71+
)
72+
.unwrap();
73+
let git_history = String::from_utf8(
74+
Command::new("git")
75+
.arg("log")
76+
.arg("--oneline")
77+
.arg("-n")
78+
.arg("20")
79+
.arg("--pretty=format:%h %an %ae %s")
80+
.output()
81+
.unwrap()
82+
.stdout,
83+
)
84+
.unwrap();
85+
panic!(
86+
r#"
87+
Merge commit1: {merge_commit1}
88+
Merge commit2: {merge_commit2}
89+
Merge commit3: {merge_commit3}
90+
HEAD: {current_commit}
91+
{git_history}"#
92+
);
93+
94+
/*let mut build_lock;
3895
let _build_lock_guard;
3996
4097
if !config.bypass_bootstrap_lock {
@@ -145,7 +202,7 @@ fn main() {
145202
let mut file = t!(OpenOptions::new().write(true).truncate(true).open(entry.path()));
146203
t!(file.write_all(lines.join("\n").as_bytes()));
147204
}
148-
}
205+
}*/
149206
}
150207

151208
fn check_version(config: &Config) -> Option<String> {

‎src/ci/github-actions/jobs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ envs:
9090
# - not running `opt-dist`'s post-optimization smoke tests on the resulting toolchain
9191
#
9292
# If you *want* these to happen however, temporarily comment it before triggering a try build.
93-
DIST_TRY_BUILD: 1
93+
# DIST_TRY_BUILD: 1
9494

9595
auto:
9696
<<: *production

‎src/ci/run.sh

+3
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ else
179179
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set llvm.static-libstdcpp"
180180
fi
181181

182+
# Download GCC from CI on test builders
183+
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set gcc.download-ci-gcc=true"
184+
182185
if [ "$NO_DOWNLOAD_CI_RUSTC" = "" ]; then
183186
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set rust.download-rustc=if-unchanged"
184187
fi

0 commit comments

Comments
 (0)
Failed to load comments.