Remove usages of long-form variables
The long-form variables (PRODUCTS.<makefile>.<variable>)
are used to get information about multiple products.
However, they've never really worked correctly, and so
importing multiple products is deprecated behavior.
Remove as many usages of the long-form variables and
multi-product imports as possible.
Bug: 228518445
Test: Manually
Change-Id: I0b67f16360ff8bdcdb39638de739440472bccf76
diff --git a/core/product.mk b/core/product.mk
index f316114..53fee1c 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -377,17 +377,6 @@
.KATI_READONLY := _product_single_value_vars _product_list_vars
_product_var_list :=$= $(_product_single_value_vars) $(_product_list_vars)
-define dump-product
-$(warning ==== $(1) ====)\
-$(foreach v,$(_product_var_list),\
-$(warning PRODUCTS.$(1).$(v) := $(call get-product-var,$(1),$(v))))\
-$(warning --------)
-endef
-
-define dump-products
-$(foreach p,$(PRODUCTS),$(call dump-product,$(p)))
-endef
-
#
# Functions for including product makefiles
#
@@ -464,64 +453,18 @@
#
-# Does various consistency checks on all of the known products.
+# Does various consistency checks on the current product.
# Takes no parameters, so $(call ) is not necessary.
#
-define check-all-products
+define check-current-product
$(if ,, \
- $(eval _cap_names :=) \
- $(foreach p,$(PRODUCTS), \
- $(eval pn := $(strip $(PRODUCTS.$(p).PRODUCT_NAME))) \
- $(if $(pn),,$(error $(p): PRODUCT_NAME must be defined.)) \
- $(if $(filter $(pn),$(_cap_names)), \
- $(error $(p): PRODUCT_NAME must be unique; "$(pn)" already used by $(strip \
- $(foreach \
- pp,$(PRODUCTS),
- $(if $(filter $(pn),$(PRODUCTS.$(pp).PRODUCT_NAME)), \
- $(pp) \
- ))) \
- ) \
- ) \
- $(eval _cap_names += $(pn)) \
- $(if $(call is-c-identifier,$(pn)),, \
- $(error $(p): PRODUCT_NAME must be a valid C identifier, not "$(pn)") \
- ) \
- $(eval pb := $(strip $(PRODUCTS.$(p).PRODUCT_BRAND))) \
- $(if $(pb),,$(error $(p): PRODUCT_BRAND must be defined.)) \
- $(foreach cf,$(strip $(PRODUCTS.$(p).PRODUCT_COPY_FILES)), \
- $(if $(filter 2 3,$(words $(subst :,$(space),$(cf)))),, \
- $(error $(p): malformed COPY_FILE "$(cf)") \
- ) \
- ) \
- ) \
-)
-endef
-
-
-#
-# Returns the product makefile path for the product with the provided name
-#
-# $(1): short product name like "generic"
-#
-define _resolve-short-product-name
- $(eval pn := $(strip $(1)))
- $(eval p := \
- $(foreach p,$(PRODUCTS), \
- $(if $(filter $(pn),$(PRODUCTS.$(p).PRODUCT_NAME)), \
- $(p) \
- )) \
- )
- $(eval p := $(sort $(p)))
- $(if $(filter 1,$(words $(p))), \
- $(p), \
- $(if $(filter 0,$(words $(p))), \
- $(error No matches for product "$(pn)"), \
- $(error Product "$(pn)" ambiguous: matches $(p)) \
- ) \
- )
-endef
-define resolve-short-product-name
-$(strip $(call _resolve-short-product-name,$(1)))
+ $(if $(call is-c-identifier,$(PRODUCT_NAME)),, \
+ $(error $(INTERNAL_PRODUCT): PRODUCT_NAME must be a valid C identifier, not "$(pn)")) \
+ $(if $(PRODUCT_BRAND),, \
+ $(error $(INTERNAL_PRODUCT): PRODUCT_BRAND must be defined.)) \
+ $(foreach cf,$(strip $(PRODUCT_COPY_FILES)), \
+ $(if $(filter 2 3,$(words $(subst :,$(space),$(cf)))),, \
+ $(error $(p): malformed COPY_FILE "$(cf)"))))
endef
# BoardConfig variables that are also inherited in product mks. Should ideally