diff --git a/core/main.mk b/core/main.mk index 87dd437d75..a2f624ccb7 100644 --- a/core/main.mk +++ b/core/main.mk @@ -965,6 +965,17 @@ $(foreach makefile,$(ARTIFACT_PATH_REQUIREMENT_PRODUCTS),\ $(call maybe-print-list-and-error,$(offending_files),$(makefile) produces files outside its artifact path requirement.) \ $(eval unused_whitelist := $(filter-out $(files),$(whitelist_patterns))) \ $(call maybe-print-list-and-error,$(unused_whitelist),$(makefile) includes redundant whitelist entries in its artifact path requirement.) \ + $(eval ### Optionally verify that nothing else produces files inside this artifact path requirement.) \ + $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS),\ + $(eval extra_files := $(filter-out $(files) $(HOST_OUT)/%,$(product_FILES))) \ + $(eval whitelist := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST)) \ + $(eval whitelist_patterns := $(call resolve-product-relative-paths,$(whitelist))) \ + $(eval files_in_requirement := $(filter $(path_patterns),$(extra_files))) \ + $(eval offending_files := $(filter-out $(whitelist_patterns),$(files_in_requirement))) \ + $(call maybe-print-list-and-error,$(offending_files),$(INTERNAL_PRODUCT) produces files inside $(makefile)s artifact path requirement.) \ + $(eval unused_whitelist := $(filter-out $(extra_files),$(whitelist_patterns))) \ + $(call maybe-print-list-and-error,$(unused_whitelist),$(INTERNAL_PRODUCT) includes redundant artifact path requirement whitelist entries.) \ + ) \ ) ifeq (0,1) diff --git a/core/product.mk b/core/product.mk index 3cf521ab17..f22a3e5fa8 100644 --- a/core/product.mk +++ b/core/product.mk @@ -198,6 +198,8 @@ _product_var_list := \ PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE \ PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE \ PRODUCT_USE_LOGICAL_PARTITIONS \ + PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS \ + PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST \ define dump-product $(info ==== $(1) ====)\