From 67132baa4d11917030c5156f507a50110c4cd935 Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Wed, 28 Oct 2015 16:42:39 -0700 Subject: [PATCH] Fix "make product-graph" and "make dump-products". - For unmodified "make product-graph" and "make dump-products", load only the current product configuration makefiles. This is much faster than loading all product makefiles. - For "make product-graph ANDROID_PRODUCT_GRAPH=--all", "make dump-products ANDROID_DUMP_PRODUCTS=all", load all product makefiles. - Move product-graph.mk out of build tasks, so we can skip loading all the Android.mks, which takes long and we don't really need them. More importantly, with all product makefiles loaded, modules in Android.mks are prone to clash (if they are conditionally included by variables set up in product makefiles) and lead to parse-time error. Change-Id: Idc1d6b0c23eb2c8bb34fdd7a1fa4d56171768d21 --- core/Makefile | 2 ++ core/main.mk | 3 ++- core/{tasks => }/product-graph.mk | 2 +- core/product_config.mk | 14 +++++++++++++- 4 files changed, 18 insertions(+), 3 deletions(-) rename core/{tasks => }/product-graph.mk (99%) diff --git a/core/Makefile b/core/Makefile index db568d069d..27d9387556 100644 --- a/core/Makefile +++ b/core/Makefile @@ -1964,6 +1964,8 @@ include $(sort $(wildcard $(BUILD_SYSTEM)/tasks/*.mk)) -include $(sort $(wildcard device/*/*/build/tasks/*.mk)) endif +include $(BUILD_SYSTEM)/product-graph.mk + # ----------------------------------------------------------------- # Create SDK repository packages. Must be done after tasks/* since # we need the addon rules defined. diff --git a/core/main.mk b/core/main.mk index 15b3c27149..7901bd82f9 100644 --- a/core/main.mk +++ b/core/main.mk @@ -80,7 +80,8 @@ dont_bother_goals := clean clobber dataclean installclean \ vendorimage-nodeps \ ramdisk-nodeps \ bootimage-nodeps \ - recoveryimage-nodeps + recoveryimage-nodeps \ + product-graph dump-products ifneq ($(filter $(dont_bother_goals), $(MAKECMDGOALS)),) dont_bother := true diff --git a/core/tasks/product-graph.mk b/core/product-graph.mk similarity index 99% rename from core/tasks/product-graph.mk rename to core/product-graph.mk index db2cf71378..36e903723a 100644 --- a/core/tasks/product-graph.mk +++ b/core/product-graph.mk @@ -34,7 +34,7 @@ define all-products-inner endef -this_makefile := build/core/tasks/product-graph.mk +this_makefile := build/core/product-graph.mk products_svg := $(OUT_DIR)/products.svg products_pdf := $(OUT_DIR)/products.pdf diff --git a/core/product_config.mk b/core/product_config.mk index 5240ae7bd2..ad3b518629 100644 --- a/core/product_config.mk +++ b/core/product_config.mk @@ -213,7 +213,19 @@ _cpm_word2 := current_product_makefile := $(strip $(current_product_makefile)) all_product_makefiles := $(strip $(all_product_makefiles)) -ifneq (,$(filter product-graph dump-products, $(MAKECMDGOALS))) +load_all_product_makefiles := +ifneq (,$(filter product-graph, $(MAKECMDGOALS))) +ifeq ($(ANDROID_PRODUCT_GRAPH),--all) +load_all_product_makefiles := true +endif +endif +ifneq (,$(filter dump-products,$(MAKECMDGOALS))) +ifeq ($(ANDROID_DUMP_PRODUCTS),all) +load_all_product_makefiles := true +endif +endif + +ifeq ($(load_all_product_makefiles),true) # Import all product makefiles. $(call import-products, $(all_product_makefiles)) else