@@ -12,12 +12,39 @@ mod util;
1212use anyhow:: Result ;
1313use cargo:: { fix_nested_cargo_env, Cargo , CargoAction , Feature , Package , TargetTypes } ;
1414use clap:: Parser ;
15+ use itertools:: Itertools ;
1516use opt:: { Action , BuildOpt , ClippyOpt , DocOpt , Opt , QemuOpt } ;
1617use std:: process:: Command ;
1718use tempfile:: TempDir ;
1819use util:: { command_to_string, run_cmd} ;
1920
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+
2043fn build ( opt : & BuildOpt ) -> Result < ( ) > {
44+ if opt. feature_permutations {
45+ return build_feature_permutations ( opt) ;
46+ }
47+
2148 let cargo = Cargo {
2249 action : CargoAction :: Build ,
2350 features : Feature :: more_code ( ) ,
0 commit comments