Skip to content

Commit e24f28a

Browse files
committed
Add StepInfo
1 parent c55e2bd commit e24f28a

File tree

11 files changed

+404
-29
lines changed

11 files changed

+404
-29
lines changed

src/bootstrap/builder.rs

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pub(crate) trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash {
6868
std::any::type_name::<Self>()
6969
}
7070

71-
fn info(_step_info: &mut StepInfo<'_, '_, Self>) {}
71+
fn info(_step_info: &mut StepInfo<'_, '_, Self>);
7272

7373
/// The path that should be used on the command line to run this step.
7474
fn path(&self, builder: &Builder<'_>) -> PathBuf {
@@ -706,6 +706,11 @@ impl<'a> Builder<'a> {
706706
run.never()
707707
}
708708

709+
fn info(step_info: &mut StepInfo<'_, '_, Self>) {
710+
let step = step_info.step;
711+
step_info.compiler(&step.compiler).target(step.target).cmd(Kind::Check);
712+
}
713+
709714
fn run(self, builder: &Builder<'_>) -> Interned<PathBuf> {
710715
let lib = builder.sysroot_libdir_relative(self.compiler);
711716
let sysroot = builder
@@ -1822,15 +1827,25 @@ impl<'a, 'b, S> StepInfo<'a, 'b, S> {
18221827
}
18231828
// let stage = self.stage.unwrap_or(self.builder.top_stage);
18241829
let stage = self.stage.expect("missing stage");
1825-
let host = self.host;
1826-
let kind = self.cmd.unwrap_or(self.builder.kind);
1827-
let target = self.target;
1828-
print!("{} {} --stage {}", kind, self.step.path(self.builder).display(), stage,);
1829-
if let Some(host) = host {
1830-
print!(" --host {}", host);
1831-
}
1832-
if let Some(target) = target {
1833-
print!(" --target {}", target);
1830+
// let kind = self.cmd.unwrap_or(self.builder.kind);
1831+
let kind = self.cmd.expect("missing kind");
1832+
print!(
1833+
"{} {} --stage {}",
1834+
kind,
1835+
self.step.path(self.builder).display(),
1836+
stage,
1837+
);
1838+
if let Some(host) = self.host {
1839+
// Almost always, this will be the same as build. Don't print it if so.
1840+
if host != self.builder.config.build {
1841+
print!(" --host {}", host);
1842+
}
1843+
}
1844+
if let Some(target) = self.target {
1845+
let different_from_host = self.host.map_or(false, |h| h != target);
1846+
if target != self.builder.config.build || different_from_host {
1847+
print!(" --target {}", target);
1848+
}
18341849
}
18351850
if kind == Kind::Test {
18361851
for arg in self.builder.config.cmd.test_args() {

src/bootstrap/check.rs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,11 @@ impl Step for CodegenBackend {
262262
}
263263
}
264264

265+
fn info(step_info: &mut StepInfo<'_, '_, Self>) {
266+
let step = step_info.step;
267+
step_info.target(step.target).cmd(Kind::Check);
268+
}
269+
265270
fn run(self, builder: &Builder<'_>) {
266271
let compiler = builder.compiler(builder.top_stage, builder.config.build);
267272
let target = self.target;
@@ -281,10 +286,11 @@ impl Step for CodegenBackend {
281286
.arg(builder.src.join(format!("compiler/rustc_codegen_{}/Cargo.toml", backend)));
282287
rustc_cargo_env(builder, &mut cargo, target);
283288

284-
builder.info(&format!(
285-
"Checking stage{} {} artifacts ({} -> {})",
286-
builder.top_stage, backend, &compiler.host.triple, target.triple
287-
));
289+
builder.step_info(&self);
290+
// builder.info(&format!(
291+
// "Checking stage{} {} artifacts ({} -> {})",
292+
// builder.top_stage, backend, &compiler.host.triple, target.triple
293+
// ));
288294

289295
run_cargo(
290296
builder,
@@ -318,6 +324,13 @@ macro_rules! tool_check_step {
318324
run.builder.ensure($name { target: run.target });
319325
}
320326

327+
fn info(step_info: &mut StepInfo<'_, '_, Self>) {
328+
let step = step_info.step;
329+
let builder = step_info.builder;
330+
let compiler = builder.compiler(builder.top_stage, builder.config.build);
331+
step_info.compiler(compiler).target(step.target).cmd(Kind::Check);
332+
}
333+
321334
fn run(self, builder: &Builder<'_>) {
322335
let compiler = builder.compiler(builder.top_stage, builder.config.build);
323336
let target = self.target;

src/bootstrap/compile.rs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,6 @@ impl Step for Std {
113113
std_cargo(builder, target, compiler.stage, &mut cargo);
114114

115115
builder.step_info(&self);
116-
// builder.info(&format!(
117-
// "Building stage{} std artifacts ({} -> {})",
118-
// compiler.stage, &compiler.host, target
119-
// ));
120116
run_cargo(
121117
builder,
122118
cargo,
@@ -357,6 +353,8 @@ impl Step for StdLink {
357353
run.never()
358354
}
359355

356+
fn info(_step_info: &mut StepInfo<'_, '_, Self>) {}
357+
360358
/// Link all libstd rlibs/dylibs into the sysroot location.
361359
///
362360
/// Links those artifacts generated by `compiler` to the `stage` compiler's
@@ -453,6 +451,11 @@ impl Step for StartupObjects {
453451
});
454452
}
455453

454+
fn info(step_info: &mut StepInfo<'_, '_, Self>) {
455+
let step = step_info.step;
456+
step_info.compiler(&step.compiler).cmd(Kind::Build);
457+
}
458+
456459
/// Builds and prepare startup objects like rsbegin.o and rsend.o
457460
///
458461
/// These are primarily used on Windows right now for linking executables/dlls.
@@ -614,10 +617,6 @@ impl Step for Rustc {
614617
}
615618

616619
builder.step_info(&self);
617-
// builder.info(&format!(
618-
// "Building stage{} compiler artifacts ({} -> {})",
619-
// compiler.stage, &compiler.host, target
620-
// ));
621620
run_cargo(
622621
builder,
623622
cargo,
@@ -735,6 +734,8 @@ impl Step for RustcLink {
735734
run.never()
736735
}
737736

737+
fn info(_step_info: &mut StepInfo<'_, '_, Self>) {}
738+
738739
/// Same as `std_link`, only for librustc
739740
fn run(self, builder: &Builder<'_>) {
740741
let compiler = self.compiler;
@@ -784,6 +785,11 @@ impl Step for CodegenBackend {
784785
}
785786
}
786787

788+
fn info(step_info: &mut StepInfo<'_, '_, Self>) {
789+
let step = step_info.step;
790+
step_info.compiler(&step.compiler).target(step.target).cmd(Kind::Build);
791+
}
792+
787793
fn run(self, builder: &Builder<'_>) {
788794
let compiler = self.compiler;
789795
let target = self.target;
@@ -945,6 +951,8 @@ impl Step for Sysroot {
945951
run.never()
946952
}
947953

954+
fn info(_step_info: &mut StepInfo<'_, '_, Self>) {}
955+
948956
/// Returns the sysroot for the `compiler` specified that *this build system
949957
/// generates*.
950958
///
@@ -1017,6 +1025,8 @@ impl Step for Assemble {
10171025
run.never()
10181026
}
10191027

1028+
fn info(_step_info: &mut StepInfo<'_, '_, Self>) {}
1029+
10201030
/// Prepare a new compiler from the artifacts in `stage`
10211031
///
10221032
/// This will assemble a compiler in `build/$host/stage$stage`. The compiler

0 commit comments

Comments
 (0)