@@ -107,6 +107,12 @@ impl IntoFeatureGroup for Feature {
107
107
#[ derive( Debug , Clone , PartialEq , Eq ) ]
108
108
struct Features ( HashSet < Feature > ) ;
109
109
110
+ impl Default for Features {
111
+ fn default ( ) -> Self {
112
+ Features :: new ( vec ! [ Feature :: Lua54 ] )
113
+ }
114
+ }
115
+
110
116
impl Features {
111
117
fn new < I : IntoIterator < Item = Feature > > ( features : I ) -> Self {
112
118
Self ( features. into_iter ( ) . collect ( ) )
@@ -161,9 +167,6 @@ impl Features {
161
167
162
168
impl std:: fmt:: Display for Features {
163
169
fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
164
- if & Self :: all_features ( ) == self {
165
- return write ! ( f, "all" ) ;
166
- }
167
170
for ( i, feature) in self . 0 . iter ( ) . sorted ( ) . enumerate ( ) {
168
171
if i > 0 {
169
172
write ! ( f, "," ) ?;
@@ -207,6 +210,16 @@ impl App {
207
210
fn into_command ( self ) -> Command {
208
211
let mut cmd = Command :: new ( "cargo" ) ;
209
212
cmd. arg ( "xtask" ) ;
213
+
214
+ if self . global_args . features != Features :: default ( ) {
215
+ cmd. arg ( "--features" )
216
+ . arg ( self . global_args . features . to_string ( ) ) ;
217
+ }
218
+
219
+ if let Some ( profile) = self . global_args . profile {
220
+ cmd. arg ( "--profile" ) . arg ( profile) ;
221
+ }
222
+
210
223
match self . subcmd {
211
224
Xtasks :: Macros { macro_name } => {
212
225
cmd. arg ( "macros" ) . arg ( macro_name. as_ref ( ) ) ;
@@ -281,15 +294,24 @@ impl App {
281
294
pub ( crate ) fn into_ci_row ( self , os : String ) -> CiMatrixRow {
282
295
CiMatrixRow {
283
296
command : self . clone ( ) . into_command_string ( ) . into_string ( ) . unwrap ( ) ,
284
- name : format ! ( "{} - {}" , self . subcmd. as_ref( ) , self . global_args. features) ,
297
+ name : format ! (
298
+ "{}({}) - {}" ,
299
+ self . subcmd. as_ref( ) ,
300
+ os,
301
+ if self . global_args. features == Features :: all_features( ) {
302
+ "all features" . to_owned( )
303
+ } else {
304
+ self . global_args. features. to_string( )
305
+ }
306
+ ) ,
285
307
os,
286
308
}
287
309
}
288
310
}
289
311
290
312
#[ derive( Debug , Parser , Clone ) ]
291
313
struct GlobalArgs {
292
- #[ clap( long, short, global = true , value_parser=clap:: value_parser!( Features ) , value_name=Features :: to_placeholder( ) , default_value="lua54" , required = false ) ]
314
+ #[ clap( long, short, global = true , value_parser=clap:: value_parser!( Features ) , value_name=Features :: to_placeholder( ) , default_value=Features :: default ( ) . to_string ( ) , required = false ) ]
293
315
features : Features ,
294
316
295
317
#[ clap(
@@ -355,15 +377,13 @@ enum Xtasks {
355
377
Check {
356
378
#[ clap(
357
379
long,
358
- short,
359
380
default_value = "false" ,
360
381
help = "Run in the expected format for rust-analyzer's override check command"
361
382
) ]
362
383
ide_mode : bool ,
363
384
364
385
#[ clap(
365
386
long,
366
- short,
367
387
default_value = "all" ,
368
388
value_parser=clap:: value_parser!( CheckKind ) ,
369
389
value_name=CheckKind :: to_placeholder( ) ,
@@ -375,25 +395,25 @@ enum Xtasks {
375
395
Docs {
376
396
/// Open in browser
377
397
/// This will open the generated docs in the default browser
378
- #[ clap( long, short ) ]
398
+ #[ clap( long) ]
379
399
open : bool ,
380
400
381
401
/// Skip building rust docs
382
- #[ clap( long, short ) ]
402
+ #[ clap( long) ]
383
403
no_rust_docs : bool ,
384
404
} ,
385
405
/// Build the main workspace, and then run all tests
386
406
Test {
387
407
/// Run tests containing the given name only
388
- #[ clap( long, short ) ]
408
+ #[ clap( long) ]
389
409
name : Option < String > ,
390
410
391
411
/// Run tests in the given package only
392
- #[ clap( long, short ) ]
412
+ #[ clap( long) ]
393
413
package : Option < String > ,
394
414
395
415
/// Run tests without coverage
396
- #[ clap( long, short ) ]
416
+ #[ clap( long) ]
397
417
no_coverage : bool ,
398
418
} ,
399
419
/// Perform a full check as it would be done in CI, except not parallelised
@@ -454,22 +474,25 @@ impl Xtasks {
454
474
// we don't need to verify all feature flags on all platforms, this is mostly a "does it compile" check
455
475
// for finding out missing compile time logic or bad imports
456
476
multi_os_steps
457
- . retain ( |e| !e. command . contains ( "build" ) && !e. command . contains ( "docs" ) ) ;
477
+ . retain ( |e| !e. command . contains ( " build" ) && !e. command . contains ( " docs" ) ) ;
458
478
459
479
let mut macos_matrix = multi_os_steps. clone ( ) ;
460
480
let mut windows_matrix = multi_os_steps. clone ( ) ;
461
481
462
482
for row in macos_matrix. iter_mut ( ) {
463
483
row. os = "macos-latest" . to_owned ( ) ;
484
+ row. name = row. name . replace ( "ubuntu-latest" , "macos-latest" ) ;
464
485
}
465
486
466
487
for row in windows_matrix. iter_mut ( ) {
467
488
row. os = "windows-latest" . to_owned ( ) ;
489
+ row. name = row. name . replace ( "ubuntu-latest" , "windows-latest" ) ;
468
490
}
469
491
470
492
matrix. extend ( macos_matrix) ;
471
493
matrix. extend ( windows_matrix) ;
472
494
495
+ matrix. sort_by_key ( |e| e. name . to_owned ( ) ) ;
473
496
let json = serde_json:: to_string_pretty ( & matrix) ?;
474
497
return Ok ( json) ;
475
498
}
0 commit comments