From d1258eb2f83696f68cd0349ec57d4029662aec06 Mon Sep 17 00:00:00 2001 From: Anton Hansson Date: Tue, 8 Dec 2020 12:13:50 +0000 Subject: [PATCH] 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) --- core/artifact_path_requirements.mk | 4 +++- core/product.mk | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/core/artifact_path_requirements.mk b/core/artifact_path_requirements.mk index 8b2d71bf0..ceaefa269 100644 --- a/core/artifact_path_requirements.mk +++ b/core/artifact_path_requirements.mk @@ -35,7 +35,9 @@ $(foreach makefile,$(ARTIFACT_PATH_REQUIREMENT_PRODUCTS),\ $(makefile) produces files outside its artifact path requirement. \ Allowed paths are $(subst $(space),$(comma)$(space),$(addsuffix *,$(requirements)))) \ $(eval unused_allowed := $(filter-out $(files),$(allowed_patterns))) \ - $(call maybe-print-list-and-error,$(unused_allowed),$(makefile) includes redundant allowed entries in its artifact path requirement.) \ + $(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.) \ + ) \ $(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 files_in_requirement := $(filter $(path_patterns),$(extra_files))) \ diff --git a/core/product.mk b/core/product.mk index 9aebc28d6..f47e6f20b 100644 --- a/core/product.mk +++ b/core/product.mk @@ -463,6 +463,13 @@ define require-artifacts-in-path $(sort $(ARTIFACT_PATH_REQUIREMENT_PRODUCTS) $(current_mk))) 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. # $(1): list of non-existent modules to allow. define enforce-product-packages-exist