Check module existence with ALL_MODULES subvars
Use ALL_MODULES.*.PATH to check module existence.
Use get-modules-for-2nd-arch to check the existence of second arch
variant.
Fix some typos *existant -> existent
Bug: 155869107
Test: lunch mainline_system_arm64; m
Test: lunch generic; m
Change-Id: Ic10fb34a11da0bfbfc528da7496fd929b1d77113
diff --git a/core/main.mk b/core/main.mk
index 9c52b01..5d2ec7c 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -1157,13 +1157,12 @@
_modules := $(patsubst %:64,%,$(_modules))
# Sanity check all modules in PRODUCT_PACKAGES exist. We check for the
# existence if either <module> or the <module>_32 variant.
- _nonexistent_modules := $(filter-out $(ALL_MODULES),$(_modules))
- _nonexistent_modules := $(foreach m,$(_nonexistent_modules),\
- $(if $(call get-32-bit-modules,$(m)),,$(m)))
+ _nonexistent_modules := $(foreach m,$(_modules), \
+ $(if $(or $(ALL_MODULES.$(m).PATH),$(call get-modules-for-2nd-arch,TARGET,$(m))),,$(m)))
$(call maybe-print-list-and-error,$(filter-out $(_whitelist),$(_nonexistent_modules)),\
$(INTERNAL_PRODUCT) includes non-existent modules in PRODUCT_PACKAGES)
$(call maybe-print-list-and-error,$(filter-out $(_nonexistent_modules),$(_whitelist)),\
- $(INTERNAL_PRODUCT) includes redundant whitelist entries for nonexistent PRODUCT_PACKAGES)
+ $(INTERNAL_PRODUCT) includes redundant whitelist entries for non-existent PRODUCT_PACKAGES)
endif
# Check to ensure that all modules in PRODUCT_HOST_PACKAGES exist
diff --git a/core/product.mk b/core/product.mk
index 0aa07ef..9c54849 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -458,8 +458,8 @@
$(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.
+# Makes including non-existent modules in PRODUCT_PACKAGES an error.
+# $(1): whitelist of non-existent 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) \