@@ -471,6 +471,15 @@ impl PackageMap {
471
471
#[ derive( Debug ) ]
472
472
crate struct JobQueue ( Vec < ProcessBuilder > ) ;
473
473
474
+ fn proc_arg < T : AsRef < OsStr > > ( prc : & ProcessBuilder , key : T ) -> Option < & std:: ffi:: OsStr > {
475
+ let args = prc. get_args ( ) ;
476
+ args. iter ( ) . enumerate ( )
477
+ . find ( |( _, arg) | arg. as_os_str ( ) == key. as_ref ( ) )
478
+ . map ( |( idx, _) | idx + 1 )
479
+ . and_then ( |idx| args. get ( idx) )
480
+ . map ( |x| x. as_os_str ( ) )
481
+ }
482
+
474
483
impl JobQueue {
475
484
crate fn dequeue ( & mut self ) -> Option < ProcessBuilder > {
476
485
self . 0 . pop ( )
@@ -514,16 +523,19 @@ impl JobQueue {
514
523
. expect ( "cannot stringify job program" ) ;
515
524
args. insert ( 0 , program. clone ( ) ) ;
516
525
517
- // Send a window/progress notification. At this point we know the percentage
518
- // started out of the entire cached build.
519
- // FIXME. We could communicate the "program" being built here, but
520
- // it seems window/progress notification should have message OR percentage.
526
+ // Send a window/progress notification.
521
527
{
522
- // divide by zero is avoided by earlier assert!
523
- let percentage = compiler_messages. len ( ) as f64 / self . 0 . len ( ) as f64 ;
524
- progress_sender
525
- . send ( ProgressUpdate :: Percentage ( percentage) )
526
- . expect ( "Failed to send progress update" ) ;
528
+ let crate_name = proc_arg ( & job, "--crate-name" ) . and_then ( |x| x. to_str ( ) ) ;
529
+ let update = match crate_name {
530
+ Some ( name) => ProgressUpdate :: Message ( name. to_owned ( ) ) ,
531
+ None => {
532
+ // divide by zero is avoided by earlier assert!
533
+ let percentage = compiler_messages. len ( ) as f64 / self . 0 . len ( ) as f64 ;
534
+ ProgressUpdate :: Percentage ( percentage)
535
+ }
536
+ } ;
537
+
538
+ progress_sender. send ( update) . expect ( "Failed to send progress update" ) ;
527
539
}
528
540
529
541
match super :: rustc:: rustc (
0 commit comments