1
Fork 0

Avoid printing output when in dry run mode

This commit is contained in:
Mark Simulacrum 2018-03-28 17:25:09 +02:00
parent a727447f59
commit 545b92f46d
9 changed files with 105 additions and 94 deletions

View file

@ -77,7 +77,7 @@ impl Step for Std {
compiler: from, compiler: from,
target, 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 // Even if we're not building std this stage, the new sysroot must
// still contain the musl startup objects. // still contain the musl startup objects.
@ -105,8 +105,8 @@ impl Step for Std {
std_cargo(builder, &compiler, target, &mut cargo); std_cargo(builder, &compiler, target, &mut cargo);
let _folder = build.fold_output(|| format!("stage{}-std", compiler.stage)); let _folder = build.fold_output(|| format!("stage{}-std", compiler.stage));
println!("Building stage{} std artifacts ({} -> {})", compiler.stage, build.info(&format!("Building stage{} std artifacts ({} -> {})", compiler.stage,
&compiler.host, target); &compiler.host, target));
run_cargo(build, run_cargo(build,
&mut cargo, &mut cargo,
&libstd_stamp(build, compiler, target), &libstd_stamp(build, compiler, target),
@ -213,12 +213,12 @@ impl Step for StdLink {
let compiler = self.compiler; let compiler = self.compiler;
let target_compiler = self.target_compiler; let target_compiler = self.target_compiler;
let target = self.target; let target = self.target;
println!("Copying stage{} std from stage{} ({} -> {} / {})", build.info(&format!("Copying stage{} std from stage{} ({} -> {} / {})",
target_compiler.stage, target_compiler.stage,
compiler.stage, compiler.stage,
&compiler.host, &compiler.host,
target_compiler.host, target_compiler.host,
target); target));
let libdir = builder.sysroot_libdir(target_compiler, target); let libdir = builder.sysroot_libdir(target_compiler, target);
add_to_sysroot(&build, &libdir, &libstd_stamp(build, compiler, target)); add_to_sysroot(&build, &libdir, &libstd_stamp(build, compiler, target));
@ -352,7 +352,7 @@ impl Step for Test {
compiler: builder.compiler(1, build.build), compiler: builder.compiler(1, build.build),
target, target,
}); });
println!("Uplifting stage1 test ({} -> {})", &build.build, target); build.info(&format!("Uplifting stage1 test ({} -> {})", &build.build, target));
builder.ensure(TestLink { builder.ensure(TestLink {
compiler: builder.compiler(1, build.build), compiler: builder.compiler(1, build.build),
target_compiler: compiler, target_compiler: compiler,
@ -367,8 +367,8 @@ impl Step for Test {
test_cargo(build, &compiler, target, &mut cargo); test_cargo(build, &compiler, target, &mut cargo);
let _folder = build.fold_output(|| format!("stage{}-test", compiler.stage)); let _folder = build.fold_output(|| format!("stage{}-test", compiler.stage));
println!("Building stage{} test artifacts ({} -> {})", compiler.stage, build.info(&format!("Building stage{} test artifacts ({} -> {})", compiler.stage,
&compiler.host, target); &compiler.host, target));
run_cargo(build, run_cargo(build,
&mut cargo, &mut cargo,
&libtest_stamp(build, compiler, target), &libtest_stamp(build, compiler, target),
@ -414,12 +414,12 @@ impl Step for TestLink {
let compiler = self.compiler; let compiler = self.compiler;
let target_compiler = self.target_compiler; let target_compiler = self.target_compiler;
let target = self.target; let target = self.target;
println!("Copying stage{} test from stage{} ({} -> {} / {})", build.info(&format!("Copying stage{} test from stage{} ({} -> {} / {})",
target_compiler.stage, target_compiler.stage,
compiler.stage, compiler.stage,
&compiler.host, &compiler.host,
target_compiler.host, target_compiler.host,
target); target));
add_to_sysroot(&build, &builder.sysroot_libdir(target_compiler, target), add_to_sysroot(&build, &builder.sysroot_libdir(target_compiler, target),
&libtest_stamp(build, compiler, target)); &libtest_stamp(build, compiler, target));
builder.ensure(tool::CleanTools { builder.ensure(tool::CleanTools {
@ -469,7 +469,7 @@ impl Step for Rustc {
compiler: builder.compiler(1, build.build), compiler: builder.compiler(1, build.build),
target, target,
}); });
println!("Uplifting stage1 rustc ({} -> {})", &build.build, target); build.info(&format!("Uplifting stage1 rustc ({} -> {})", &build.build, target));
builder.ensure(RustcLink { builder.ensure(RustcLink {
compiler: builder.compiler(1, build.build), compiler: builder.compiler(1, build.build),
target_compiler: compiler, target_compiler: compiler,
@ -491,8 +491,8 @@ impl Step for Rustc {
rustc_cargo(build, &mut cargo); rustc_cargo(build, &mut cargo);
let _folder = build.fold_output(|| format!("stage{}-rustc", compiler.stage)); let _folder = build.fold_output(|| format!("stage{}-rustc", compiler.stage));
println!("Building stage{} compiler artifacts ({} -> {})", build.info(&format!("Building stage{} compiler artifacts ({} -> {})",
compiler.stage, &compiler.host, target); compiler.stage, &compiler.host, target));
run_cargo(build, run_cargo(build,
&mut cargo, &mut cargo,
&librustc_stamp(build, compiler, target), &librustc_stamp(build, compiler, target),
@ -569,12 +569,12 @@ impl Step for RustcLink {
let compiler = self.compiler; let compiler = self.compiler;
let target_compiler = self.target_compiler; let target_compiler = self.target_compiler;
let target = self.target; let target = self.target;
println!("Copying stage{} rustc from stage{} ({} -> {} / {})", build.info(&format!("Copying stage{} rustc from stage{} ({} -> {} / {})",
target_compiler.stage, target_compiler.stage,
compiler.stage, compiler.stage,
&compiler.host, &compiler.host,
target_compiler.host, target_compiler.host,
target); target));
add_to_sysroot(&build, &builder.sysroot_libdir(target_compiler, target), add_to_sysroot(&build, &builder.sysroot_libdir(target_compiler, target),
&librustc_stamp(build, compiler, target)); &librustc_stamp(build, compiler, target));
builder.ensure(tool::CleanTools { builder.ensure(tool::CleanTools {
@ -648,8 +648,8 @@ impl Step for CodegenBackend {
features.push_str(" emscripten"); features.push_str(" emscripten");
} }
println!("Building stage{} codegen artifacts ({} -> {}, {})", build.info(&format!("Building stage{} codegen artifacts ({} -> {}, {})",
compiler.stage, &compiler.host, target, self.backend); compiler.stage, &compiler.host, target, self.backend));
// Pass down configuration from the LLVM build into the build of // Pass down configuration from the LLVM build into the build of
// librustc_llvm and librustc_trans. // librustc_llvm and librustc_trans.
@ -933,7 +933,7 @@ impl Step for Assemble {
let stage = target_compiler.stage; let stage = target_compiler.stage;
let host = target_compiler.host; 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 // Link in all dylibs to the libdir
let sysroot = builder.sysroot(target_compiler); 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. // Make sure Cargo actually succeeded after we read all of its stdout.
let status = t!(child.wait()); let status = t!(child.wait());
if !status.success() { if !status.success() {
println!("command did not execute successfully: {:?}\n\ eprintln!("command did not execute successfully: {:?}\n\
expected success, got: {}", expected success, got: {}",
cargo, cargo,
status); status);

View file

@ -89,9 +89,9 @@ impl Step for Docs {
let name = pkgname(build, "rust-docs"); let name = pkgname(build, "rust-docs");
println!("Dist docs ({})", host); build.info(&format!("Dist docs ({})", host));
if !build.config.docs { if !build.config.docs {
println!("\tskipping - docs disabled"); build.info(&format!("\tskipping - docs disabled"));
return distdir(build).join(format!("{}-{}.tar.gz", name, host)); return distdir(build).join(format!("{}-{}.tar.gz", name, host));
} }
@ -152,9 +152,9 @@ impl Step for RustcDocs {
let name = pkgname(build, "rustc-docs"); let name = pkgname(build, "rustc-docs");
println!("Dist compiler docs ({})", host); build.info(&format!("Dist compiler docs ({})", host));
if !build.config.compiler_docs { 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)); return distdir(build).join(format!("{}-{}.tar.gz", name, host));
} }
@ -343,7 +343,7 @@ impl Step for Mingw {
return None; return None;
} }
println!("Dist mingw ({})", host); build.info(&format!("Dist mingw ({})", host));
let name = pkgname(build, "rust-mingw"); let name = pkgname(build, "rust-mingw");
let image = tmpdir(build).join(format!("{}-{}-image", name, host)); let image = tmpdir(build).join(format!("{}-{}-image", name, host));
let _ = fs::remove_dir_all(&image); let _ = fs::remove_dir_all(&image);
@ -398,7 +398,7 @@ impl Step for Rustc {
let compiler = self.compiler; let compiler = self.compiler;
let host = self.compiler.host; 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 name = pkgname(build, "rustc");
let image = tmpdir(build).join(format!("{}-{}-image", name, host)); let image = tmpdir(build).join(format!("{}-{}-image", name, host));
let _ = fs::remove_dir_all(&image); let _ = fs::remove_dir_all(&image);
@ -627,12 +627,12 @@ impl Step for Std {
let target = self.target; let target = self.target;
let name = pkgname(build, "rust-std"); 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 // 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. // let's reduce redundant work by only producing archives from that host.
if compiler.host != build.build { 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)); return distdir(build).join(format!("{}-{}.tar.gz", name, target));
} }
@ -704,11 +704,11 @@ impl Step for Analysis {
let compiler = self.compiler; let compiler = self.compiler;
let target = self.target; let target = self.target;
assert!(build.config.extended); assert!(build.config.extended);
println!("Dist analysis"); build.info(&format!("Dist analysis"));
let name = pkgname(build, "rust-analysis"); let name = pkgname(build, "rust-analysis");
if &compiler.host != build.build { 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)); return distdir(build).join(format!("{}-{}.tar.gz", name, target));
} }
@ -730,7 +730,7 @@ impl Step for Analysis {
let image_src = src.join("save-analysis"); let image_src = src.join("save-analysis");
let dst = image.join("lib/rustlib").join(target).join("analysis"); let dst = image.join("lib/rustlib").join(target).join("analysis");
t!(fs::create_dir_all(&dst)); 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); build.cp_r(&image_src, &dst);
let mut cmd = rust_installer(builder); let mut cmd = rust_installer(builder);
@ -813,7 +813,7 @@ impl Step for Src {
/// Creates the `rust-src` installer component /// Creates the `rust-src` installer component
fn run(self, builder: &Builder) -> PathBuf { fn run(self, builder: &Builder) -> PathBuf {
let build = builder.build; let build = builder.build;
println!("Dist src"); build.info(&format!("Dist src"));
let name = pkgname(build, "rust-src"); let name = pkgname(build, "rust-src");
let image = tmpdir(build).join(format!("{}-image", name)); let image = tmpdir(build).join(format!("{}-image", name));
@ -908,7 +908,7 @@ impl Step for PlainSourceTarball {
/// Creates the plain source tarball /// Creates the plain source tarball
fn run(self, builder: &Builder) -> PathBuf { fn run(self, builder: &Builder) -> PathBuf {
let build = builder.build; 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 // Make sure that the root folder of tarball has the correct name
let plain_name = format!("{}-src", pkgname(build, "rustc")); let plain_name = format!("{}-src", pkgname(build, "rustc"));
@ -985,7 +985,7 @@ impl Step for PlainSourceTarball {
if let Some(dir) = tarball.parent() { if let Some(dir) = tarball.parent() {
build.create_dir(&dir); build.create_dir(&dir);
} }
println!("running installer"); build.info(&format!("running installer"));
let mut cmd = rust_installer(builder); let mut cmd = rust_installer(builder);
cmd.arg("tarball") cmd.arg("tarball")
.arg("--input").arg(&plain_name) .arg("--input").arg(&plain_name)
@ -1042,7 +1042,7 @@ impl Step for Cargo {
let stage = self.stage; let stage = self.stage;
let target = self.target; 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 src = build.src.join("src/tools/cargo");
let etc = src.join("src/etc"); let etc = src.join("src/etc");
let release_num = build.release_num("cargo"); let release_num = build.release_num("cargo");
@ -1130,7 +1130,7 @@ impl Step for Rls {
let target = self.target; let target = self.target;
assert!(build.config.extended); 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 src = build.src.join("src/tools/rls");
let release_num = build.release_num("rls"); let release_num = build.release_num("rls");
let name = pkgname(build, "rls"); let name = pkgname(build, "rls");
@ -1210,7 +1210,7 @@ impl Step for Rustfmt {
let stage = self.stage; let stage = self.stage;
let target = self.target; 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 src = build.src.join("src/tools/rustfmt");
let release_num = build.release_num("rustfmt"); let release_num = build.release_num("rustfmt");
let name = pkgname(build, "rustfmt"); let name = pkgname(build, "rustfmt");
@ -1297,7 +1297,7 @@ impl Step for Extended {
let stage = self.stage; let stage = self.stage;
let target = self.target; let target = self.target;
println!("Dist extended stage{} ({})", stage, target); build.info(&format!("Dist extended stage{} ({})", stage, target));
let rustc_installer = builder.ensure(Rustc { let rustc_installer = builder.ensure(Rustc {
compiler: builder.compiler(stage, target), compiler: builder.compiler(stage, target),

View file

@ -169,7 +169,7 @@ impl Step for CargoBook {
let out = out.join(name); let out = out.join(name);
println!("Cargo Book ({}) - {}", target, name); build.info(&format!("Cargo Book ({}) - {}", target, name));
let _ = fs::remove_dir_all(&out); let _ = fs::remove_dir_all(&out);
@ -215,7 +215,7 @@ impl Step for RustbookSrc {
if up_to_date(&src, &index) && up_to_date(&rustbook, &index) { if up_to_date(&src, &index) && up_to_date(&rustbook, &index) {
return return
} }
println!("Rustbook ({}) - {}", target, name); build.info(&format!("Rustbook ({}) - {}", target, name));
let _ = fs::remove_dir_all(&out); let _ = fs::remove_dir_all(&out);
build.run(rustbook_cmd build.run(rustbook_cmd
.arg("build") .arg("build")
@ -283,11 +283,11 @@ impl Step for TheBook {
// build the index page // build the index page
let index = format!("{}/index.md", name); let index = format!("{}/index.md", name);
println!("Documenting book index ({})", target); build.info(&format!("Documenting book index ({})", target));
invoke_rustdoc(builder, compiler, target, &index); invoke_rustdoc(builder, compiler, target, &index);
// build the redirect pages // 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"))) { for file in t!(fs::read_dir(build.src.join("src/doc/book/redirects"))) {
let file = t!(file); let file = t!(file);
let path = file.path(); let path = file.path();
@ -360,7 +360,7 @@ impl Step for Standalone {
let build = builder.build; let build = builder.build;
let target = self.target; let target = self.target;
let compiler = self.compiler; let compiler = self.compiler;
println!("Documenting standalone ({})", target); build.info(&format!("Documenting standalone ({})", target));
let out = build.doc_out(target); let out = build.doc_out(target);
t!(fs::create_dir_all(&out)); t!(fs::create_dir_all(&out));
@ -451,7 +451,7 @@ impl Step for Std {
let build = builder.build; let build = builder.build;
let stage = self.stage; let stage = self.stage;
let target = self.target; let target = self.target;
println!("Documenting stage{} std ({})", stage, target); build.info(&format!("Documenting stage{} std ({})", stage, target));
let out = build.doc_out(target); let out = build.doc_out(target);
t!(fs::create_dir_all(&out)); t!(fs::create_dir_all(&out));
let compiler = builder.compiler(stage, build.build); let compiler = builder.compiler(stage, build.build);
@ -532,7 +532,7 @@ impl Step for Test {
let build = builder.build; let build = builder.build;
let stage = self.stage; let stage = self.stage;
let target = self.target; let target = self.target;
println!("Documenting stage{} test ({})", stage, target); build.info(&format!("Documenting stage{} test ({})", stage, target));
let out = build.doc_out(target); let out = build.doc_out(target);
t!(fs::create_dir_all(&out)); t!(fs::create_dir_all(&out));
let compiler = builder.compiler(stage, build.build); let compiler = builder.compiler(stage, build.build);
@ -598,7 +598,7 @@ impl Step for WhitelistedRustc {
let build = builder.build; let build = builder.build;
let stage = self.stage; let stage = self.stage;
let target = self.target; 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); let out = build.doc_out(target);
t!(fs::create_dir_all(&out)); t!(fs::create_dir_all(&out));
let compiler = builder.compiler(stage, build.build); let compiler = builder.compiler(stage, build.build);
@ -670,7 +670,7 @@ impl Step for Rustc {
let build = builder.build; let build = builder.build;
let stage = self.stage; let stage = self.stage;
let target = self.target; 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); let out = build.compiler_doc_out(target);
t!(fs::create_dir_all(&out)); t!(fs::create_dir_all(&out));
let compiler = builder.compiler(stage, build.build); let compiler = builder.compiler(stage, build.build);
@ -682,7 +682,7 @@ impl Step for Rustc {
}; };
if !build.config.compiler_docs { if !build.config.compiler_docs {
println!("\tskipping - compiler docs disabled"); build.info(&format!("\tskipping - compiler docs disabled"));
return; return;
} }
@ -761,7 +761,7 @@ impl Step for ErrorIndex {
let build = builder.build; let build = builder.build;
let target = self.target; let target = self.target;
println!("Documenting error index ({})", target); build.info(&format!("Documenting error index ({})", target));
let out = build.doc_out(target); let out = build.doc_out(target);
t!(fs::create_dir_all(&out)); t!(fs::create_dir_all(&out));
let mut index = builder.tool_cmd(Tool::ErrorIndex); let mut index = builder.tool_cmd(Tool::ErrorIndex);
@ -806,7 +806,7 @@ impl Step for UnstableBookGen {
target, 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"); let out = build.md_doc_out(target).join("unstable-book");
build.create_dir(&out); build.create_dir(&out);
build.remove_dir(&out); build.remove_dir(&out);

View file

@ -63,7 +63,7 @@ fn install_sh(
host: Option<Interned<String>> host: Option<Interned<String>>
) { ) {
let build = builder.build; 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 prefix_default = PathBuf::from("/usr/local");
let sysconfdir_default = PathBuf::from("/etc"); let sysconfdir_default = PathBuf::from("/etc");
@ -212,7 +212,7 @@ install!((self, builder, _config),
Self::should_install(builder) { Self::should_install(builder) {
install_rls(builder, self.stage, self.target); install_rls(builder, self.stage, self.target);
} else { } 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, { Rustfmt, "rustfmt", Self::should_build(_config), only_hosts: true, {
@ -220,7 +220,8 @@ install!((self, builder, _config),
Self::should_install(builder) { Self::should_install(builder) {
install_rustfmt(builder, self.stage, self.target); install_rustfmt(builder, self.stage, self.target);
} else { } 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, { Analysis, "analysis", Self::should_build(_config), only_hosts: false, {

View file

@ -667,6 +667,11 @@ impl Build {
} }
} }
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 /// Returns the number of parallel jobs that have been configured for this
/// build. /// build.
fn jobs(&self) -> u32 { fn jobs(&self) -> u32 {
@ -974,7 +979,7 @@ impl Build {
pub fn fold_output<D, F>(&self, name: F) -> Option<OutputFolder> pub fn fold_output<D, F>(&self, name: F) -> Option<OutputFolder>
where D: Into<String>, F: FnOnce() -> D where D: Into<String>, F: FnOnce() -> D
{ {
if self.ci_env == CiEnv::Travis { if !self.config.dry_run && self.ci_env == CiEnv::Travis {
Some(OutputFolder::new(name().into())) Some(OutputFolder::new(name().into()))
} else { } else {
None None

View file

@ -106,8 +106,8 @@ impl Step for Llvm {
let _folder = build.fold_output(|| "llvm"); let _folder = build.fold_output(|| "llvm");
let descriptor = if emscripten { "Emscripten " } else { "" }; let descriptor = if emscripten { "Emscripten " } else { "" };
println!("Building {}LLVM for {}", descriptor, target); build.info(&format!("Building {}LLVM for {}", descriptor, target));
let _time = util::timeit(); let _time = util::timeit(&build);
t!(fs::create_dir_all(&out_dir)); t!(fs::create_dir_all(&out_dir));
// http://llvm.org/docs/CMake.html // http://llvm.org/docs/CMake.html
@ -359,8 +359,8 @@ impl Step for Lld {
} }
let _folder = build.fold_output(|| "lld"); let _folder = build.fold_output(|| "lld");
println!("Building LLD for {}", target); build.info(&format!("Building LLD for {}", target));
let _time = util::timeit(); let _time = util::timeit(&build);
t!(fs::create_dir_all(&out_dir)); t!(fs::create_dir_all(&out_dir));
let mut cfg = cmake::Config::new(build.src.join("src/tools/lld")); let mut cfg = cmake::Config::new(build.src.join("src/tools/lld"));
@ -409,7 +409,7 @@ impl Step for TestHelpers {
} }
let _folder = build.fold_output(|| "build_test_helpers"); let _folder = build.fold_output(|| "build_test_helpers");
println!("Building test helpers"); build.info(&format!("Building test helpers"));
t!(fs::create_dir_all(&dst)); t!(fs::create_dir_all(&dst));
let mut cfg = cc::Build::new(); let mut cfg = cc::Build::new();
@ -605,11 +605,11 @@ impl Step for Openssl {
configure.arg("no-asm"); configure.arg("no-asm");
} }
configure.current_dir(&obj); configure.current_dir(&obj);
println!("Configuring openssl for {}", target); build.info(&format!("Configuring openssl for {}", target));
build.run_quiet(&mut configure); 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)); 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)); build.run_quiet(Command::new("make").arg("install").arg("-j1").current_dir(&obj));
let mut f = t!(File::create(&stamp)); let mut f = t!(File::create(&stamp));

View file

@ -109,11 +109,11 @@ impl Step for Linkcheck {
let build = builder.build; let build = builder.build;
let host = self.host; let host = self.host;
println!("Linkcheck ({})", host); build.info(&format!("Linkcheck ({})", host));
builder.default_doc(None); builder.default_doc(None);
let _time = util::timeit(); let _time = util::timeit(&build);
try_run(build, builder.tool_cmd(Tool::Linkchecker) try_run(build, builder.tool_cmd(Tool::Linkchecker)
.arg(build.out.join(host).join("doc"))); .arg(build.out.join(host).join("doc")));
} }
@ -164,7 +164,7 @@ impl Step for Cargotest {
let out_dir = build.out.join("ct"); let out_dir = build.out.join("ct");
t!(fs::create_dir_all(&out_dir)); t!(fs::create_dir_all(&out_dir));
let _time = util::timeit(); let _time = util::timeit(&build);
let mut cmd = builder.tool_cmd(Tool::CargoTest); let mut cmd = builder.tool_cmd(Tool::CargoTest);
try_run(build, cmd.arg(&build.initial_cargo) try_run(build, cmd.arg(&build.initial_cargo)
.arg(&out_dir) .arg(&out_dir)
@ -509,7 +509,7 @@ impl Step for RustdocJS {
}); });
builder.run(&mut command); builder.run(&mut command);
} else { } 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 @@ impl Step for Tidy {
} }
let _folder = build.fold_output(|| "tidy"); let _folder = build.fold_output(|| "tidy");
println!("tidy check"); builder.info(&format!("tidy check"));
try_run(build, &mut cmd); try_run(build, &mut cmd);
} }
@ -948,7 +948,8 @@ impl Step for Compiletest {
} }
} }
if suite == "run-make-fulldeps" && !build.config.llvm_enabled { 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; return;
} }
@ -1002,9 +1003,9 @@ impl Step for Compiletest {
build.ci_env.force_coloring_in_ci(&mut cmd); build.ci_env.force_coloring_in_ci(&mut cmd);
let _folder = build.fold_output(|| format!("test_{}", suite)); let _folder = build.fold_output(|| format!("test_{}", suite));
println!("Check compiletest suite={} mode={} ({} -> {})", builder.info(&format!("Check compiletest suite={} mode={} ({} -> {})",
suite, mode, &compiler.host, target); suite, mode, &compiler.host, target));
let _time = util::timeit(); let _time = util::timeit(&build);
try_run(build, &mut cmd); try_run(build, &mut cmd);
} }
} }
@ -1039,7 +1040,7 @@ impl Step for DocTest {
// Do a breadth-first traversal of the `src/doc` directory and just run // Do a breadth-first traversal of the `src/doc` directory and just run
// tests for all files that end in `*.md` // tests for all files that end in `*.md`
let mut stack = vec![build.src.join(self.path)]; 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 _folder = build.fold_output(|| format!("test_{}", self.name));
let mut files = Vec::new(); let mut files = Vec::new();
@ -1167,8 +1168,8 @@ impl Step for ErrorIndex {
let _folder = build.fold_output(|| "test_error_index"); let _folder = build.fold_output(|| "test_error_index");
println!("Testing error-index stage{}", compiler.stage); build.info(&format!("Testing error-index stage{}", compiler.stage));
let _time = util::timeit(); let _time = util::timeit(&build);
build.run(&mut tool); build.run(&mut tool);
markdown_test(builder, compiler, &output); markdown_test(builder, compiler, &output);
} }
@ -1183,7 +1184,7 @@ fn markdown_test(builder: &Builder, compiler: Compiler, markdown: &Path) -> bool
return true; return true;
} }
println!("doc tests for: {}", markdown.display()); build.info(&format!("doc tests for: {}", markdown.display()));
let mut cmd = builder.rustdoc_cmd(compiler.host); let mut cmd = builder.rustdoc_cmd(compiler.host);
build.add_rust_test_threads(&mut cmd); build.add_rust_test_threads(&mut cmd);
cmd.arg("--test"); cmd.arg("--test");
@ -1453,8 +1454,8 @@ impl Step for Crate {
// The javascript shim implements the syscall interface so that test // The javascript shim implements the syscall interface so that test
// output can be correctly reported. // output can be correctly reported.
if !build.config.wasm_syscall { if !build.config.wasm_syscall {
println!("Libstd was built without `wasm_syscall` feature enabled: \ build.info(&format!("Libstd was built without `wasm_syscall` feature enabled: \
test output may not be visible."); test output may not be visible."));
} }
// On the wasm32-unknown-unknown target we're using LTO which is // On the wasm32-unknown-unknown target we're using LTO which is
@ -1476,9 +1477,9 @@ impl Step for Crate {
let _folder = build.fold_output(|| { let _folder = build.fold_output(|| {
format!("{}_stage{}-{}", test_kind.subcommand(), compiler.stage, krate) format!("{}_stage{}-{}", test_kind.subcommand(), compiler.stage, krate)
}); });
println!("{} {} stage{} ({} -> {})", test_kind, krate, compiler.stage, build.info(&format!("{} {} stage{} ({} -> {})", test_kind, krate, compiler.stage,
&compiler.host, target); &compiler.host, target));
let _time = util::timeit(); let _time = util::timeit(&build);
try_run(build, &mut cargo); try_run(build, &mut cargo);
} }
} }
@ -1543,9 +1544,9 @@ impl Step for CrateRustdoc {
let _folder = build.fold_output(|| { let _folder = build.fold_output(|| {
format!("{}_stage{}-rustdoc", test_kind.subcommand(), compiler.stage) format!("{}_stage{}-rustdoc", test_kind.subcommand(), compiler.stage)
}); });
println!("{} rustdoc stage{} ({} -> {})", test_kind, compiler.stage, build.info(&format!("{} rustdoc stage{} ({} -> {})", test_kind, compiler.stage,
&compiler.host, target); &compiler.host, target));
let _time = util::timeit(); let _time = util::timeit(&build);
try_run(build, &mut cargo); try_run(build, &mut cargo);
} }
@ -1592,7 +1593,7 @@ impl Step for RemoteCopyLibs {
builder.ensure(compile::Test { compiler, target }); 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"))); t!(fs::create_dir_all(build.out.join("tmp")));
let server = builder.ensure(tool::RemoteTestServer { compiler, target }); let server = builder.ensure(tool::RemoteTestServer { compiler, target });
@ -1640,7 +1641,7 @@ impl Step for Distcheck {
fn run(self, builder: &Builder) { fn run(self, builder: &Builder) {
let build = builder.build; let build = builder.build;
println!("Distcheck"); build.info(&format!("Distcheck"));
let dir = build.out.join("tmp").join("distcheck"); let dir = build.out.join("tmp").join("distcheck");
let _ = fs::remove_dir_all(&dir); let _ = fs::remove_dir_all(&dir);
t!(fs::create_dir_all(&dir)); t!(fs::create_dir_all(&dir));
@ -1664,7 +1665,7 @@ impl Step for Distcheck {
.current_dir(&dir)); .current_dir(&dir));
// Now make sure that rust-src has all of libstd's dependencies // 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 dir = build.out.join("tmp").join("distcheck-src");
let _ = fs::remove_dir_all(&dir); let _ = fs::remove_dir_all(&dir);
t!(fs::create_dir_all(&dir)); t!(fs::create_dir_all(&dir));

View file

@ -116,7 +116,7 @@ impl Step for ToolBuild {
cargo.arg("--features").arg(self.extra_features.join(" ")); cargo.arg("--features").arg(self.extra_features.join(" "));
let _folder = build.fold_output(|| format!("stage{}-{}", compiler.stage, tool)); 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 mut duplicates = Vec::new();
let is_expected = compile::stream_cargo(build, &mut cargo, &mut |msg| { let is_expected = compile::stream_cargo(build, &mut cargo, &mut |msg| {
// Only care about big things like the RLS/Cargo for now // Only care about big things like the RLS/Cargo for now
@ -427,7 +427,8 @@ impl Step for Rustdoc {
.env("RUSTC_DEBUGINFO_LINES", builder.config.rust_debuginfo_lines.to_string()); .env("RUSTC_DEBUGINFO_LINES", builder.config.rust_debuginfo_lines.to_string());
let _folder = build.fold_output(|| format!("stage{}-rustdoc", target_compiler.stage)); 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); build.run(&mut cargo);
// Cargo adds a number of paths to the dylib search path on windows, which results in // Cargo adds a number of paths to the dylib search path on windows, which results in

View file

@ -22,6 +22,7 @@ use std::process::Command;
use std::time::{SystemTime, Instant}; use std::time::{SystemTime, Instant};
use config::Config; use config::Config;
use Build;
/// Returns the `name` as the filename of a static library for `target`. /// Returns the `name` as the filename of a static library for `target`.
pub fn staticlib(name: &str, target: &str) -> String { pub fn staticlib(name: &str, target: &str) -> String {
@ -100,19 +101,21 @@ pub fn push_exe_path(mut buf: PathBuf, components: &[&str]) -> PathBuf {
buf buf
} }
pub struct TimeIt(Instant); pub struct TimeIt(bool, Instant);
/// Returns an RAII structure that prints out how long it took to drop. /// Returns an RAII structure that prints out how long it took to drop.
pub fn timeit() -> TimeIt { pub fn timeit(build: &Build) -> TimeIt {
TimeIt(Instant::now()) TimeIt(build.config.dry_run, Instant::now())
} }
impl Drop for TimeIt { impl Drop for TimeIt {
fn drop(&mut self) { fn drop(&mut self) {
let time = self.0.elapsed(); let time = self.1.elapsed();
println!("\tfinished in {}.{:03}", if !self.0 {
time.as_secs(), println!("\tfinished in {}.{:03}",
time.subsec_nanos() / 1_000_000); time.as_secs(),
time.subsec_nanos() / 1_000_000);
}
} }
} }