Skip to content

Commit 8976029

Browse files
committed
Do not deny warnings for fast try builds
1 parent 34495f5 commit 8976029

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

src/tools/opt-dist/src/environment.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ pub struct Environment {
2626
use_bolt: bool,
2727
shared_llvm: bool,
2828
run_tests: bool,
29+
fast_try_build: bool,
2930
}
3031

3132
impl Environment {
@@ -106,6 +107,10 @@ impl Environment {
106107
pub fn run_tests(&self) -> bool {
107108
self.run_tests
108109
}
110+
111+
pub fn is_fast_try_build(&self) -> bool {
112+
self.fast_try_build
113+
}
109114
}
110115

111116
/// What is the extension of binary executables on this platform?

src/tools/opt-dist/src/exec.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,16 @@ impl Bootstrap {
113113
"library/std",
114114
])
115115
.env("RUST_BACKTRACE", "full");
116+
let cmd = add_shared_x_flags(env, cmd);
117+
116118
Self { cmd, metrics_path }
117119
}
118120

119121
pub fn dist(env: &Environment, dist_args: &[String]) -> Self {
120122
let metrics_path = env.build_root().join("build").join("metrics.json");
121-
let cmd = cmd(&dist_args.iter().map(|arg| arg.as_str()).collect::<Vec<_>>())
122-
.env("RUST_BACKTRACE", "full");
123+
let args = dist_args.iter().map(|arg| arg.as_str()).collect::<Vec<_>>();
124+
let cmd = cmd(&args).env("RUST_BACKTRACE", "full");
125+
let cmd = add_shared_x_flags(env, cmd);
123126
Self { cmd, metrics_path }
124127
}
125128

@@ -184,3 +187,7 @@ impl Bootstrap {
184187
Ok(())
185188
}
186189
}
190+
191+
fn add_shared_x_flags(env: &Environment, cmd: CmdBuilder) -> CmdBuilder {
192+
if env.is_fast_try_build() { cmd.arg("--set").arg("rust.deny-warnings=false") } else { cmd }
193+
}

src/tools/opt-dist/src/main.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,13 @@ enum EnvironmentCmd {
111111
},
112112
}
113113

114-
fn is_try_build() -> bool {
114+
/// Are we supposed to only build the bare minimum of components to get a working toolchain?
115+
fn is_fast_try_build() -> bool {
115116
std::env::var("DIST_TRY_BUILD").unwrap_or_else(|_| "0".to_string()) != "0"
116117
}
117118

118119
fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)> {
120+
let is_fast_try_build = is_fast_try_build();
119121
let (env, args) = match args.env {
120122
EnvironmentCmd::Local {
121123
target_triple,
@@ -144,6 +146,7 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
144146
.skipped_tests(skipped_tests)
145147
.benchmark_cargo_config(benchmark_cargo_config)
146148
.run_tests(run_tests)
149+
.fast_try_build(is_fast_try_build)
147150
.build()?;
148151

149152
(env, shared.build_args)
@@ -167,6 +170,7 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
167170
.use_bolt(!is_aarch64)
168171
.skipped_tests(vec![])
169172
.run_tests(true)
173+
.fast_try_build(is_fast_try_build)
170174
.build()?;
171175

172176
(env, shared.build_args)
@@ -187,6 +191,7 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
187191
.use_bolt(false)
188192
.skipped_tests(vec![])
189193
.run_tests(true)
194+
.fast_try_build(is_fast_try_build)
190195
.build()?;
191196

192197
(env, shared.build_args)
@@ -352,7 +357,7 @@ fn execute_pipeline(
352357
// possible regressions.
353358
// The tests are not executed for try builds, which can be in various broken states, so we don't
354359
// want to gatekeep them with tests.
355-
if !is_try_build() && env.run_tests() {
360+
if !is_fast_try_build() && env.run_tests() {
356361
timer.section("Run tests", |_| run_tests(env))?;
357362
}
358363

@@ -397,7 +402,7 @@ fn main() -> anyhow::Result<()> {
397402
let (env, mut build_args) = create_environment(args).context("Cannot create environment")?;
398403

399404
// Skip components that are not needed for try builds to speed them up
400-
if is_try_build() {
405+
if is_fast_try_build() {
401406
log::info!("Skipping building of unimportant components for a try build");
402407
for target in [
403408
"rust-docs",

0 commit comments

Comments
 (0)