Allow setting PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS to false

Some products clear PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS
in order to disable it. But oftentimes this clearing relies on
the fact that clearing a variable will also cause it to not
inherit from any already-inherited files. Starlark doesn't support
this inheritance behavior, so allow setting
PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS to false so that it
can be explicetly disabled instead of relying on the clearing
behavior.

Bug: 221312707
Test: Manually
Change-Id: I03a227911c6985a65fc5d210682bbd4ac9bd6747
This commit is contained in:
Cole Faust 2022-04-12 13:23:04 -07:00
parent ea935b5ad9
commit 5d46c6133b

View file

@ -22,6 +22,10 @@ ifeq (true,$(BOARD_USES_SYSTEM_OTHER_ODEX))
$(TARGET_OUT_SYSTEM_OTHER)/%.art
endif
ifneq (,$(filter-out true false relaxed strict,$(PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS))$(filter-out 1 0,$(words $(PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS))))
$(error PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS must be one of [true, false, relaxed, strict], found: $(PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS))
endif
all_offending_files :=
$(foreach makefile,$(ARTIFACT_PATH_REQUIREMENT_PRODUCTS),\
$(eval requirements := $(PRODUCTS.$(makefile).ARTIFACT_PATH_REQUIREMENTS)) \
@ -46,7 +50,7 @@ $(foreach makefile,$(ARTIFACT_PATH_REQUIREMENT_PRODUCTS),\
$(eval allowed_patterns := $(call resolve-product-relative-paths,$(allowed))) \
$(eval offending_files := $(filter-out $(allowed_patterns),$(files_in_requirement))) \
$(eval enforcement := $(PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS)) \
$(if $(enforcement),\
$(if $(filter-out false,$(enforcement)),\
$(call maybe-print-list-and-error,$(offending_files),\
$(INTERNAL_PRODUCT) produces files inside $(makefile)s artifact path requirement. \
$(PRODUCT_ARTIFACT_PATH_REQUIREMENT_HINT)) \