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.
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),
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));
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,
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),
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 {
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,
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),
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 {
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.
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);
// 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);
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));
}
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));
}
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);
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);
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));
}
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));
}
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);
/// 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));
/// 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"));
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)
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");
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");
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");
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),
let out = out.join(name);
- println!("Cargo Book ({}) - {}", target, name);
+ build.info(&format!("Cargo Book ({}) - {}", target, name));
let _ = fs::remove_dir_all(&out);
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")
// 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();
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));
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);
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);
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);
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);
};
if !build.config.compiler_docs {
- println!("\tskipping - compiler docs disabled");
+ build.info(&format!("\tskipping - compiler docs disabled"));
return;
}
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);
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);
host: Option<Interned<String>>
) {
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");
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, {
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, {
}
}
+ 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 {
pub fn fold_output<D, F>(&self, name: F) -> Option<OutputFolder>
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()))
} else {
None
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
}
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"));
}
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();
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));
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")));
}
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)
});
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"));
}
}
}
}
let _folder = build.fold_output(|| "tidy");
- println!("tidy check");
+ builder.info(&format!("tidy check"));
try_run(build, &mut cmd);
}
}
}
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;
}
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);
}
}
// 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();
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);
}
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");
// 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
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);
}
}
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);
}
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 });
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));
.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));
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
.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
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 {
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);
+ }
}
}