Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 893098b0 authored by Simran Basi's avatar Simran Basi
Browse files

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
parent a4c7d59a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -654,6 +654,9 @@ ALL_MODULES.$(my_register_name).EXPLICITLY_REQUIRED := \
ALL_MODULES.$(my_register_name).TARGET_REQUIRED := \
    $(strip $(ALL_MODULES.$(my_register_name).TARGET_REQUIRED)\
        $(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) $(event_log_tags)
ALL_MODULES.$(my_register_name).MAKEFILE := \
+1 −0
Original line number Diff line number Diff line
@@ -98,6 +98,7 @@ LOCAL_GROUP_STATIC_LIBRARIES:=
LOCAL_GTEST:=true
LOCAL_HAL_STATIC_LIBRARIES:=
LOCAL_HEADER_LIBRARIES:=
LOCAL_HOST_REQUIRED_MODULES:=
LOCAL_INIT_RC:=
LOCAL_INSTALLED_MODULE:=
LOCAL_INSTALLED_MODULE_STEM:=
+25 −0
Original line number Diff line number Diff line
@@ -610,6 +610,31 @@ $(foreach m,$(ALL_MODULES), \
endef
$(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 :=
h_m :=