about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-03-22 19:31:31 +0100
committerGitHub <noreply@github.com>2019-03-22 19:31:31 +0100
commitf1f34707aeeca9c4a849f3753a9589d734f576e6 (patch)
tree0819d7d82e4c5b284591318203412cb98d3f0695
parent8a36f7673571c61b81c2e04698a743418faeb447 (diff)
parentb6e5d7348a6205bdfec582baf150f2471b865e54 (diff)
downloadrust-f1f34707aeeca9c4a849f3753a9589d734f576e6.tar.gz
rust-f1f34707aeeca9c4a849f3753a9589d734f576e6.zip
Rollup merge of #59309 - o01eg:verbose-copy-files, r=alexcrichton
Add messages for different verbosity levels. Output copy actions.
-rw-r--r--src/bootstrap/lib.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index 976b30a55c9..0c3daea7a3c 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -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);
@@ -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() {