1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #16012 from maribu/fix-feature-resolution-again

build system: don't optionally use conflicting features
This commit is contained in:
benpicco 2021-02-24 20:22:50 +01:00 committed by GitHub
commit 7c71fb2c78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 3 deletions

View File

@ -1,7 +1,23 @@
# Check if all required FEATURES are provided
# Features that are provided and not blacklisted
FEATURES_USABLE := $(filter-out $(FEATURES_BLACKLIST),$(FEATURES_PROVIDED))
# Features that are used without taking "one out of" dependencies into account
FEATURES_USED_SO_FAR := $(sort $(FEATURES_REQUIRED) $(FEATURES_OPTIONAL_USED))
# Get features which inclusion would cause a conflict
# Parameter 1: Features currently used
# Parameter 2: A set of features that would conflict (separated by spaces)
# Algorithm: If interaction of the two lists is empty, return an empty set. Otherwise return
# the set of conflicting features without the feature in it that is already used
_features_would_conflict = $(if $(filter $1,$2),$(filter-out $1,$2))
# Adding any of the following features would result in a feature conflict with the already used
# features:
FEATURES_WOULD_CONFLICT := $(foreach conflict,$(FEATURES_CONFLICT),\
$(call _features_would_conflict,\
$(FEATURES_USED_SO_FAR),$(subst :, ,$(conflict))))
# Features that are provided, not blacklisted, and do not conflict with any used feature
FEATURES_USABLE := $(filter-out $(FEATURES_BLACKLIST) $(FEATURES_WOULD_CONFLICT),\
$(FEATURES_PROVIDED))
# Features that may be used, if provided.
FEATURES_OPTIONAL_ONLY := $(sort $(filter-out $(FEATURES_REQUIRED),$(FEATURES_OPTIONAL)))
@ -12,7 +28,7 @@ FEATURES_OPTIONAL_USED := $(sort $(filter $(FEATURES_USABLE),$(FEATURES_OPTIONAL
# Optional features that will not be used because they are not provided or blacklisted
FEATURES_OPTIONAL_MISSING := $(sort $(filter-out $(FEATURES_USABLE),$(FEATURES_OPTIONAL_ONLY)))
# Features that are used without taking "one out of" dependencies into account
# Update to account for change in FEATURES_OPTIONAL_USED
FEATURES_USED_SO_FAR := $(sort $(FEATURES_REQUIRED) $(FEATURES_OPTIONAL_USED))
# Additionally required features due to the "one out of" dependencies

View File

@ -0,0 +1,15 @@
# inputs
FEATURES_OPTIONAL := b
FEATURES_REQUIRED := a c
FEATURES_REQUIRED_ANY :=
FEATURES_PROVIDED := a b c d
FEATURES_BLACKLIST :=
FEATURES_CONFLICT := a:b c:d
# expected results
EXPECTED_FEATURES_USED := a c
EXPECTED_FEATURES_MISSING :=
EXPECTED_FEATURES_USED_BLACKLISTED :=
EXPECTED_FEATURES_CONFLICTING :=
include Makefile.test