@@ -11,7 +11,7 @@ use crossbeam_utils::thread::Scope;
11
11
use jobserver:: { Acquired , HelperThread } ;
12
12
13
13
use core:: profiles:: Profile ;
14
- use core:: { PackageId , Target } ;
14
+ use core:: { PackageId , Target , TargetKind } ;
15
15
use handle_error;
16
16
use util:: { internal, profile, CargoResult , CargoResultExt , ProcessBuilder } ;
17
17
use util:: { Config , DependencyQueue , Dirty , Fresh , Freshness } ;
@@ -57,6 +57,27 @@ struct Key<'a> {
57
57
mode : CompileMode ,
58
58
}
59
59
60
+ impl < ' a > Key < ' a > {
61
+ fn name_for_progress ( & self ) -> String {
62
+ let pkg_name = self . pkg . name ( ) ;
63
+ match self . mode {
64
+ CompileMode :: Doc { .. } => format ! ( "{}(doc)" , pkg_name) ,
65
+ CompileMode :: RunCustomBuild => format ! ( "{}(build)" , pkg_name) ,
66
+ _ => {
67
+ let annotation = match self . target . kind ( ) {
68
+ TargetKind :: Lib ( _) => return pkg_name. to_string ( ) ,
69
+ TargetKind :: CustomBuild => return format ! ( "{}(build.rs)" , pkg_name) ,
70
+ TargetKind :: Bin => "bin" ,
71
+ TargetKind :: Test => "test" ,
72
+ TargetKind :: Bench => "bench" ,
73
+ TargetKind :: ExampleBin | TargetKind :: ExampleLib ( _) => "example" ,
74
+ } ;
75
+ format ! ( "{}({})" , self . target. name( ) , annotation)
76
+ }
77
+ }
78
+ }
79
+ }
80
+
60
81
pub struct JobState < ' a > {
61
82
tx : Sender < Message < ' a > > ,
62
83
}
@@ -254,10 +275,9 @@ impl<'a> JobQueue<'a> {
254
275
255
276
if progress_maybe_changed {
256
277
let count = total - self . queue . len ( ) ;
257
- let active_names = self . active . iter ( ) . map ( |key| match key. mode {
258
- CompileMode :: Doc { .. } => format ! ( "{}(doc)" , key. pkg. name( ) ) ,
259
- _ => key. pkg . name ( ) . to_string ( ) ,
260
- } ) . collect :: < Vec < _ > > ( ) ;
278
+ let active_names = self . active . iter ( )
279
+ . map ( Key :: name_for_progress)
280
+ . collect :: < Vec < _ > > ( ) ;
261
281
drop ( progress. tick_now ( count, total, & format ! ( ": {}" , active_names. join( ", " ) ) ) ) ;
262
282
}
263
283
let event = self . rx . recv ( ) . unwrap ( ) ;
0 commit comments