From 00dc66760e90266132e52f7d5dc6408e8e54ba77 Mon Sep 17 00:00:00 2001 From: Alex Deymo Date: Thu, 5 Jan 2017 08:54:46 -0800 Subject: [PATCH] Include the LOCAL_REQUIRED_MODULES when packaging. When building test modules, dependencies added by the test modules get build but don't get included in the packaged tests .zip file. When packaging modules into a .zip file, this patch includes the modules explicitly listed as a dependency in LOCAL_REQUIRED_MODULES for the requested modules to package. If these LOCAL_REQUIRED_MODULES dependencies are not used in the base system image, they were build as part of the "tests" target but weree not included in the package nor in the system image. This patch includes those modules, making it easier to define dependencies of a test module in the Android.mk file that defined said module, instead of requiring to re-list all the dependent modules when packaging test modules. Bug: 27348226 Change-Id: Ic6f60cf2916b3fae0fa39f84aee8a4f440af9539 --- core/base_rules.mk | 3 +++ core/tasks/tools/package-modules.mk | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/core/base_rules.mk b/core/base_rules.mk index 68ac08be4d..000a7fec96 100644 --- a/core/base_rules.mk +++ b/core/base_rules.mk @@ -528,6 +528,9 @@ my_required_modules += $(LOCAL_REQUIRED_MODULES_$($(my_prefix)OS)) endif ALL_MODULES.$(my_register_name).REQUIRED := \ $(strip $(ALL_MODULES.$(my_register_name).REQUIRED) $(my_required_modules)) +ALL_MODULES.$(my_register_name).EXPLICITLY_REQUIRED := \ + $(strip $(ALL_MODULES.$(my_register_name).EXPLICITLY_REQUIRED)\ + $(my_required_modules)) ALL_MODULES.$(my_register_name).EVENT_LOG_TAGS := \ $(ALL_MODULES.$(my_register_name).EVENT_LOG_TAGS) $(event_log_tags) ALL_MODULES.$(my_register_name).MAKEFILE := \ diff --git a/core/tasks/tools/package-modules.mk b/core/tasks/tools/package-modules.mk index 24a7608b2d..ef49d90805 100644 --- a/core/tasks/tools/package-modules.mk +++ b/core/tasks/tools/package-modules.mk @@ -14,10 +14,20 @@ my_built_modules := my_copy_pairs := my_pickup_files := +# Iterate over the modules and include their direct dependencies stated in the +# LOCAL_REQUIRED_MODULES. +my_modules_and_deps := $(my_modules) +$(foreach m,$(my_modules),\ + $(eval _explicitly_required := \ + $(strip $(ALL_MODULES.$(m).EXPLICITLY_REQUIRED)\ + $(ALL_MODULES.$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX).EXPLICITLY_REQUIRED)))\ + $(eval my_modules_and_deps += $(_explicitly_required))\ +) + # Iterate over modules' built files and installed files; # Calculate the dest files in the output zip file. -$(foreach m,$(my_modules),\ +$(foreach m,$(my_modules_and_deps),\ $(eval _pickup_files := $(strip $(ALL_MODULES.$(m).PICKUP_FILES)\ $(ALL_MODULES.$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX).PICKUP_FILES)))\ $(eval _built_files := $(strip $(ALL_MODULES.$(m).BUILT_INSTALLED)\