LOCAL_HOST_REQUIRED_MODULES support

Allows target modules to directly request host modules they
require to be built and installed as well.

Bug: 72761631
Test: Added LOCAL_HOST_REQUIRED_MODULES to a target apk test and
      the host module was built.

Change-Id: I5aca11b3ba8b54676f068d337f1c9ba0e0b01997
This commit is contained in:
Simran Basi 2018-02-01 19:48:59 -08:00
parent a4c7d59afc
commit 893098b06c
3 changed files with 29 additions and 0 deletions

View File

@ -654,6 +654,9 @@ ALL_MODULES.$(my_register_name).EXPLICITLY_REQUIRED := \
ALL_MODULES.$(my_register_name).TARGET_REQUIRED := \ ALL_MODULES.$(my_register_name).TARGET_REQUIRED := \
$(strip $(ALL_MODULES.$(my_register_name).TARGET_REQUIRED)\ $(strip $(ALL_MODULES.$(my_register_name).TARGET_REQUIRED)\
$(LOCAL_TARGET_REQUIRED_MODULES)) $(LOCAL_TARGET_REQUIRED_MODULES))
ALL_MODULES.$(my_register_name).HOST_REQUIRED := \
$(strip $(ALL_MODULES.$(my_register_name).HOST_REQUIRED)\
$(LOCAL_HOST_REQUIRED_MODULES))
ALL_MODULES.$(my_register_name).EVENT_LOG_TAGS := \ ALL_MODULES.$(my_register_name).EVENT_LOG_TAGS := \
$(ALL_MODULES.$(my_register_name).EVENT_LOG_TAGS) $(event_log_tags) $(ALL_MODULES.$(my_register_name).EVENT_LOG_TAGS) $(event_log_tags)
ALL_MODULES.$(my_register_name).MAKEFILE := \ ALL_MODULES.$(my_register_name).MAKEFILE := \

View File

@ -98,6 +98,7 @@ LOCAL_GROUP_STATIC_LIBRARIES:=
LOCAL_GTEST:=true LOCAL_GTEST:=true
LOCAL_HAL_STATIC_LIBRARIES:= LOCAL_HAL_STATIC_LIBRARIES:=
LOCAL_HEADER_LIBRARIES:= LOCAL_HEADER_LIBRARIES:=
LOCAL_HOST_REQUIRED_MODULES:=
LOCAL_INIT_RC:= LOCAL_INIT_RC:=
LOCAL_INSTALLED_MODULE:= LOCAL_INSTALLED_MODULE:=
LOCAL_INSTALLED_MODULE_STEM:= LOCAL_INSTALLED_MODULE_STEM:=

View File

@ -610,6 +610,31 @@ $(foreach m,$(ALL_MODULES), \
endef endef
$(call add-all-host-to-target-required-modules-deps) $(call add-all-host-to-target-required-modules-deps)
# Sets up dependencies such that whenever a target module is installed,
# any host modules listed in $(ALL_MODULES.$(m).HOST_REQUIRED) will also be installed
define add-all-target-to-host-required-modules-deps
$(foreach m,$(ALL_MODULES), \
$(eval req_mods := $(ALL_MODULES.$(m).HOST_REQUIRED))\
$(if $(req_mods), \
$(eval req_files := )\
$(foreach req_mod,$(req_mods), \
$(eval req_file := $(filter $(HOST_OUT)/%, $(call module-installed-files,$(req_mod)))) \
$(if $(strip $(req_file)),\
,\
$(error $(m).LOCAL_HOST_REQUIRED_MODULES : illegal value $(req_mod) : not a host module. If you want to specify target modules to be required to be installed along with your target module, add those module names to LOCAL_REQUIRED_MODULES instead)\
)\
$(eval req_files := $(req_files)$(space)$(req_file))\
)\
$(eval req_files := $(strip $(req_files)))\
$(eval mod_files := $(filter $(TARGET_OUT_ROOT)/%, $(call module-installed-files,$(m))))\
$(eval mod_files := $(filter-out $(req_files),$(mod_files)))\
$(if $(mod_files),\
$(eval $(call add-required-deps, $(mod_files),$(req_files))) \
)\
)\
)
endef
$(call add-all-target-to-host-required-modules-deps)
t_m := t_m :=
h_m := h_m :=