@@ -12,12 +12,39 @@ mod util;
12
12
use anyhow:: Result ;
13
13
use cargo:: { fix_nested_cargo_env, Cargo , CargoAction , Feature , Package , TargetTypes } ;
14
14
use clap:: Parser ;
15
+ use itertools:: Itertools ;
15
16
use opt:: { Action , BuildOpt , ClippyOpt , DocOpt , Opt , QemuOpt } ;
16
17
use std:: process:: Command ;
17
18
use tempfile:: TempDir ;
18
19
use util:: { command_to_string, run_cmd} ;
19
20
21
+ fn build_feature_permutations ( opt : & BuildOpt ) -> Result < ( ) > {
22
+ for package in [ Package :: Uefi , Package :: UefiServices ] {
23
+ let all_package_features = Feature :: package_features ( package) ;
24
+ for features in all_package_features. iter ( ) . powerset ( ) {
25
+ let features = features. iter ( ) . map ( |f| * * f) . collect ( ) ;
26
+
27
+ let cargo = Cargo {
28
+ action : CargoAction :: Build ,
29
+ features,
30
+ packages : vec ! [ package] ,
31
+ release : opt. build_mode . release ,
32
+ target : Some ( * opt. target ) ,
33
+ warnings_as_errors : true ,
34
+ target_types : TargetTypes :: BinsExamplesLib ,
35
+ } ;
36
+ run_cmd ( cargo. command ( ) ?) ?;
37
+ }
38
+ }
39
+
40
+ Ok ( ( ) )
41
+ }
42
+
20
43
fn build ( opt : & BuildOpt ) -> Result < ( ) > {
44
+ if opt. feature_permutations {
45
+ return build_feature_permutations ( opt) ;
46
+ }
47
+
21
48
let cargo = Cargo {
22
49
action : CargoAction :: Build ,
23
50
features : Feature :: more_code ( ) ,
0 commit comments