Merge "Make including missing modules an error."
am: 65dc646c76
Change-Id: I7cf277de314e06d84cc19c0def52cd035bbae51a
This commit is contained in:
commit
0b14a57aaf
3 changed files with 41 additions and 12 deletions
38
core/main.mk
38
core/main.mk
|
@ -929,6 +929,32 @@ define product-installed-files
|
|||
$(call module-installed-files, $(_pif_modules))
|
||||
endef
|
||||
|
||||
# Fails the build if the given list is non-empty, and prints it entries (stripping PRODUCT_OUT).
|
||||
# $(1): list of files to print
|
||||
# $(2): heading to print on failure
|
||||
define maybe-print-list-and-error
|
||||
$(if $(strip $(1)), \
|
||||
$(warning $(2)) \
|
||||
$(info Offending entries:) \
|
||||
$(foreach e,$(sort $(1)),$(info $(patsubst $(PRODUCT_OUT)/%,%,$(e)))) \
|
||||
$(error Build failed) \
|
||||
)
|
||||
endef
|
||||
|
||||
ifeq (true|,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ENFORCE_PACKAGES_EXIST)|$(filter true,$(ALLOW_MISSING_DEPENDENCIES)))
|
||||
_whitelist := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ENFORCE_PACKAGES_EXIST_WHITELIST)
|
||||
_modules := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES)
|
||||
# Sanity check all modules in PRODUCT_PACKAGES exist. We check for the
|
||||
# existence if either <module> or the <module>_32 variant.
|
||||
_nonexistant_modules := $(filter-out $(ALL_MODULES),$(_modules))
|
||||
_nonexistant_modules := $(foreach m,$(_nonexistant_modules),\
|
||||
$(if $(call get-32-bit-modules,$(m)),,$(m)))
|
||||
$(call maybe-print-list-and-error,$(filter-out $(_whitelist),$(_nonexistant_modules)),\
|
||||
$(INTERNAL_PRODUCT) includes non-existant modules in PRODUCT_PACKAGES)
|
||||
$(call maybe-print-list-and-error,$(filter-out $(_nonexistant_modules),$(_whitelist)),\
|
||||
$(INTERNAL_PRODUCT) includes redundant whitelist entries for nonexistant PRODUCT_PACKAGES)
|
||||
endif
|
||||
|
||||
ifdef FULL_BUILD
|
||||
product_FILES := $(call product-installed-files, $(INTERNAL_PRODUCT))
|
||||
else
|
||||
|
@ -948,18 +974,6 @@ define resolve-product-relative-paths
|
|||
$(foreach p,$(1),$(PRODUCT_OUT)/$(p)$(2))))
|
||||
endef
|
||||
|
||||
# Fails the build if the given list is non-empty, and prints it entries (stripping PRODUCT_OUT).
|
||||
# $(1): list of files to print
|
||||
# $(2): heading to print on failure
|
||||
define maybe-print-list-and-error
|
||||
$(if $(strip $(1)), \
|
||||
$(warning $(2)) \
|
||||
$(info Offending entries:) \
|
||||
$(foreach e,$(sort $(1)),$(info $(patsubst $(PRODUCT_OUT)/%,%,$(e)))) \
|
||||
$(error Build failed) \
|
||||
)
|
||||
endef
|
||||
|
||||
# Verify the artifact path requirements made by included products.
|
||||
$(foreach makefile,$(ARTIFACT_PATH_REQUIREMENT_PRODUCTS),\
|
||||
$(eval requirements := $(PRODUCTS.$(makefile).ARTIFACT_PATH_REQUIREMENTS)) \
|
||||
|
|
|
@ -247,6 +247,16 @@ define require-artifacts-in-path
|
|||
$(sort $(ARTIFACT_PATH_REQUIREMENT_PRODUCTS) $(current_mk)))
|
||||
endef
|
||||
|
||||
# Makes including non-existant modules in PRODUCT_PACKAGES an error.
|
||||
# $(1): whitelist of non-existant modules to allow.
|
||||
define enforce-product-packages-exist
|
||||
$(eval current_mk := $(strip $(word 1,$(_include_stack)))) \
|
||||
$(eval PRODUCTS.$(current_mk).PRODUCT_ENFORCE_PACKAGES_EXIST := true) \
|
||||
$(eval PRODUCTS.$(current_mk).PRODUCT_ENFORCE_PACKAGES_EXIST_WHITELIST := $(1)) \
|
||||
$(eval .KATI_READONLY := PRODUCTS.$(current_mk).PRODUCT_ENFORCE_PACKAGES_EXIST) \
|
||||
$(eval .KATI_READONLY := PRODUCTS.$(current_mk).PRODUCT_ENFORCE_PACKAGES_EXIST_WHITELIST)
|
||||
endef
|
||||
|
||||
#
|
||||
# Do inherit-product only if $(1) exists
|
||||
#
|
||||
|
|
|
@ -24,3 +24,8 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/telephony.mk)
|
|||
PRODUCT_BRAND := generic
|
||||
PRODUCT_DEVICE := generic
|
||||
PRODUCT_NAME := generic
|
||||
|
||||
_whitelist := \
|
||||
device_manifest.xml \
|
||||
|
||||
$(call enforce-product-packages-exist,$(_whitelist))
|
||||
|
|
Loading…
Reference in a new issue