Merge "Extract the product to file mapping logic to a macro."

am: df832133ad

Change-Id: Ic92eb8d9c9631f5eaac57bb4f41c157954f85193
This commit is contained in:
Anton Hansson 2018-06-14 03:14:24 -07:00 committed by android-build-merger
commit 6147e61699
1 changed files with 35 additions and 36 deletions

View File

@ -893,47 +893,40 @@ $(foreach lt,$(ALL_LINK_TYPES),\
# $(2): The initial module name list.
# Returns empty string (maybe with some whitespaces).
define expand-required-modules
$(eval _erm_new_modules := $(sort $(filter-out $($(1)),\
$(foreach m,$(2),$(ALL_MODULES.$(m).REQUIRED)))))\
$(eval _erm_req := $(foreach m,$(2),$(ALL_MODULES.$(m).REQUIRED))) \
$(eval _erm_new_modules := $(sort $(filter-out $($(1)),$(_erm_req))))\
$(if $(_erm_new_modules),$(eval $(1) += $(_erm_new_modules))\
$(call expand-required-modules,$(1),$(_erm_new_modules)))
endef
# Determines the files a particular product installs.
# The base list of modules to build for this product is specified
# by the appropriate product definition file, which was included
# by product_config.mk.
# $(1): product makefile
define product-installed-files
$(eval _pif_modules := $(PRODUCTS.$(strip $(1)).PRODUCT_PACKAGES)) \
$(if $(BOARD_VNDK_VERSION),$(eval _pif_modules += vndk_package)) \
$(eval ### Filter out the overridden packages and executables before doing expansion) \
$(eval _pif_overrides := $(foreach p, $(_pif_modules), $(PACKAGES.$(p).OVERRIDES))) \
$(eval _pif_overrides += $(foreach m, $(_pif_modules), $(EXECUTABLES.$(m).OVERRIDES))) \
$(eval _pif_modules := $(filter-out $(_pif_overrides), $(_pif_modules))) \
$(eval ### Resolve the :32 :64 module name) \
$(eval _pif_modules_32 := $(patsubst %:32,%,$(filter %:32, $(_pif_modules)))) \
$(eval _pif_modules_64 := $(patsubst %:64,%,$(filter %:64, $(_pif_modules)))) \
$(eval _pif_modules_rest := $(filter-out %:32 %:64,$(_pif_modules))) \
$(eval ### Note for 32-bit product, 32 and 64 will be added as their original module names.) \
$(eval _pif_modules := $(call get-32-bit-modules-if-we-can, $(_pif_modules_32))) \
$(eval _pif_modules += $(_pif_modules_64)) \
$(eval ### For the rest we add both) \
$(eval _pif_modules += $(call get-32-bit-modules, $(_pif_modules_rest))) \
$(eval _pif_modules += $(_pif_modules_rest)) \
$(call expand-required-modules,_pif_modules,$(_pif_modules)) \
$(call module-installed-files, $(_pif_modules))
endef
ifdef FULL_BUILD
# The base list of modules to build for this product is specified
# by the appropriate product definition file, which was included
# by product_config.mk.
product_MODULES := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES)
ifdef BOARD_VNDK_VERSION
product_MODULES += vndk_package
endif
# Filter out the overridden packages before doing expansion
product_MODULES := $(filter-out $(foreach p, $(product_MODULES), \
$(PACKAGES.$(p).OVERRIDES)), $(product_MODULES))
# Filter out executables as well
product_MODULES := $(filter-out $(foreach m, $(product_MODULES), \
$(EXECUTABLES.$(m).OVERRIDES)), $(product_MODULES))
# Resolve the :32 :64 module name
modules_32 := $(patsubst %:32,%,$(filter %:32, $(product_MODULES)))
modules_64 := $(patsubst %:64,%,$(filter %:64, $(product_MODULES)))
modules_rest := $(filter-out %:32 %:64,$(product_MODULES))
# Note for 32-bit product, $(modules_32) and $(modules_64) will be
# added as their original module names.
product_MODULES := $(call get-32-bit-modules-if-we-can, $(modules_32))
product_MODULES += $(modules_64)
# For the rest we add both
product_MODULES += $(call get-32-bit-modules, $(modules_rest))
product_MODULES += $(modules_rest)
$(call expand-required-modules,product_MODULES,$(product_MODULES))
product_FILES := $(call module-installed-files, $(product_MODULES))
ifeq (0,1)
$(info product_FILES for $(TARGET_DEVICE) ($(INTERNAL_PRODUCT)):)
$(foreach p,$(product_FILES),$(info : $(p)))
$(error done)
endif
product_FILES := $(call product-installed-files, $(INTERNAL_PRODUCT))
else
# We're not doing a full build, and are probably only including
# a subset of the module makefiles. Don't try to build any modules
@ -942,6 +935,12 @@ else
product_FILES :=
endif
ifeq (0,1)
$(info product_FILES for $(TARGET_DEVICE) ($(INTERNAL_PRODUCT)):)
$(foreach p,$(product_FILES),$(info : $(p)))
$(error done)
endif
eng_MODULES := $(sort \
$(call get-tagged-modules,eng) \
$(call module-installed-files, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES_ENG)) \