@@ -46,7 +46,8 @@ enum FeatureGroup {
46
46
LuaExclusive ,
47
47
RhaiExclusive ,
48
48
RuneExclusive ,
49
- NonExclusiveOther ,
49
+ ForExternalCrate ,
50
+ BMSFeature ,
50
51
}
51
52
52
53
impl FeatureGroup {
@@ -55,9 +56,16 @@ impl FeatureGroup {
55
56
FeatureGroup :: LuaExclusive => Feature :: Lua54 ,
56
57
FeatureGroup :: RhaiExclusive => Feature :: Rhai ,
57
58
FeatureGroup :: RuneExclusive => Feature :: Rune ,
58
- FeatureGroup :: NonExclusiveOther => panic ! ( "No default feature for non-exclusive group" ) ,
59
+ _ => panic ! ( "No default feature for non-exclusive group" ) ,
59
60
}
60
61
}
62
+
63
+ fn is_exclusive ( self ) -> bool {
64
+ matches ! (
65
+ self ,
66
+ FeatureGroup :: LuaExclusive | FeatureGroup :: RhaiExclusive | FeatureGroup :: RuneExclusive
67
+ )
68
+ }
61
69
}
62
70
63
71
trait IntoFeatureGroup {
@@ -76,7 +84,11 @@ impl IntoFeatureGroup for Feature {
76
84
| Feature :: Luau => FeatureGroup :: LuaExclusive ,
77
85
Feature :: Rhai => FeatureGroup :: RhaiExclusive ,
78
86
Feature :: Rune => FeatureGroup :: RuneExclusive ,
79
- _ => FeatureGroup :: NonExclusiveOther ,
87
+ Feature :: MluaAsync
88
+ | Feature :: MluaMacros
89
+ | Feature :: MluaSerialize
90
+ | Feature :: UnsafeLuaModules => FeatureGroup :: ForExternalCrate ,
91
+ _ => FeatureGroup :: BMSFeature ,
80
92
}
81
93
}
82
94
}
@@ -93,7 +105,7 @@ impl Features {
93
105
. iter ( )
94
106
. filter ( |f| {
95
107
let group = f. to_feature_group ( ) ;
96
- ( group == FeatureGroup :: NonExclusiveOther ) || ( * * f == group. default_feature ( ) )
108
+ ( ! group. is_exclusive ( ) ) || ( * * f == group. default_feature ( ) )
97
109
} )
98
110
. cloned ( )
99
111
. collect ( ) ,
@@ -507,13 +519,17 @@ impl Xtasks {
507
519
508
520
let grouped = all_features. split_by_group ( ) ;
509
521
510
- let non_exclusive = grouped
511
- . get ( & FeatureGroup :: NonExclusiveOther )
512
- . unwrap_or ( & vec ! [ ] )
513
- . clone ( ) ;
522
+ let features_to_combine = grouped
523
+ . get ( & FeatureGroup :: BMSFeature )
524
+ . expect ( "no bms features were found at all, bms definitely has feature flags" ) ;
514
525
515
526
// run powerset with all language features enabled without mutually exclusive
516
- let mut powersets = non_exclusive. iter ( ) . cloned ( ) . powerset ( ) . collect :: < Vec < _ > > ( ) ;
527
+ let mut powersets = features_to_combine
528
+ . iter ( )
529
+ . cloned ( )
530
+ . powerset ( )
531
+ . collect :: < Vec < _ > > ( ) ;
532
+
517
533
// start with longest to compile all first
518
534
powersets. reverse ( ) ;
519
535
info ! ( "Powerset: {:?}" , powersets) ;
@@ -525,6 +541,7 @@ impl Xtasks {
525
541
i + 1 ,
526
542
feature_set
527
543
) ;
544
+
528
545
// choose language features
529
546
for category in [
530
547
FeatureGroup :: LuaExclusive ,
@@ -534,6 +551,11 @@ impl Xtasks {
534
551
feature_set. 0 . push ( category. default_feature ( ) ) ;
535
552
}
536
553
554
+ // include all non-bms features
555
+ if let Some ( f) = grouped. get ( & FeatureGroup :: ForExternalCrate ) {
556
+ feature_set. 0 . extend ( f. iter ( ) . cloned ( ) ) ;
557
+ }
558
+
537
559
Self :: build ( feature_set) ?;
538
560
}
539
561
0 commit comments