Skip to content

Commit 35b1673

Browse files
committed
more progress
- add stage override - switch more things to step_info
1 parent 32fd96c commit 35b1673

File tree

4 files changed

+41
-21
lines changed

4 files changed

+41
-21
lines changed

src/bootstrap/builder.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ pub trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash {
7373
paths.iter().map(|pathset| pathset.path(builder)).next().expect("no paths for step")
7474
}
7575

76+
/// The stage that should be passed to x.py to run this step.
77+
fn stage(&self, builder: &Builder<'_>) -> u32 {
78+
builder.top_stage
79+
}
80+
7681
/// Primary function to execute this rule. Can call `builder.ensure()`
7782
/// with other steps to run those.
7883
fn run(self, builder: &Builder<'_>) -> Self::Output;
@@ -655,8 +660,7 @@ impl<'a> Builder<'a> {
655660
// TODO: this is wrong, e.g. `check --stage 1` runs build commands first
656661
self.kind,
657662
step.path(self).display(),
658-
// FIXME: top_stage might be higher than the stage of the step
659-
self.top_stage,
663+
step.stage(self),
660664
);
661665
for arg in self.config.cmd.test_args() {
662666
print!(" --test-args \"{}\"", arg);

src/bootstrap/check.rs

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,11 @@ impl Step for Std {
8686
);
8787
std_cargo(builder, target, compiler.stage, &mut cargo);
8888

89-
builder.info(&format!(
90-
"Checking stage{} std artifacts ({} -> {})",
91-
builder.top_stage, &compiler.host, target
92-
));
89+
builder.step_info(&self);
90+
// builder.info(&format!(
91+
// "Checking stage{} std artifacts ({} -> {})",
92+
// builder.top_stage, &compiler.host, target
93+
// ));
9394
run_cargo(
9495
builder,
9596
cargo,
@@ -206,10 +207,11 @@ impl Step for Rustc {
206207
cargo.arg("-p").arg(krate.name);
207208
}
208209

209-
builder.info(&format!(
210-
"Checking stage{} compiler artifacts ({} -> {})",
211-
builder.top_stage, &compiler.host, target
212-
));
210+
builder.step_info(&self);
211+
// builder.info(&format!(
212+
// "Checking stage{} compiler artifacts ({} -> {})",
213+
// builder.top_stage, &compiler.host, target
214+
// ));
213215
run_cargo(
214216
builder,
215217
cargo,
@@ -328,13 +330,14 @@ macro_rules! tool_check_step {
328330
// See https://github.com/rust-lang/rust/pull/80573#issuecomment-754010776
329331
cargo.rustflag("-Zunstable-options");
330332

331-
builder.info(&format!(
332-
"Checking stage{} {} artifacts ({} -> {})",
333-
builder.top_stage,
334-
stringify!($name).to_lowercase(),
335-
&compiler.host.triple,
336-
target.triple
337-
));
333+
builder.step_info(&self);
334+
// builder.info(&format!(
335+
// "Checking stage{} {} artifacts ({} -> {})",
336+
// builder.top_stage,
337+
// stringify!($name).to_lowercase(),
338+
// &compiler.host.triple,
339+
// target.triple
340+
// ));
338341
run_cargo(
339342
builder,
340343
cargo,

src/bootstrap/compile.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,10 @@ impl Step for Rustc {
519519
});
520520
}
521521

522+
fn stage(&self, _builder: &Builder<'_>) -> u32 {
523+
self.compiler.stage
524+
}
525+
522526
/// Builds the compiler.
523527
///
524528
/// This will build the compiler for a particular stage of the build using
@@ -603,10 +607,11 @@ impl Step for Rustc {
603607
));
604608
}
605609

606-
builder.info(&format!(
607-
"Building stage{} compiler artifacts ({} -> {})",
608-
compiler.stage, &compiler.host, target
609-
));
610+
builder.step_info(&self);
611+
// builder.info(&format!(
612+
// "Building stage{} compiler artifacts ({} -> {})",
613+
// compiler.stage, &compiler.host, target
614+
// ));
610615
run_cargo(
611616
builder,
612617
cargo,

src/bootstrap/tool.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,10 @@ macro_rules! bootstrap_tool {
319319
impl Step for $name {
320320
type Output = PathBuf;
321321

322+
fn stage(&self, _builder: &Builder<'_>) -> u32 {
323+
self.compiler.stage
324+
}
325+
322326
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
323327
run.path($path)
324328
}
@@ -595,6 +599,10 @@ impl Step for Cargo {
595599
const DEFAULT: bool = true;
596600
const ONLY_HOSTS: bool = true;
597601

602+
fn stage(&self, _builder: &Builder<'_>) -> u32 {
603+
self.compiler.stage
604+
}
605+
598606
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
599607
let builder = run.builder;
600608
run.path("src/tools/cargo").default_condition(

0 commit comments

Comments
 (0)