diff --git a/core/main.mk b/core/main.mk index 7292277ac5..76a1f3fe64 100644 --- a/core/main.mk +++ b/core/main.mk @@ -1001,17 +1001,21 @@ $(foreach makefile,$(ARTIFACT_PATH_REQUIREMENT_PRODUCTS),\ $(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.) \ + $(eval extra_files := $(filter-out $(files) $(HOST_OUT)/%,$(product_FILES))) \ + $(eval files_in_requirement := $(filter $(path_patterns),$(extra_files))) \ + $(eval all_offending_files += $(files_in_requirement)) \ + $(eval whitelist := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST)) \ + $(eval whitelist_patterns := $(call resolve-product-relative-paths,$(whitelist))) \ + $(eval offending_files := $(filter-out $(whitelist_patterns),$(files_in_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.) \ ) \ ) +$(PRODUCT_OUT)/offending_artifacts.txt: + rm -f $@ + $(foreach f,$(sort $(all_offending_files)),echo $(f) >> $@;) ifeq (0,1) $(info product_FILES for $(TARGET_DEVICE) ($(INTERNAL_PRODUCT)):)