Skip to content

Commit 545b92f

Browse files
Avoid printing output when in dry run mode
1 parent a727447 commit 545b92f

File tree

9 files changed

+105
-94
lines changed

9 files changed

+105
-94
lines changed

src/bootstrap/compile.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl Step for Std {
7777
compiler: from,
7878
target,
7979
});
80-
println!("Uplifting stage1 std ({} -> {})", from.host, target);
80+
builder.info(&format!("Uplifting stage1 std ({} -> {})", from.host, target));
8181

8282
// Even if we're not building std this stage, the new sysroot must
8383
// still contain the musl startup objects.
@@ -105,8 +105,8 @@ impl Step for Std {
105105
std_cargo(builder, &compiler, target, &mut cargo);
106106

107107
let _folder = build.fold_output(|| format!("stage{}-std", compiler.stage));
108-
println!("Building stage{} std artifacts ({} -> {})", compiler.stage,
109-
&compiler.host, target);
108+
build.info(&format!("Building stage{} std artifacts ({} -> {})", compiler.stage,
109+
&compiler.host, target));
110110
run_cargo(build,
111111
&mut cargo,
112112
&libstd_stamp(build, compiler, target),
@@ -213,12 +213,12 @@ impl Step for StdLink {
213213
let compiler = self.compiler;
214214
let target_compiler = self.target_compiler;
215215
let target = self.target;
216-
println!("Copying stage{} std from stage{} ({} -> {} / {})",
216+
build.info(&format!("Copying stage{} std from stage{} ({} -> {} / {})",
217217
target_compiler.stage,
218218
compiler.stage,
219219
&compiler.host,
220220
target_compiler.host,
221-
target);
221+
target));
222222
let libdir = builder.sysroot_libdir(target_compiler, target);
223223
add_to_sysroot(&build, &libdir, &libstd_stamp(build, compiler, target));
224224

@@ -352,7 +352,7 @@ impl Step for Test {
352352
compiler: builder.compiler(1, build.build),
353353
target,
354354
});
355-
println!("Uplifting stage1 test ({} -> {})", &build.build, target);
355+
build.info(&format!("Uplifting stage1 test ({} -> {})", &build.build, target));
356356
builder.ensure(TestLink {
357357
compiler: builder.compiler(1, build.build),
358358
target_compiler: compiler,
@@ -367,8 +367,8 @@ impl Step for Test {
367367
test_cargo(build, &compiler, target, &mut cargo);
368368

369369
let _folder = build.fold_output(|| format!("stage{}-test", compiler.stage));
370-
println!("Building stage{} test artifacts ({} -> {})", compiler.stage,
371-
&compiler.host, target);
370+
build.info(&format!("Building stage{} test artifacts ({} -> {})", compiler.stage,
371+
&compiler.host, target));
372372
run_cargo(build,
373373
&mut cargo,
374374
&libtest_stamp(build, compiler, target),
@@ -414,12 +414,12 @@ impl Step for TestLink {
414414
let compiler = self.compiler;
415415
let target_compiler = self.target_compiler;
416416
let target = self.target;
417-
println!("Copying stage{} test from stage{} ({} -> {} / {})",
417+
build.info(&format!("Copying stage{} test from stage{} ({} -> {} / {})",
418418
target_compiler.stage,
419419
compiler.stage,
420420
&compiler.host,
421421
target_compiler.host,
422-
target);
422+
target));
423423
add_to_sysroot(&build, &builder.sysroot_libdir(target_compiler, target),
424424
&libtest_stamp(build, compiler, target));
425425
builder.ensure(tool::CleanTools {
@@ -469,7 +469,7 @@ impl Step for Rustc {
469469
compiler: builder.compiler(1, build.build),
470470
target,
471471
});
472-
println!("Uplifting stage1 rustc ({} -> {})", &build.build, target);
472+
build.info(&format!("Uplifting stage1 rustc ({} -> {})", &build.build, target));
473473
builder.ensure(RustcLink {
474474
compiler: builder.compiler(1, build.build),
475475
target_compiler: compiler,
@@ -491,8 +491,8 @@ impl Step for Rustc {
491491
rustc_cargo(build, &mut cargo);
492492

493493
let _folder = build.fold_output(|| format!("stage{}-rustc", compiler.stage));
494-
println!("Building stage{} compiler artifacts ({} -> {})",
495-
compiler.stage, &compiler.host, target);
494+
build.info(&format!("Building stage{} compiler artifacts ({} -> {})",
495+
compiler.stage, &compiler.host, target));
496496
run_cargo(build,
497497
&mut cargo,
498498
&librustc_stamp(build, compiler, target),
@@ -569,12 +569,12 @@ impl Step for RustcLink {
569569
let compiler = self.compiler;
570570
let target_compiler = self.target_compiler;
571571
let target = self.target;
572-
println!("Copying stage{} rustc from stage{} ({} -> {} / {})",
572+
build.info(&format!("Copying stage{} rustc from stage{} ({} -> {} / {})",
573573
target_compiler.stage,
574574
compiler.stage,
575575
&compiler.host,
576576
target_compiler.host,
577-
target);
577+
target));
578578
add_to_sysroot(&build, &builder.sysroot_libdir(target_compiler, target),
579579
&librustc_stamp(build, compiler, target));
580580
builder.ensure(tool::CleanTools {
@@ -648,8 +648,8 @@ impl Step for CodegenBackend {
648648
features.push_str(" emscripten");
649649
}
650650

651-
println!("Building stage{} codegen artifacts ({} -> {}, {})",
652-
compiler.stage, &compiler.host, target, self.backend);
651+
build.info(&format!("Building stage{} codegen artifacts ({} -> {}, {})",
652+
compiler.stage, &compiler.host, target, self.backend));
653653

654654
// Pass down configuration from the LLVM build into the build of
655655
// librustc_llvm and librustc_trans.
@@ -933,7 +933,7 @@ impl Step for Assemble {
933933

934934
let stage = target_compiler.stage;
935935
let host = target_compiler.host;
936-
println!("Assembling stage{} compiler ({})", stage, host);
936+
build.info(&format!("Assembling stage{} compiler ({})", stage, host));
937937

938938
// Link in all dylibs to the libdir
939939
let sysroot = builder.sysroot(target_compiler);
@@ -1186,7 +1186,7 @@ pub fn stream_cargo(
11861186
// Make sure Cargo actually succeeded after we read all of its stdout.
11871187
let status = t!(child.wait());
11881188
if !status.success() {
1189-
println!("command did not execute successfully: {:?}\n\
1189+
eprintln!("command did not execute successfully: {:?}\n\
11901190
expected success, got: {}",
11911191
cargo,
11921192
status);

src/bootstrap/dist.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ impl Step for Docs {
8989

9090
let name = pkgname(build, "rust-docs");
9191

92-
println!("Dist docs ({})", host);
92+
build.info(&format!("Dist docs ({})", host));
9393
if !build.config.docs {
94-
println!("\tskipping - docs disabled");
94+
build.info(&format!("\tskipping - docs disabled"));
9595
return distdir(build).join(format!("{}-{}.tar.gz", name, host));
9696
}
9797

@@ -152,9 +152,9 @@ impl Step for RustcDocs {
152152

153153
let name = pkgname(build, "rustc-docs");
154154

155-
println!("Dist compiler docs ({})", host);
155+
build.info(&format!("Dist compiler docs ({})", host));
156156
if !build.config.compiler_docs {
157-
println!("\tskipping - compiler docs disabled");
157+
build.info(&format!("\tskipping - compiler docs disabled"));
158158
return distdir(build).join(format!("{}-{}.tar.gz", name, host));
159159
}
160160

@@ -343,7 +343,7 @@ impl Step for Mingw {
343343
return None;
344344
}
345345

346-
println!("Dist mingw ({})", host);
346+
build.info(&format!("Dist mingw ({})", host));
347347
let name = pkgname(build, "rust-mingw");
348348
let image = tmpdir(build).join(format!("{}-{}-image", name, host));
349349
let _ = fs::remove_dir_all(&image);
@@ -398,7 +398,7 @@ impl Step for Rustc {
398398
let compiler = self.compiler;
399399
let host = self.compiler.host;
400400

401-
println!("Dist rustc stage{} ({})", compiler.stage, compiler.host);
401+
build.info(&format!("Dist rustc stage{} ({})", compiler.stage, compiler.host));
402402
let name = pkgname(build, "rustc");
403403
let image = tmpdir(build).join(format!("{}-{}-image", name, host));
404404
let _ = fs::remove_dir_all(&image);
@@ -627,12 +627,12 @@ impl Step for Std {
627627
let target = self.target;
628628

629629
let name = pkgname(build, "rust-std");
630-
println!("Dist std stage{} ({} -> {})", compiler.stage, &compiler.host, target);
630+
build.info(&format!("Dist std stage{} ({} -> {})", compiler.stage, &compiler.host, target));
631631

632632
// The only true set of target libraries came from the build triple, so
633633
// let's reduce redundant work by only producing archives from that host.
634634
if compiler.host != build.build {
635-
println!("\tskipping, not a build host");
635+
build.info(&format!("\tskipping, not a build host"));
636636
return distdir(build).join(format!("{}-{}.tar.gz", name, target));
637637
}
638638

@@ -704,11 +704,11 @@ impl Step for Analysis {
704704
let compiler = self.compiler;
705705
let target = self.target;
706706
assert!(build.config.extended);
707-
println!("Dist analysis");
707+
build.info(&format!("Dist analysis"));
708708
let name = pkgname(build, "rust-analysis");
709709

710710
if &compiler.host != build.build {
711-
println!("\tskipping, not a build host");
711+
build.info(&format!("\tskipping, not a build host"));
712712
return distdir(build).join(format!("{}-{}.tar.gz", name, target));
713713
}
714714

@@ -730,7 +730,7 @@ impl Step for Analysis {
730730
let image_src = src.join("save-analysis");
731731
let dst = image.join("lib/rustlib").join(target).join("analysis");
732732
t!(fs::create_dir_all(&dst));
733-
println!("image_src: {:?}, dst: {:?}", image_src, dst);
733+
build.info(&format!("image_src: {:?}, dst: {:?}", image_src, dst));
734734
build.cp_r(&image_src, &dst);
735735

736736
let mut cmd = rust_installer(builder);
@@ -813,7 +813,7 @@ impl Step for Src {
813813
/// Creates the `rust-src` installer component
814814
fn run(self, builder: &Builder) -> PathBuf {
815815
let build = builder.build;
816-
println!("Dist src");
816+
build.info(&format!("Dist src"));
817817

818818
let name = pkgname(build, "rust-src");
819819
let image = tmpdir(build).join(format!("{}-image", name));
@@ -908,7 +908,7 @@ impl Step for PlainSourceTarball {
908908
/// Creates the plain source tarball
909909
fn run(self, builder: &Builder) -> PathBuf {
910910
let build = builder.build;
911-
println!("Create plain source tarball");
911+
build.info(&format!("Create plain source tarball"));
912912

913913
// Make sure that the root folder of tarball has the correct name
914914
let plain_name = format!("{}-src", pkgname(build, "rustc"));
@@ -985,7 +985,7 @@ impl Step for PlainSourceTarball {
985985
if let Some(dir) = tarball.parent() {
986986
build.create_dir(&dir);
987987
}
988-
println!("running installer");
988+
build.info(&format!("running installer"));
989989
let mut cmd = rust_installer(builder);
990990
cmd.arg("tarball")
991991
.arg("--input").arg(&plain_name)
@@ -1042,7 +1042,7 @@ impl Step for Cargo {
10421042
let stage = self.stage;
10431043
let target = self.target;
10441044

1045-
println!("Dist cargo stage{} ({})", stage, target);
1045+
build.info(&format!("Dist cargo stage{} ({})", stage, target));
10461046
let src = build.src.join("src/tools/cargo");
10471047
let etc = src.join("src/etc");
10481048
let release_num = build.release_num("cargo");
@@ -1130,7 +1130,7 @@ impl Step for Rls {
11301130
let target = self.target;
11311131
assert!(build.config.extended);
11321132

1133-
println!("Dist RLS stage{} ({})", stage, target);
1133+
build.info(&format!("Dist RLS stage{} ({})", stage, target));
11341134
let src = build.src.join("src/tools/rls");
11351135
let release_num = build.release_num("rls");
11361136
let name = pkgname(build, "rls");
@@ -1210,7 +1210,7 @@ impl Step for Rustfmt {
12101210
let stage = self.stage;
12111211
let target = self.target;
12121212

1213-
println!("Dist Rustfmt stage{} ({})", stage, target);
1213+
build.info(&format!("Dist Rustfmt stage{} ({})", stage, target));
12141214
let src = build.src.join("src/tools/rustfmt");
12151215
let release_num = build.release_num("rustfmt");
12161216
let name = pkgname(build, "rustfmt");
@@ -1297,7 +1297,7 @@ impl Step for Extended {
12971297
let stage = self.stage;
12981298
let target = self.target;
12991299

1300-
println!("Dist extended stage{} ({})", stage, target);
1300+
build.info(&format!("Dist extended stage{} ({})", stage, target));
13011301

13021302
let rustc_installer = builder.ensure(Rustc {
13031303
compiler: builder.compiler(stage, target),

src/bootstrap/doc.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ impl Step for CargoBook {
169169

170170
let out = out.join(name);
171171

172-
println!("Cargo Book ({}) - {}", target, name);
172+
build.info(&format!("Cargo Book ({}) - {}", target, name));
173173

174174
let _ = fs::remove_dir_all(&out);
175175

@@ -215,7 +215,7 @@ impl Step for RustbookSrc {
215215
if up_to_date(&src, &index) && up_to_date(&rustbook, &index) {
216216
return
217217
}
218-
println!("Rustbook ({}) - {}", target, name);
218+
build.info(&format!("Rustbook ({}) - {}", target, name));
219219
let _ = fs::remove_dir_all(&out);
220220
build.run(rustbook_cmd
221221
.arg("build")
@@ -283,11 +283,11 @@ impl Step for TheBook {
283283

284284
// build the index page
285285
let index = format!("{}/index.md", name);
286-
println!("Documenting book index ({})", target);
286+
build.info(&format!("Documenting book index ({})", target));
287287
invoke_rustdoc(builder, compiler, target, &index);
288288

289289
// build the redirect pages
290-
println!("Documenting book redirect pages ({})", target);
290+
build.info(&format!("Documenting book redirect pages ({})", target));
291291
for file in t!(fs::read_dir(build.src.join("src/doc/book/redirects"))) {
292292
let file = t!(file);
293293
let path = file.path();
@@ -360,7 +360,7 @@ impl Step for Standalone {
360360
let build = builder.build;
361361
let target = self.target;
362362
let compiler = self.compiler;
363-
println!("Documenting standalone ({})", target);
363+
build.info(&format!("Documenting standalone ({})", target));
364364
let out = build.doc_out(target);
365365
t!(fs::create_dir_all(&out));
366366

@@ -451,7 +451,7 @@ impl Step for Std {
451451
let build = builder.build;
452452
let stage = self.stage;
453453
let target = self.target;
454-
println!("Documenting stage{} std ({})", stage, target);
454+
build.info(&format!("Documenting stage{} std ({})", stage, target));
455455
let out = build.doc_out(target);
456456
t!(fs::create_dir_all(&out));
457457
let compiler = builder.compiler(stage, build.build);
@@ -532,7 +532,7 @@ impl Step for Test {
532532
let build = builder.build;
533533
let stage = self.stage;
534534
let target = self.target;
535-
println!("Documenting stage{} test ({})", stage, target);
535+
build.info(&format!("Documenting stage{} test ({})", stage, target));
536536
let out = build.doc_out(target);
537537
t!(fs::create_dir_all(&out));
538538
let compiler = builder.compiler(stage, build.build);
@@ -598,7 +598,7 @@ impl Step for WhitelistedRustc {
598598
let build = builder.build;
599599
let stage = self.stage;
600600
let target = self.target;
601-
println!("Documenting stage{} whitelisted compiler ({})", stage, target);
601+
build.info(&format!("Documenting stage{} whitelisted compiler ({})", stage, target));
602602
let out = build.doc_out(target);
603603
t!(fs::create_dir_all(&out));
604604
let compiler = builder.compiler(stage, build.build);
@@ -670,7 +670,7 @@ impl Step for Rustc {
670670
let build = builder.build;
671671
let stage = self.stage;
672672
let target = self.target;
673-
println!("Documenting stage{} compiler ({})", stage, target);
673+
build.info(&format!("Documenting stage{} compiler ({})", stage, target));
674674
let out = build.compiler_doc_out(target);
675675
t!(fs::create_dir_all(&out));
676676
let compiler = builder.compiler(stage, build.build);
@@ -682,7 +682,7 @@ impl Step for Rustc {
682682
};
683683

684684
if !build.config.compiler_docs {
685-
println!("\tskipping - compiler docs disabled");
685+
build.info(&format!("\tskipping - compiler docs disabled"));
686686
return;
687687
}
688688

@@ -761,7 +761,7 @@ impl Step for ErrorIndex {
761761
let build = builder.build;
762762
let target = self.target;
763763

764-
println!("Documenting error index ({})", target);
764+
build.info(&format!("Documenting error index ({})", target));
765765
let out = build.doc_out(target);
766766
t!(fs::create_dir_all(&out));
767767
let mut index = builder.tool_cmd(Tool::ErrorIndex);
@@ -806,7 +806,7 @@ impl Step for UnstableBookGen {
806806
target,
807807
});
808808

809-
println!("Generating unstable book md files ({})", target);
809+
build.info(&format!("Generating unstable book md files ({})", target));
810810
let out = build.md_doc_out(target).join("unstable-book");
811811
build.create_dir(&out);
812812
build.remove_dir(&out);

0 commit comments

Comments
 (0)