@@ -346,6 +346,13 @@ impl GlobalArgs {
346
346
}
347
347
}
348
348
349
+ pub fn without_coverage ( self ) -> Self {
350
+ Self {
351
+ coverage : false ,
352
+ ..self
353
+ }
354
+ }
355
+
349
356
pub fn with_features ( self , features : Features ) -> Self {
350
357
Self { features, ..self }
351
358
}
@@ -514,7 +521,7 @@ impl Xtasks {
514
521
output. sort_by ( |e1, e2| e1. subcmd . cmp ( & e2. subcmd ) ) ;
515
522
let mut rows = Vec :: default ( ) ;
516
523
for os in & [ "ubuntu-latest" , "macos-latest" , "windows-latest" ] {
517
- for row in output. iter_mut ( ) {
524
+ for row in output. iter ( ) {
518
525
let is_main_os = os == & "ubuntu-latest" ;
519
526
let step_should_run_on_main_os =
520
527
matches ! ( row. subcmd, Xtasks :: Build | Xtasks :: Docs { .. } ) ;
@@ -525,11 +532,17 @@ impl Xtasks {
525
532
}
526
533
527
534
// we only need one source of coverage + windows is slow with this setting
528
- if !is_main_os && is_coverage_step {
529
- row. global_args . coverage = false ;
530
- }
535
+ let row = if !is_main_os && is_coverage_step {
536
+ let new_args = row. global_args . clone ( ) . without_coverage ( ) ;
537
+ App {
538
+ global_args : new_args,
539
+ ..row. clone ( )
540
+ }
541
+ . into_ci_row ( os. to_string ( ) )
542
+ } else {
543
+ row. clone ( ) . into_ci_row ( os. to_string ( ) )
544
+ } ;
531
545
532
- let row = row. clone ( ) . into_ci_row ( os. to_string ( ) ) ;
533
546
rows. push ( row) ;
534
547
}
535
548
}
@@ -611,7 +624,12 @@ impl Xtasks {
611
624
add_args : I ,
612
625
dir : Option < & Path > ,
613
626
) -> Result < ( ) > {
614
- info ! ( "Running workspace command: {}" , command) ;
627
+ let coverage_mode = app_settings
628
+ . coverage
629
+ . then_some ( "with coverage" )
630
+ . unwrap_or_default ( ) ;
631
+
632
+ info ! ( "Running workspace command {coverage_mode}: {command}" ) ;
615
633
616
634
let mut args = vec ! [ ] ;
617
635
args. push ( command. to_owned ( ) ) ;
@@ -622,8 +640,18 @@ impl Xtasks {
622
640
args. push ( "--workspace" . to_owned ( ) ) ;
623
641
624
642
if let Some ( profile) = app_settings. profile . as_ref ( ) {
625
- args. push ( "--profile" . to_owned ( ) ) ;
626
- args. push ( profile. clone ( ) ) ;
643
+ let use_profile = if profile == "ephemeral-build" && app_settings. coverage {
644
+ // use special profile for coverage as it needs debug information
645
+ // but also don't want it too slow
646
+ "ephemeral-coverage"
647
+ } else {
648
+ profile
649
+ } ;
650
+
651
+ if !app_settings. coverage {
652
+ args. push ( "--profile" . to_owned ( ) ) ;
653
+ args. push ( use_profile. to_owned ( ) ) ;
654
+ }
627
655
}
628
656
629
657
args. extend ( app_settings. features . to_cargo_args ( ) ) ;
0 commit comments