Skip to content

Commit

Permalink
Rollup merge of rust-lang#59309 - o01eg:verbose-copy-files, r=alexcri…
Browse files Browse the repository at this point in the history
…chton

Add messages for different verbosity levels. Output copy actions.
  • Loading branch information
Mark-Simulacrum authored Mar 22, 2019
2 parents 3da4970 + b6e5d73 commit e90bf70
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,17 @@ impl Build {
}
}

pub fn is_verbose_than(&self, level: usize) -> bool {
self.verbosity > level
}

/// Prints a message if this build is configured in more verbose mode than `level`.
fn verbose_than(&self, level: usize, msg: &str) {
if self.is_verbose_than(level) {
println!("{}", msg);
}
}

fn info(&self, msg: &str) {
if self.config.dry_run { return; }
println!("{}", msg);
Expand Down Expand Up @@ -1158,6 +1169,7 @@ impl Build {
/// Copies a file from `src` to `dst`
pub fn copy(&self, src: &Path, dst: &Path) {
if self.config.dry_run { return; }
self.verbose_than(1, &format!("Copy {:?} to {:?}", src, dst));
let _ = fs::remove_file(&dst);
let metadata = t!(src.symlink_metadata());
if metadata.file_type().is_symlink() {
Expand Down

0 comments on commit e90bf70

Please sign in to comment.