generator: filter out already enabled features from required feature flags
This commit is contained in:
parent
7166b781bd
commit
3231fba9ba
1 changed files with 11 additions and 2 deletions
|
@ -163,10 +163,19 @@ def spec_render_crate(
|
|||
if feature_flags.all_features or distconf.all_features:
|
||||
cargo_args = " -a"
|
||||
elif required_features := get_required_features_for_binaries(package):
|
||||
# FIXME: remove features that are already part of the default feature set
|
||||
# remove required features that are already part of the enabled feature set
|
||||
enabled_by_default = package.get_enabled_features_transitive(feature_flags)[0]
|
||||
for f in enabled_by_default:
|
||||
if f in required_features:
|
||||
required_features.remove(f)
|
||||
|
||||
# merge, de-duplicate, and re-sort lists of enabled features
|
||||
enabled_features = sorted(set.union(set(required_features), set(distconf.enabled_features)))
|
||||
|
||||
if len(enabled_features) > 0:
|
||||
cargo_args = f" -f {','.join(enabled_features)}"
|
||||
else:
|
||||
cargo_args = ""
|
||||
elif distconf.enabled_features:
|
||||
# list of features is already sorted when parsing the configuration file
|
||||
cargo_args = f" -f {','.join(distconf.enabled_features)}"
|
||||
|
|
Loading…
Reference in a new issue