Add a "relaxed" mode for require-artifacts-in-path

This is useful when a makefile will produces different artifacts
depending on other configuration. Having an allow-list that's too strict
can make it a little  difficult to make progress.

Test: m nothing in follow-up
Change-Id: Ic8235912bcbaa8e249a752e042d4f42be4466e34
(cherry picked from commit 0b6fde311ac6bc2b64e69858382117a362645502)
This commit is contained in:
Anton Hansson 2020-12-08 12:13:50 +00:00
parent 0a246e5e31
commit d1258eb2f8
2 changed files with 10 additions and 1 deletions

View File

@ -35,7 +35,9 @@ $(foreach makefile,$(ARTIFACT_PATH_REQUIREMENT_PRODUCTS),\
$(makefile) produces files outside its artifact path requirement. \ $(makefile) produces files outside its artifact path requirement. \
Allowed paths are $(subst $(space),$(comma)$(space),$(addsuffix *,$(requirements)))) \ Allowed paths are $(subst $(space),$(comma)$(space),$(addsuffix *,$(requirements)))) \
$(eval unused_allowed := $(filter-out $(files),$(allowed_patterns))) \ $(eval unused_allowed := $(filter-out $(files),$(allowed_patterns))) \
$(if $(PRODUCTS.$(makefile).ARTIFACT_PATH_REQUIREMENT_IS_RELAXED),, \
$(call maybe-print-list-and-error,$(unused_allowed),$(makefile) includes redundant allowed entries in its artifact path requirement.) \ $(call maybe-print-list-and-error,$(unused_allowed),$(makefile) includes redundant allowed entries in its artifact path requirement.) \
) \
$(eval ### Optionally verify that nothing else produces files inside this artifact path requirement.) \ $(eval ### Optionally verify that nothing else produces files inside this artifact path requirement.) \
$(eval extra_files := $(filter-out $(files) $(HOST_OUT)/%,$(product_target_FILES))) \ $(eval extra_files := $(filter-out $(files) $(HOST_OUT)/%,$(product_target_FILES))) \
$(eval files_in_requirement := $(filter $(path_patterns),$(extra_files))) \ $(eval files_in_requirement := $(filter $(path_patterns),$(extra_files))) \

View File

@ -463,6 +463,13 @@ define require-artifacts-in-path
$(sort $(ARTIFACT_PATH_REQUIREMENT_PRODUCTS) $(current_mk))) $(sort $(ARTIFACT_PATH_REQUIREMENT_PRODUCTS) $(current_mk)))
endef endef
# Like require-artifacts-in-path, but does not require all allow-list entries to
# have an effect.
define require-artifacts-in-path-relaxed
$(require-artifacts-in-path) \
$(eval PRODUCTS.$(current_mk).ARTIFACT_PATH_REQUIREMENT_IS_RELAXED := true)
endef
# Makes including non-existent modules in PRODUCT_PACKAGES an error. # Makes including non-existent modules in PRODUCT_PACKAGES an error.
# $(1): list of non-existent modules to allow. # $(1): list of non-existent modules to allow.
define enforce-product-packages-exist define enforce-product-packages-exist