Generate FlatConfig objects from GenericConfig objects.

Doesn't include tests. More of those will come later.

Test: build/make/tools/product_config/test.sh
Change-Id: Icd2b455ac5f7b4773ba332fc40e994dc6f024f1b
diff --git a/core/dumpconfig.mk b/core/dumpconfig.mk
index dd3ef43..9b1f2c2 100644
--- a/core/dumpconfig.mk
+++ b/core/dumpconfig.mk
@@ -36,6 +36,10 @@
     $(error stopping)
 endif
 
+# Skip the second inclusion of all of the product config files, because
+# we will do these checks in the product_config tool.
+SKIP_ARTIFACT_PATH_REQUIREMENT_PRODUCTS_CHECK := true
+
 # Before we do anything else output the format version.
 $(file > $(DUMPCONFIG_FILE),dumpconfig_version,1)
 $(file >> $(DUMPCONFIG_FILE),dumpconfig_file,$(DUMPCONFIG_FILE))
@@ -75,7 +79,7 @@
 endef
 
 # Args:
-#   $(1): Config phase (PRODUCT or DEVICE)
+#   $(1): Config phase (PRODUCT, EXPAND, or DEVICE)
 #   $(2): Root nodes to import
 #   $(3): All variable names
 #   $(4): Single-value variables
@@ -104,10 +108,21 @@
 	.KATI_SYMBOLS \
 	1 \
 	2 \
+	3 \
+	4 \
+	5 \
+	6 \
+	7 \
+	8 \
+	9 \
 	LOCAL_PATH \
 	MAKEFILE_LIST \
 	PARENT_PRODUCT_FILES \
 	current_mk \
+	_eiv_ev \
+	_eiv_i \
+	_eiv_sv \
+	_eiv_tv \
 	inherit_var \
 	np \
 	_node_import_context \
diff --git a/core/product.mk b/core/product.mk
index 170402a..8976dd9 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -606,6 +606,8 @@
 # to a shorthand that is more convenient to read from elsewhere.
 #
 define strip-product-vars
+$(call dump-phase-start,PRODUCT-EXPAND,,$(_product_var_list),$(_product_single_value_vars), \
+		build/make/core/product.mk) \
 $(foreach v,\
   $(_product_var_list) \
     PRODUCT_ENFORCE_PACKAGES_EXIST \
@@ -613,7 +615,8 @@
   $(eval $(v) := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).$(v)))) \
   $(eval get-product-var = $$(if $$(filter $$(1),$$(INTERNAL_PRODUCT)),$$($$(2)),$$(PRODUCTS.$$(strip $$(1)).$$(2)))) \
   $(KATI_obsolete_var PRODUCTS.$(INTERNAL_PRODUCT).$(v),Use $(v) instead) \
-)
+) \
+$(call dump-phase-end,build/make/core/product.mk)
 endef
 
 define add-to-product-copy-files-if-exists
diff --git a/core/product_config.mk b/core/product_config.mk
index 6d886ec..c1c08d1 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -163,12 +163,14 @@
 # Quick check
 $(check-all-products)
 
+ifeq ($(SKIP_ARTIFACT_PATH_REQUIREMENT_PRODUCTS_CHECK),)
 # Import all the products that have made artifact path requirements, so that we can verify
 # the artifacts they produce.
 # These are imported after check-all-products because some of them might not be real products.
 $(foreach makefile,$(ARTIFACT_PATH_REQUIREMENT_PRODUCTS),\
   $(if $(filter-out $(makefile),$(PRODUCTS)),$(eval $(call import-products,$(makefile))))\
 )
+endif
 
 ifneq ($(filter dump-products, $(MAKECMDGOALS)),)
 $(dump-products)
@@ -181,14 +183,16 @@
 ifneq ($(current_product_makefile),$(INTERNAL_PRODUCT))
 $(error PRODUCT_NAME inconsistent in $(current_product_makefile) and $(INTERNAL_PRODUCT))
 endif
-current_product_makefile :=
-all_product_makefiles :=
-all_product_configs :=
+
 
 ############################################################################
 # Strip and assign the PRODUCT_ variables.
 $(call strip-product-vars)
 
+current_product_makefile :=
+all_product_makefiles :=
+all_product_configs :=
+
 #############################################################################
 # Quick check and assign default values