Merge "Don't apply path enforcements for non-full builds."
am: 362fff4fcd
Change-Id: I8578f069aa8b032832ef35dd78b973b517e6b547
This commit is contained in:
commit
b682674226
65
core/main.mk
65
core/main.mk
|
@ -981,6 +981,39 @@ endif
|
|||
|
||||
ifdef FULL_BUILD
|
||||
product_FILES := $(call product-installed-files, $(INTERNAL_PRODUCT))
|
||||
|
||||
# Verify the artifact path requirements made by included products.
|
||||
all_offending_files :=
|
||||
$(foreach makefile,$(ARTIFACT_PATH_REQUIREMENT_PRODUCTS),\
|
||||
$(eval requirements := $(PRODUCTS.$(makefile).ARTIFACT_PATH_REQUIREMENTS)) \
|
||||
$(eval ### Verify that the product only produces files inside its path requirements.) \
|
||||
$(eval whitelist := $(PRODUCTS.$(makefile).ARTIFACT_PATH_WHITELIST)) \
|
||||
$(eval path_patterns := $(call resolve-product-relative-paths,$(requirements),%)) \
|
||||
$(eval whitelist_patterns := $(call resolve-product-relative-paths,$(whitelist))) \
|
||||
$(eval files := $(call product-installed-files, $(makefile))) \
|
||||
$(eval files := $(filter-out $(TARGET_OUT_FAKE)/% $(HOST_OUT)/%,$(files))) \
|
||||
$(eval # RROs become REQUIRED by the source module, but are always placed on the vendor partition.) \
|
||||
$(eval files := $(filter-out %__auto_generated_rro.apk,$(files))) \
|
||||
$(eval offending_files := $(filter-out $(path_patterns) $(whitelist_patterns),$(files))) \
|
||||
$(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.) \
|
||||
$(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),\
|
||||
$(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) >> $@;)
|
||||
else
|
||||
# We're not doing a full build, and are probably only including
|
||||
# a subset of the module makefiles. Don't try to build any modules
|
||||
|
@ -989,38 +1022,6 @@ else
|
|||
product_FILES :=
|
||||
endif
|
||||
|
||||
# Verify the artifact path requirements made by included products.
|
||||
$(foreach makefile,$(ARTIFACT_PATH_REQUIREMENT_PRODUCTS),\
|
||||
$(eval requirements := $(PRODUCTS.$(makefile).ARTIFACT_PATH_REQUIREMENTS)) \
|
||||
$(eval ### Verify that the product only produces files inside its path requirements.) \
|
||||
$(eval whitelist := $(PRODUCTS.$(makefile).ARTIFACT_PATH_WHITELIST)) \
|
||||
$(eval path_patterns := $(call resolve-product-relative-paths,$(requirements),%)) \
|
||||
$(eval whitelist_patterns := $(call resolve-product-relative-paths,$(whitelist))) \
|
||||
$(eval files := $(call product-installed-files, $(makefile))) \
|
||||
$(eval files := $(filter-out $(TARGET_OUT_FAKE)/% $(HOST_OUT)/%,$(files))) \
|
||||
$(eval # RROs become REQUIRED by the source module, but are always placed on the vendor partition.) \
|
||||
$(eval files := $(filter-out %__auto_generated_rro.apk,$(files))) \
|
||||
$(eval offending_files := $(filter-out $(path_patterns) $(whitelist_patterns),$(files))) \
|
||||
$(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.) \
|
||||
$(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),\
|
||||
$(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)):)
|
||||
$(foreach p,$(product_FILES),$(info : $(p)))
|
||||
|
|
Loading…
Reference in New Issue