@@ -168,6 +168,7 @@ pub struct Build {
168
168
rls_info : channel:: GitInfo ,
169
169
local_rebuild : bool ,
170
170
fail_fast : bool ,
171
+ verbosity : usize ,
171
172
172
173
// Stage 0 (downloaded) compiler and cargo or their local rust equivalents.
173
174
initial_rustc : PathBuf ,
@@ -247,6 +248,7 @@ impl Build {
247
248
initial_cargo : config. initial_cargo . clone ( ) ,
248
249
local_rebuild : config. local_rebuild ,
249
250
fail_fast : flags. cmd . fail_fast ( ) ,
251
+ verbosity : cmp:: max ( flags. verbose , config. verbose ) ,
250
252
251
253
flags : flags,
252
254
config : config,
@@ -428,8 +430,7 @@ impl Build {
428
430
cargo. env ( "RUSTC_ON_FAIL" , on_fail) ;
429
431
}
430
432
431
- let verbose = cmp:: max ( self . config . verbose , self . flags . verbose ) ;
432
- cargo. env ( "RUSTC_VERBOSE" , format ! ( "{}" , verbose) ) ;
433
+ cargo. env ( "RUSTC_VERBOSE" , format ! ( "{}" , self . verbosity) ) ;
433
434
434
435
// Specify some various options for build scripts used throughout
435
436
// the build.
@@ -467,7 +468,7 @@ impl Build {
467
468
// FIXME: should update code to not require this env var
468
469
cargo. env ( "CFG_COMPILER_HOST_TRIPLE" , target) ;
469
470
470
- if self . config . verbose ( ) || self . flags . verbose ( ) {
471
+ if self . is_verbose ( ) {
471
472
cargo. arg ( "-v" ) ;
472
473
}
473
474
// FIXME: cargo bench does not accept `--release`
@@ -779,9 +780,17 @@ impl Build {
779
780
try_run_suppressed ( cmd)
780
781
}
781
782
783
+ pub fn is_verbose ( & self ) -> bool {
784
+ self . verbosity > 0
785
+ }
786
+
787
+ pub fn is_very_verbose ( & self ) -> bool {
788
+ self . verbosity > 1
789
+ }
790
+
782
791
/// Prints a message if this build is configured in verbose mode.
783
792
fn verbose ( & self , msg : & str ) {
784
- if self . flags . verbose ( ) || self . config . verbose ( ) {
793
+ if self . is_verbose ( ) {
785
794
println ! ( "{}" , msg) ;
786
795
}
787
796
}
0 commit comments