Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make: handle blacklisted features separately from missing requirements #12453

Merged
merged 3 commits into from
Oct 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions Makefile.features
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ endif
# Features that are required by the application but not provided by the BSP and
# features that are used but blacklisted (prepended with "!").
# Having features missing may case the build to fail.
FEATURES_MISSING = $(sort $(filter-out $(FEATURES_PROVIDED),$(FEATURES_REQUIRED)) \
$(call _features_used_blacklisted))
FEATURES_MISSING = $(sort $(filter-out $(FEATURES_PROVIDED),$(FEATURES_REQUIRED)))

# Features that are only optional and not required at the same time.
# The policy is to by default use by features if they are provided by the BSP.
Expand All @@ -50,6 +49,6 @@ _features_conflicting = $(if $(call _features_used_conflicting,$(subst :, ,$1)),
# Return non empty on error
_features_used_conflicting = $(filter $(words $1),$(words $(filter $(FEATURES_USED),$1)))

# Return features that are used but blacklisted as
# "!<feature>" ("not feature")
_features_used_blacklisted = $(addprefix !,$(sort $(filter $(FEATURES_USED), $(FEATURES_BLACKLIST))))
# Features that are used by the application but blacklisted by the BSP.
# Having blacklisted features may cause the build to fail.
FEATURES_USED_BLACKLISTED = $(sort $(filter $(FEATURES_USED), $(FEATURES_BLACKLIST)))
10 changes: 7 additions & 3 deletions Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -732,16 +732,20 @@ ifneq (, $(filter all flash, $(if $(MAKECMDGOALS), $(MAKECMDGOALS), all)))
EXPECT_ERRORS := 1
endif

# turn provided but blacklisted features into required "!<feature>"
FEATURES_REQUIRED += $(addprefix !,$(sort $(filter $(FEATURES_PROVIDED), $(FEATURES_BLACKLIST))))

# Test if all feature requirements were met by the selected board.
ifneq (,$(FEATURES_MISSING))
$(shell $(COLOR_ECHO) "$(COLOR_RED)There are unsatisfied feature requirements:$(COLOR_RESET)"\
"$(FEATURES_MISSING)" 1>&2)
EXPECT_ERRORS := 1
endif

# Test if no feature in the requirements used is blacklisted for the selected board.
ifneq (,$(FEATURES_USED_BLACKLISTED))
$(shell $(COLOR_ECHO) "$(COLOR_RED)Some feature requirements are blacklisted:$(COLOR_RESET)"\
"$(FEATURES_USED_BLACKLISTED)" 1>&2)
EXPECT_ERRORS := 1
endif

# Test if any used feature conflict with another one.
ifneq (,$(FEATURES_CONFLICTING))
$(shell $(COLOR_ECHO) "$(COLOR_YELLOW)The following features may conflict:$(COLOR_RESET)"\
Expand Down
14 changes: 11 additions & 3 deletions makefiles/info-global.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ DISABLE_MODULE_GLOBAL := $(DISABLE_MODULE)
DEFAULT_MODULE_GLOBAL := $(DEFAULT_MODULE)
FEATURES_BLACKLIST_GLOBAL := $(FEATURES_BLACKLIST)

define board_missing_features
define board_unsatisfied_features
BOARD := $(1)
USEMODULE := $(USEMODULE_GLOBAL)
USEPKG := $(USEPKG_GLOBAL)
Expand Down Expand Up @@ -43,6 +43,11 @@ define board_missing_features
BOARDS_WITH_MISSING_FEATURES += $(1)
endif

ifneq (,$$(FEATURES_USED_BLACKLISTED))
BOARDS_FEATURES_USED_BLACKLISTED += "$(1) $$(FEATURES_USED_BLACKLISTED)"
BOARDS_WITH_BLACKLISTED_FEATURES += $(1)
endif

ifneq (,$$(DEPENDENCY_DEBUG))
$$(call file_save_dependencies_variables,dependencies_info-boards-supported)
endif
Expand All @@ -53,8 +58,11 @@ BOARDS := $(filter-out $(BOARD_BLACKLIST), $(BOARDS))

BOARDS_WITH_MISSING_FEATURES :=
BOARDS_FEATURES_MISSING :=
$(foreach BOARD, $(BOARDS), $(eval $(call board_missing_features,$(BOARD))))
BOARDS := $(filter-out $(BOARDS_WITH_MISSING_FEATURES), $(BOARDS))
BOARDS_WITH_BLACKLISTED_FEATURES :=
BOARDS_FEATURES_USED_BLACKLISTED :=

$(foreach BOARD, $(BOARDS), $(eval $(call board_unsatisfied_features,$(BOARD))))
BOARDS := $(filter-out $(BOARDS_WITH_MISSING_FEATURES) $(BOARDS_WITH_BLACKLISTED_FEATURES), $(BOARDS))

info-buildsizes: SHELL=bash
info-buildsizes:
Expand Down
2 changes: 2 additions & 0 deletions makefiles/info.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ info-build:
@echo ' $(or $(FEATURES_MISSING), -none-)'
@echo 'FEATURES_BLACKLIST (blacklisted features):'
@echo ' $(or $(sort $(FEATURES_BLACKLIST)), -none-)'
@echo 'FEATURES_USED_BLACKLISTED (used but blacklisted features):'
@echo ' $(or $(sort $(FEATURES_USED_BLACKLISTED)), -none-)'
@echo ''
@echo 'FEATURES_CONFLICT: $(FEATURES_CONFLICT)'
@echo 'FEATURES_CONFLICT_MSG: $(FEATURES_CONFLICT_MSG)'
Expand Down