OSDN Git Service

Include the LOCAL_REQUIRED_MODULES when packaging.
authorAlex Deymo <deymo@google.com>
Thu, 5 Jan 2017 16:54:46 +0000 (08:54 -0800)
committerAlex Deymo <deymo@google.com>
Thu, 5 Jan 2017 20:12:42 +0000 (12:12 -0800)
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
core/tasks/tools/package-modules.mk

index 68ac08b..000a7fe 100644 (file)
@@ -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 := \
index 24a7608..ef49d90 100644 (file)
@@ -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)\