Skip to content

Commit 3a7264e

Browse files
committed
reduce feature combinations to test
1 parent 8022f2a commit 3a7264e

File tree

1 file changed

+31
-9
lines changed

1 file changed

+31
-9
lines changed

crates/xtask/src/main.rs

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ enum FeatureGroup {
4646
LuaExclusive,
4747
RhaiExclusive,
4848
RuneExclusive,
49-
NonExclusiveOther,
49+
ForExternalCrate,
50+
BMSFeature,
5051
}
5152

5253
impl FeatureGroup {
@@ -55,9 +56,16 @@ impl FeatureGroup {
5556
FeatureGroup::LuaExclusive => Feature::Lua54,
5657
FeatureGroup::RhaiExclusive => Feature::Rhai,
5758
FeatureGroup::RuneExclusive => Feature::Rune,
58-
FeatureGroup::NonExclusiveOther => panic!("No default feature for non-exclusive group"),
59+
_ => panic!("No default feature for non-exclusive group"),
5960
}
6061
}
62+
63+
fn is_exclusive(self) -> bool {
64+
matches!(
65+
self,
66+
FeatureGroup::LuaExclusive | FeatureGroup::RhaiExclusive | FeatureGroup::RuneExclusive
67+
)
68+
}
6169
}
6270

6371
trait IntoFeatureGroup {
@@ -76,7 +84,11 @@ impl IntoFeatureGroup for Feature {
7684
| Feature::Luau => FeatureGroup::LuaExclusive,
7785
Feature::Rhai => FeatureGroup::RhaiExclusive,
7886
Feature::Rune => FeatureGroup::RuneExclusive,
79-
_ => FeatureGroup::NonExclusiveOther,
87+
Feature::MluaAsync
88+
| Feature::MluaMacros
89+
| Feature::MluaSerialize
90+
| Feature::UnsafeLuaModules => FeatureGroup::ForExternalCrate,
91+
_ => FeatureGroup::BMSFeature,
8092
}
8193
}
8294
}
@@ -93,7 +105,7 @@ impl Features {
93105
.iter()
94106
.filter(|f| {
95107
let group = f.to_feature_group();
96-
(group == FeatureGroup::NonExclusiveOther) || (**f == group.default_feature())
108+
(!group.is_exclusive()) || (**f == group.default_feature())
97109
})
98110
.cloned()
99111
.collect(),
@@ -507,13 +519,17 @@ impl Xtasks {
507519

508520
let grouped = all_features.split_by_group();
509521

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");
514525

515526
// 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+
517533
// start with longest to compile all first
518534
powersets.reverse();
519535
info!("Powerset: {:?}", powersets);
@@ -525,6 +541,7 @@ impl Xtasks {
525541
i + 1,
526542
feature_set
527543
);
544+
528545
// choose language features
529546
for category in [
530547
FeatureGroup::LuaExclusive,
@@ -534,6 +551,11 @@ impl Xtasks {
534551
feature_set.0.push(category.default_feature());
535552
}
536553

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+
537559
Self::build(feature_set)?;
538560
}
539561

0 commit comments

Comments
 (0)