diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 872c29085289a1bcfbe17c9a9bda8f31510717ac..da57881202d17af8b09a92210d2edb3eb1c82ef5 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -77,7 +77,7 @@ fn run(self, builder: &Builder) { compiler: from, target, }); - println!("Uplifting stage1 std ({} -> {})", from.host, target); + builder.info(&format!("Uplifting stage1 std ({} -> {})", from.host, target)); // Even if we're not building std this stage, the new sysroot must // still contain the musl startup objects. @@ -105,8 +105,8 @@ fn run(self, builder: &Builder) { std_cargo(builder, &compiler, target, &mut cargo); let _folder = build.fold_output(|| format!("stage{}-std", compiler.stage)); - println!("Building stage{} std artifacts ({} -> {})", compiler.stage, - &compiler.host, target); + build.info(&format!("Building stage{} std artifacts ({} -> {})", compiler.stage, + &compiler.host, target)); run_cargo(build, &mut cargo, &libstd_stamp(build, compiler, target), @@ -213,12 +213,12 @@ fn run(self, builder: &Builder) { let compiler = self.compiler; let target_compiler = self.target_compiler; let target = self.target; - println!("Copying stage{} std from stage{} ({} -> {} / {})", + build.info(&format!("Copying stage{} std from stage{} ({} -> {} / {})", target_compiler.stage, compiler.stage, &compiler.host, target_compiler.host, - target); + target)); let libdir = builder.sysroot_libdir(target_compiler, target); add_to_sysroot(&build, &libdir, &libstd_stamp(build, compiler, target)); @@ -352,7 +352,7 @@ fn run(self, builder: &Builder) { compiler: builder.compiler(1, build.build), target, }); - println!("Uplifting stage1 test ({} -> {})", &build.build, target); + build.info(&format!("Uplifting stage1 test ({} -> {})", &build.build, target)); builder.ensure(TestLink { compiler: builder.compiler(1, build.build), target_compiler: compiler, @@ -367,8 +367,8 @@ fn run(self, builder: &Builder) { test_cargo(build, &compiler, target, &mut cargo); let _folder = build.fold_output(|| format!("stage{}-test", compiler.stage)); - println!("Building stage{} test artifacts ({} -> {})", compiler.stage, - &compiler.host, target); + build.info(&format!("Building stage{} test artifacts ({} -> {})", compiler.stage, + &compiler.host, target)); run_cargo(build, &mut cargo, &libtest_stamp(build, compiler, target), @@ -414,12 +414,12 @@ fn run(self, builder: &Builder) { let compiler = self.compiler; let target_compiler = self.target_compiler; let target = self.target; - println!("Copying stage{} test from stage{} ({} -> {} / {})", + build.info(&format!("Copying stage{} test from stage{} ({} -> {} / {})", target_compiler.stage, compiler.stage, &compiler.host, target_compiler.host, - target); + target)); add_to_sysroot(&build, &builder.sysroot_libdir(target_compiler, target), &libtest_stamp(build, compiler, target)); builder.ensure(tool::CleanTools { @@ -469,7 +469,7 @@ fn run(self, builder: &Builder) { compiler: builder.compiler(1, build.build), target, }); - println!("Uplifting stage1 rustc ({} -> {})", &build.build, target); + build.info(&format!("Uplifting stage1 rustc ({} -> {})", &build.build, target)); builder.ensure(RustcLink { compiler: builder.compiler(1, build.build), target_compiler: compiler, @@ -491,8 +491,8 @@ fn run(self, builder: &Builder) { rustc_cargo(build, &mut cargo); let _folder = build.fold_output(|| format!("stage{}-rustc", compiler.stage)); - println!("Building stage{} compiler artifacts ({} -> {})", - compiler.stage, &compiler.host, target); + build.info(&format!("Building stage{} compiler artifacts ({} -> {})", + compiler.stage, &compiler.host, target)); run_cargo(build, &mut cargo, &librustc_stamp(build, compiler, target), @@ -569,12 +569,12 @@ fn run(self, builder: &Builder) { let compiler = self.compiler; let target_compiler = self.target_compiler; let target = self.target; - println!("Copying stage{} rustc from stage{} ({} -> {} / {})", + build.info(&format!("Copying stage{} rustc from stage{} ({} -> {} / {})", target_compiler.stage, compiler.stage, &compiler.host, target_compiler.host, - target); + target)); add_to_sysroot(&build, &builder.sysroot_libdir(target_compiler, target), &librustc_stamp(build, compiler, target)); builder.ensure(tool::CleanTools { @@ -648,8 +648,8 @@ fn run(self, builder: &Builder) { features.push_str(" emscripten"); } - println!("Building stage{} codegen artifacts ({} -> {}, {})", - compiler.stage, &compiler.host, target, self.backend); + build.info(&format!("Building stage{} codegen artifacts ({} -> {}, {})", + compiler.stage, &compiler.host, target, self.backend)); // Pass down configuration from the LLVM build into the build of // librustc_llvm and librustc_trans. @@ -933,7 +933,7 @@ fn run(self, builder: &Builder) -> Compiler { let stage = target_compiler.stage; let host = target_compiler.host; - println!("Assembling stage{} compiler ({})", stage, host); + build.info(&format!("Assembling stage{} compiler ({})", stage, host)); // Link in all dylibs to the libdir let sysroot = builder.sysroot(target_compiler); @@ -1186,7 +1186,7 @@ pub fn stream_cargo( // Make sure Cargo actually succeeded after we read all of its stdout. let status = t!(child.wait()); if !status.success() { - println!("command did not execute successfully: {:?}\n\ + eprintln!("command did not execute successfully: {:?}\n\ expected success, got: {}", cargo, status); diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 86ef5c35cd7f419d5a00544ea2842d8bb4e5a24d..774f4e6e8bf2579cfe484bde6afa3a910fcd31da 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -89,9 +89,9 @@ fn run(self, builder: &Builder) -> PathBuf { let name = pkgname(build, "rust-docs"); - println!("Dist docs ({})", host); + build.info(&format!("Dist docs ({})", host)); if !build.config.docs { - println!("\tskipping - docs disabled"); + build.info(&format!("\tskipping - docs disabled")); return distdir(build).join(format!("{}-{}.tar.gz", name, host)); } @@ -152,9 +152,9 @@ fn run(self, builder: &Builder) -> PathBuf { let name = pkgname(build, "rustc-docs"); - println!("Dist compiler docs ({})", host); + build.info(&format!("Dist compiler docs ({})", host)); if !build.config.compiler_docs { - println!("\tskipping - compiler docs disabled"); + build.info(&format!("\tskipping - compiler docs disabled")); return distdir(build).join(format!("{}-{}.tar.gz", name, host)); } @@ -343,7 +343,7 @@ fn run(self, builder: &Builder) -> Option { return None; } - println!("Dist mingw ({})", host); + build.info(&format!("Dist mingw ({})", host)); let name = pkgname(build, "rust-mingw"); let image = tmpdir(build).join(format!("{}-{}-image", name, host)); let _ = fs::remove_dir_all(&image); @@ -398,7 +398,7 @@ fn run(self, builder: &Builder) -> PathBuf { let compiler = self.compiler; let host = self.compiler.host; - println!("Dist rustc stage{} ({})", compiler.stage, compiler.host); + build.info(&format!("Dist rustc stage{} ({})", compiler.stage, compiler.host)); let name = pkgname(build, "rustc"); let image = tmpdir(build).join(format!("{}-{}-image", name, host)); let _ = fs::remove_dir_all(&image); @@ -627,12 +627,12 @@ fn run(self, builder: &Builder) -> PathBuf { let target = self.target; let name = pkgname(build, "rust-std"); - println!("Dist std stage{} ({} -> {})", compiler.stage, &compiler.host, target); + build.info(&format!("Dist std stage{} ({} -> {})", compiler.stage, &compiler.host, target)); // The only true set of target libraries came from the build triple, so // let's reduce redundant work by only producing archives from that host. if compiler.host != build.build { - println!("\tskipping, not a build host"); + build.info(&format!("\tskipping, not a build host")); return distdir(build).join(format!("{}-{}.tar.gz", name, target)); } @@ -704,11 +704,11 @@ fn run(self, builder: &Builder) -> PathBuf { let compiler = self.compiler; let target = self.target; assert!(build.config.extended); - println!("Dist analysis"); + build.info(&format!("Dist analysis")); let name = pkgname(build, "rust-analysis"); if &compiler.host != build.build { - println!("\tskipping, not a build host"); + build.info(&format!("\tskipping, not a build host")); return distdir(build).join(format!("{}-{}.tar.gz", name, target)); } @@ -730,7 +730,7 @@ fn run(self, builder: &Builder) -> PathBuf { let image_src = src.join("save-analysis"); let dst = image.join("lib/rustlib").join(target).join("analysis"); t!(fs::create_dir_all(&dst)); - println!("image_src: {:?}, dst: {:?}", image_src, dst); + build.info(&format!("image_src: {:?}, dst: {:?}", image_src, dst)); build.cp_r(&image_src, &dst); let mut cmd = rust_installer(builder); @@ -813,7 +813,7 @@ fn make_run(run: RunConfig) { /// Creates the `rust-src` installer component fn run(self, builder: &Builder) -> PathBuf { let build = builder.build; - println!("Dist src"); + build.info(&format!("Dist src")); let name = pkgname(build, "rust-src"); let image = tmpdir(build).join(format!("{}-image", name)); @@ -908,7 +908,7 @@ fn make_run(run: RunConfig) { /// Creates the plain source tarball fn run(self, builder: &Builder) -> PathBuf { let build = builder.build; - println!("Create plain source tarball"); + build.info(&format!("Create plain source tarball")); // Make sure that the root folder of tarball has the correct name let plain_name = format!("{}-src", pkgname(build, "rustc")); @@ -985,7 +985,7 @@ fn run(self, builder: &Builder) -> PathBuf { if let Some(dir) = tarball.parent() { build.create_dir(&dir); } - println!("running installer"); + build.info(&format!("running installer")); let mut cmd = rust_installer(builder); cmd.arg("tarball") .arg("--input").arg(&plain_name) @@ -1042,7 +1042,7 @@ fn run(self, builder: &Builder) -> PathBuf { let stage = self.stage; let target = self.target; - println!("Dist cargo stage{} ({})", stage, target); + build.info(&format!("Dist cargo stage{} ({})", stage, target)); let src = build.src.join("src/tools/cargo"); let etc = src.join("src/etc"); let release_num = build.release_num("cargo"); @@ -1130,7 +1130,7 @@ fn run(self, builder: &Builder) -> Option { let target = self.target; assert!(build.config.extended); - println!("Dist RLS stage{} ({})", stage, target); + build.info(&format!("Dist RLS stage{} ({})", stage, target)); let src = build.src.join("src/tools/rls"); let release_num = build.release_num("rls"); let name = pkgname(build, "rls"); @@ -1210,7 +1210,7 @@ fn run(self, builder: &Builder) -> Option { let stage = self.stage; let target = self.target; - println!("Dist Rustfmt stage{} ({})", stage, target); + build.info(&format!("Dist Rustfmt stage{} ({})", stage, target)); let src = build.src.join("src/tools/rustfmt"); let release_num = build.release_num("rustfmt"); let name = pkgname(build, "rustfmt"); @@ -1297,7 +1297,7 @@ fn run(self, builder: &Builder) { let stage = self.stage; let target = self.target; - println!("Dist extended stage{} ({})", stage, target); + build.info(&format!("Dist extended stage{} ({})", stage, target)); let rustc_installer = builder.ensure(Rustc { compiler: builder.compiler(stage, target), diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index eeea6f0d01d2acb3cffe8fdeb21b993f4e8b3bc5..f07c3e707574b4e4a051fc6e9b1f9e0950b82917 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -169,7 +169,7 @@ fn run(self, builder: &Builder) { let out = out.join(name); - println!("Cargo Book ({}) - {}", target, name); + build.info(&format!("Cargo Book ({}) - {}", target, name)); let _ = fs::remove_dir_all(&out); @@ -215,7 +215,7 @@ fn run(self, builder: &Builder) { if up_to_date(&src, &index) && up_to_date(&rustbook, &index) { return } - println!("Rustbook ({}) - {}", target, name); + build.info(&format!("Rustbook ({}) - {}", target, name)); let _ = fs::remove_dir_all(&out); build.run(rustbook_cmd .arg("build") @@ -283,11 +283,11 @@ fn run(self, builder: &Builder) { // build the index page let index = format!("{}/index.md", name); - println!("Documenting book index ({})", target); + build.info(&format!("Documenting book index ({})", target)); invoke_rustdoc(builder, compiler, target, &index); // build the redirect pages - println!("Documenting book redirect pages ({})", target); + build.info(&format!("Documenting book redirect pages ({})", target)); for file in t!(fs::read_dir(build.src.join("src/doc/book/redirects"))) { let file = t!(file); let path = file.path(); @@ -360,7 +360,7 @@ fn run(self, builder: &Builder) { let build = builder.build; let target = self.target; let compiler = self.compiler; - println!("Documenting standalone ({})", target); + build.info(&format!("Documenting standalone ({})", target)); let out = build.doc_out(target); t!(fs::create_dir_all(&out)); @@ -451,7 +451,7 @@ fn run(self, builder: &Builder) { let build = builder.build; let stage = self.stage; let target = self.target; - println!("Documenting stage{} std ({})", stage, target); + build.info(&format!("Documenting stage{} std ({})", stage, target)); let out = build.doc_out(target); t!(fs::create_dir_all(&out)); let compiler = builder.compiler(stage, build.build); @@ -532,7 +532,7 @@ fn run(self, builder: &Builder) { let build = builder.build; let stage = self.stage; let target = self.target; - println!("Documenting stage{} test ({})", stage, target); + build.info(&format!("Documenting stage{} test ({})", stage, target)); let out = build.doc_out(target); t!(fs::create_dir_all(&out)); let compiler = builder.compiler(stage, build.build); @@ -598,7 +598,7 @@ fn run(self, builder: &Builder) { let build = builder.build; let stage = self.stage; let target = self.target; - println!("Documenting stage{} whitelisted compiler ({})", stage, target); + build.info(&format!("Documenting stage{} whitelisted compiler ({})", stage, target)); let out = build.doc_out(target); t!(fs::create_dir_all(&out)); let compiler = builder.compiler(stage, build.build); @@ -670,7 +670,7 @@ fn run(self, builder: &Builder) { let build = builder.build; let stage = self.stage; let target = self.target; - println!("Documenting stage{} compiler ({})", stage, target); + build.info(&format!("Documenting stage{} compiler ({})", stage, target)); let out = build.compiler_doc_out(target); t!(fs::create_dir_all(&out)); let compiler = builder.compiler(stage, build.build); @@ -682,7 +682,7 @@ fn run(self, builder: &Builder) { }; if !build.config.compiler_docs { - println!("\tskipping - compiler docs disabled"); + build.info(&format!("\tskipping - compiler docs disabled")); return; } @@ -761,7 +761,7 @@ fn run(self, builder: &Builder) { let build = builder.build; let target = self.target; - println!("Documenting error index ({})", target); + build.info(&format!("Documenting error index ({})", target)); let out = build.doc_out(target); t!(fs::create_dir_all(&out)); let mut index = builder.tool_cmd(Tool::ErrorIndex); @@ -806,7 +806,7 @@ fn run(self, builder: &Builder) { target, }); - println!("Generating unstable book md files ({})", target); + build.info(&format!("Generating unstable book md files ({})", target)); let out = build.md_doc_out(target).join("unstable-book"); build.create_dir(&out); build.remove_dir(&out); diff --git a/src/bootstrap/install.rs b/src/bootstrap/install.rs index 0d7c1b8de63234d728ed584cc0e15c646754c7d7..4b05cac1ce6979123e0637c5169c9dd2a4b9dff4 100644 --- a/src/bootstrap/install.rs +++ b/src/bootstrap/install.rs @@ -63,7 +63,7 @@ fn install_sh( host: Option> ) { let build = builder.build; - println!("Install {} stage{} ({:?})", package, stage, host); + build.info(&format!("Install {} stage{} ({:?})", package, stage, host)); let prefix_default = PathBuf::from("/usr/local"); let sysconfdir_default = PathBuf::from("/etc"); @@ -212,7 +212,7 @@ fn run($sel, $builder: &Builder) { Self::should_install(builder) { install_rls(builder, self.stage, self.target); } else { - println!("skipping Install RLS stage{} ({})", self.stage, self.target); + builder.info(&format!("skipping Install RLS stage{} ({})", self.stage, self.target)); } }; Rustfmt, "rustfmt", Self::should_build(_config), only_hosts: true, { @@ -220,7 +220,8 @@ fn run($sel, $builder: &Builder) { Self::should_install(builder) { install_rustfmt(builder, self.stage, self.target); } else { - println!("skipping Install Rustfmt stage{} ({})", self.stage, self.target); + builder.info( + &format!("skipping Install Rustfmt stage{} ({})", self.stage, self.target)); } }; Analysis, "analysis", Self::should_build(_config), only_hosts: false, { diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 7b37c9cefa5cb5e1220a27816672c6a7b4049712..c677d78d07b1fce6aabf235a6d83c766ae06c3e5 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -667,6 +667,11 @@ fn verbose(&self, msg: &str) { } } + fn info(&self, msg: &str) { + if self.config.dry_run { return; } + println!("{}", msg); + } + /// Returns the number of parallel jobs that have been configured for this /// build. fn jobs(&self) -> u32 { @@ -974,7 +979,7 @@ fn unstable_features(&self) -> bool { pub fn fold_output(&self, name: F) -> Option where D: Into, F: FnOnce() -> D { - if self.ci_env == CiEnv::Travis { + if !self.config.dry_run && self.ci_env == CiEnv::Travis { Some(OutputFolder::new(name().into())) } else { None diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index c49811d839a04dfdaf8c52ff68e7f2c2b384751d..c92d5c6f7ca497420163ed58a6a7fc375014112b 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -106,8 +106,8 @@ fn run(self, builder: &Builder) -> PathBuf { let _folder = build.fold_output(|| "llvm"); let descriptor = if emscripten { "Emscripten " } else { "" }; - println!("Building {}LLVM for {}", descriptor, target); - let _time = util::timeit(); + build.info(&format!("Building {}LLVM for {}", descriptor, target)); + let _time = util::timeit(&build); t!(fs::create_dir_all(&out_dir)); // http://llvm.org/docs/CMake.html @@ -359,8 +359,8 @@ fn run(self, builder: &Builder) -> PathBuf { } let _folder = build.fold_output(|| "lld"); - println!("Building LLD for {}", target); - let _time = util::timeit(); + build.info(&format!("Building LLD for {}", target)); + let _time = util::timeit(&build); t!(fs::create_dir_all(&out_dir)); let mut cfg = cmake::Config::new(build.src.join("src/tools/lld")); @@ -409,7 +409,7 @@ fn run(self, builder: &Builder) { } let _folder = build.fold_output(|| "build_test_helpers"); - println!("Building test helpers"); + build.info(&format!("Building test helpers")); t!(fs::create_dir_all(&dst)); let mut cfg = cc::Build::new(); @@ -605,11 +605,11 @@ fn run(self, builder: &Builder) { configure.arg("no-asm"); } configure.current_dir(&obj); - println!("Configuring openssl for {}", target); + build.info(&format!("Configuring openssl for {}", target)); build.run_quiet(&mut configure); - println!("Building openssl for {}", target); + build.info(&format!("Building openssl for {}", target)); build.run_quiet(Command::new("make").arg("-j1").current_dir(&obj)); - println!("Installing openssl for {}", target); + build.info(&format!("Installing openssl for {}", target)); build.run_quiet(Command::new("make").arg("install").arg("-j1").current_dir(&obj)); let mut f = t!(File::create(&stamp)); diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 2fb84db4d897e15d4193e6db4033349d03b683ae..39740a83b0d0a804d267fa33eb7fbfc948a94e3c 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -109,11 +109,11 @@ fn run(self, builder: &Builder) { let build = builder.build; let host = self.host; - println!("Linkcheck ({})", host); + build.info(&format!("Linkcheck ({})", host)); builder.default_doc(None); - let _time = util::timeit(); + let _time = util::timeit(&build); try_run(build, builder.tool_cmd(Tool::Linkchecker) .arg(build.out.join(host).join("doc"))); } @@ -164,7 +164,7 @@ fn run(self, builder: &Builder) { let out_dir = build.out.join("ct"); t!(fs::create_dir_all(&out_dir)); - let _time = util::timeit(); + let _time = util::timeit(&build); let mut cmd = builder.tool_cmd(Tool::CargoTest); try_run(build, cmd.arg(&build.initial_cargo) .arg(&out_dir) @@ -509,7 +509,7 @@ fn run(self, builder: &Builder) { }); builder.run(&mut command); } else { - println!("No nodejs found, skipping \"src/test/rustdoc-js\" tests"); + builder.info(&format!("No nodejs found, skipping \"src/test/rustdoc-js\" tests")); } } } @@ -541,7 +541,7 @@ fn run(self, builder: &Builder) { } let _folder = build.fold_output(|| "tidy"); - println!("tidy check"); + builder.info(&format!("tidy check")); try_run(build, &mut cmd); } @@ -948,7 +948,8 @@ fn run(self, builder: &Builder) { } } if suite == "run-make-fulldeps" && !build.config.llvm_enabled { - println!("Ignoring run-make test suite as they generally don't work without LLVM"); + builder.info( + &format!("Ignoring run-make test suite as they generally don't work without LLVM")); return; } @@ -1002,9 +1003,9 @@ fn run(self, builder: &Builder) { build.ci_env.force_coloring_in_ci(&mut cmd); let _folder = build.fold_output(|| format!("test_{}", suite)); - println!("Check compiletest suite={} mode={} ({} -> {})", - suite, mode, &compiler.host, target); - let _time = util::timeit(); + builder.info(&format!("Check compiletest suite={} mode={} ({} -> {})", + suite, mode, &compiler.host, target)); + let _time = util::timeit(&build); try_run(build, &mut cmd); } } @@ -1039,7 +1040,7 @@ fn run(self, builder: &Builder) { // Do a breadth-first traversal of the `src/doc` directory and just run // tests for all files that end in `*.md` let mut stack = vec![build.src.join(self.path)]; - let _time = util::timeit(); + let _time = util::timeit(&build); let _folder = build.fold_output(|| format!("test_{}", self.name)); let mut files = Vec::new(); @@ -1167,8 +1168,8 @@ fn run(self, builder: &Builder) { let _folder = build.fold_output(|| "test_error_index"); - println!("Testing error-index stage{}", compiler.stage); - let _time = util::timeit(); + build.info(&format!("Testing error-index stage{}", compiler.stage)); + let _time = util::timeit(&build); build.run(&mut tool); markdown_test(builder, compiler, &output); } @@ -1183,7 +1184,7 @@ fn markdown_test(builder: &Builder, compiler: Compiler, markdown: &Path) -> bool return true; } - println!("doc tests for: {}", markdown.display()); + build.info(&format!("doc tests for: {}", markdown.display())); let mut cmd = builder.rustdoc_cmd(compiler.host); build.add_rust_test_threads(&mut cmd); cmd.arg("--test"); @@ -1453,8 +1454,8 @@ fn run(self, builder: &Builder) { // The javascript shim implements the syscall interface so that test // output can be correctly reported. if !build.config.wasm_syscall { - println!("Libstd was built without `wasm_syscall` feature enabled: \ - test output may not be visible."); + build.info(&format!("Libstd was built without `wasm_syscall` feature enabled: \ + test output may not be visible.")); } // On the wasm32-unknown-unknown target we're using LTO which is @@ -1476,9 +1477,9 @@ fn run(self, builder: &Builder) { let _folder = build.fold_output(|| { format!("{}_stage{}-{}", test_kind.subcommand(), compiler.stage, krate) }); - println!("{} {} stage{} ({} -> {})", test_kind, krate, compiler.stage, - &compiler.host, target); - let _time = util::timeit(); + build.info(&format!("{} {} stage{} ({} -> {})", test_kind, krate, compiler.stage, + &compiler.host, target)); + let _time = util::timeit(&build); try_run(build, &mut cargo); } } @@ -1543,9 +1544,9 @@ fn run(self, builder: &Builder) { let _folder = build.fold_output(|| { format!("{}_stage{}-rustdoc", test_kind.subcommand(), compiler.stage) }); - println!("{} rustdoc stage{} ({} -> {})", test_kind, compiler.stage, - &compiler.host, target); - let _time = util::timeit(); + build.info(&format!("{} rustdoc stage{} ({} -> {})", test_kind, compiler.stage, + &compiler.host, target)); + let _time = util::timeit(&build); try_run(build, &mut cargo); } @@ -1592,7 +1593,7 @@ fn run(self, builder: &Builder) { builder.ensure(compile::Test { compiler, target }); - println!("REMOTE copy libs to emulator ({})", target); + build.info(&format!("REMOTE copy libs to emulator ({})", target)); t!(fs::create_dir_all(build.out.join("tmp"))); let server = builder.ensure(tool::RemoteTestServer { compiler, target }); @@ -1640,7 +1641,7 @@ fn make_run(run: RunConfig) { fn run(self, builder: &Builder) { let build = builder.build; - println!("Distcheck"); + build.info(&format!("Distcheck")); let dir = build.out.join("tmp").join("distcheck"); let _ = fs::remove_dir_all(&dir); t!(fs::create_dir_all(&dir)); @@ -1664,7 +1665,7 @@ fn run(self, builder: &Builder) { .current_dir(&dir)); // Now make sure that rust-src has all of libstd's dependencies - println!("Distcheck rust-src"); + build.info(&format!("Distcheck rust-src")); let dir = build.out.join("tmp").join("distcheck-src"); let _ = fs::remove_dir_all(&dir); t!(fs::create_dir_all(&dir)); diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index 0b1616b9b4f90e419170e1ee98734b2d2cc9ff3e..93b6153fcb2f8c58c2758f3a6284e54e5867df83 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -116,7 +116,7 @@ fn run(self, builder: &Builder) -> Option { cargo.arg("--features").arg(self.extra_features.join(" ")); let _folder = build.fold_output(|| format!("stage{}-{}", compiler.stage, tool)); - println!("Building stage{} tool {} ({})", compiler.stage, tool, target); + build.info(&format!("Building stage{} tool {} ({})", compiler.stage, tool, target)); let mut duplicates = Vec::new(); let is_expected = compile::stream_cargo(build, &mut cargo, &mut |msg| { // Only care about big things like the RLS/Cargo for now @@ -427,7 +427,8 @@ fn run(self, builder: &Builder) -> PathBuf { .env("RUSTC_DEBUGINFO_LINES", builder.config.rust_debuginfo_lines.to_string()); let _folder = build.fold_output(|| format!("stage{}-rustdoc", target_compiler.stage)); - println!("Building rustdoc for stage{} ({})", target_compiler.stage, target_compiler.host); + build.info(&format!("Building rustdoc for stage{} ({})", + target_compiler.stage, target_compiler.host)); build.run(&mut cargo); // Cargo adds a number of paths to the dylib search path on windows, which results in diff --git a/src/bootstrap/util.rs b/src/bootstrap/util.rs index 8a64b07496c96fd185fb956c09819866081780ce..f8c7032369890b8472a66083dee9ae9b467d6abe 100644 --- a/src/bootstrap/util.rs +++ b/src/bootstrap/util.rs @@ -22,6 +22,7 @@ use std::time::{SystemTime, Instant}; use config::Config; +use Build; /// Returns the `name` as the filename of a static library for `target`. pub fn staticlib(name: &str, target: &str) -> String { @@ -100,19 +101,21 @@ pub fn push_exe_path(mut buf: PathBuf, components: &[&str]) -> PathBuf { buf } -pub struct TimeIt(Instant); +pub struct TimeIt(bool, Instant); /// Returns an RAII structure that prints out how long it took to drop. -pub fn timeit() -> TimeIt { - TimeIt(Instant::now()) +pub fn timeit(build: &Build) -> TimeIt { + TimeIt(build.config.dry_run, Instant::now()) } impl Drop for TimeIt { fn drop(&mut self) { - let time = self.0.elapsed(); - println!("\tfinished in {}.{:03}", - time.as_secs(), - time.subsec_nanos() / 1_000_000); + let time = self.1.elapsed(); + if !self.0 { + println!("\tfinished in {}.{:03}", + time.as_secs(), + time.subsec_nanos() / 1_000_000); + } } }