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

Commit 3a79e5b4 authored by Colin Cross's avatar Colin Cross Committed by Gerrit Code Review
Browse files

Merge "Support generating install rules in Soong"

parents 75342c19 23ee375a
Loading
Loading
Loading
Loading
+96 −62
Original line number Original line Diff line number Diff line
@@ -373,7 +373,13 @@ include $(BUILD_SYSTEM)/configure_module_stem.mk


LOCAL_BUILT_MODULE := $(intermediates)/$(my_built_module_stem)
LOCAL_BUILT_MODULE := $(intermediates)/$(my_built_module_stem)


ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
ifneq (,$(LOCAL_SOONG_INSTALLED_MODULE))
  ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
    $(call pretty-error, LOCAL_SOONG_INSTALLED_MODULE can only be used from $(SOONG_ANDROID_MK))
  endif
  # Use the install path requested by Soong.
  LOCAL_INSTALLED_MODULE := $(LOCAL_SOONG_INSTALLED_MODULE)
else ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
  # Apk and its attachments reside in its own subdir.
  # Apk and its attachments reside in its own subdir.
  ifeq ($(LOCAL_MODULE_CLASS),APPS)
  ifeq ($(LOCAL_MODULE_CLASS),APPS)
    # framework-res.apk doesn't like the additional layer.
    # framework-res.apk doesn't like the additional layer.
@@ -507,9 +513,6 @@ my_path_comp :=
## Module installation rule
## Module installation rule
###########################################################
###########################################################


my_init_rc_installed :=
my_init_rc_path :=
my_init_rc_pairs :=
my_installed_symlinks :=
my_installed_symlinks :=
my_default_test_module :=
my_default_test_module :=
ifeq ($(use_testcase_folder),true)
ifeq ($(use_testcase_folder),true)
@@ -518,7 +521,12 @@ my_default_test_module := $($(my_prefix)OUT_TESTCASES)/$(LOCAL_MODULE)/$(arch_di
arch_dir :=
arch_dir :=
endif
endif


ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
ifneq (,$(LOCAL_SOONG_INSTALLED_MODULE))
  # Soong already generated the copy rule, but make the installed location depend on the Make
  # copy of the intermediates for now, as some rules that collect intermediates may expect
  # them to exist.
  $(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE)
else ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
  ifneq ($(LOCAL_INSTALLED_MODULE),$(my_default_test_module))
  ifneq ($(LOCAL_INSTALLED_MODULE),$(my_default_test_module))
    $(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
    $(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
    $(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE)
    $(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE)
@@ -531,31 +539,6 @@ endif
	$(PRIVATE_POST_INSTALL_CMD)
	$(PRIVATE_POST_INSTALL_CMD)
  endif
  endif


ifndef LOCAL_IS_HOST_MODULE
# Rule to install the module's companion init.rc.
ifneq ($(strip $(LOCAL_FULL_INIT_RC)),)
my_init_rc := $(LOCAL_FULL_INIT_RC)
else
my_init_rc := $(foreach rc,$(LOCAL_INIT_RC_$(my_32_64_bit_suffix)) $(LOCAL_INIT_RC),$(LOCAL_PATH)/$(rc))
endif
ifneq ($(strip $(my_init_rc)),)
# Make doesn't support recovery as an output partition, but some Soong modules installed in recovery
# have init.rc files that need to be installed alongside them. Manually handle the case where the
# output file is in the recovery partition.
my_init_rc_path := $(if $(filter $(TARGET_RECOVERY_ROOT_OUT)/%,$(my_module_path)),$(TARGET_RECOVERY_ROOT_OUT)/system/etc,$(TARGET_OUT$(partition_tag)_ETC))
my_init_rc_pairs := $(foreach rc,$(my_init_rc),$(rc):$(my_init_rc_path)/init/$(notdir $(rc)))
my_init_rc_installed := $(foreach rc,$(my_init_rc_pairs),$(call word-colon,2,$(rc)))

# Make sure we only set up the copy rules once, even if another arch variant
# shares a common LOCAL_INIT_RC.
my_init_rc_new_pairs := $(filter-out $(ALL_INIT_RC_INSTALLED_PAIRS),$(my_init_rc_pairs))
my_init_rc_new_installed := $(call copy-many-init-script-files-checked,$(my_init_rc_new_pairs))
ALL_INIT_RC_INSTALLED_PAIRS += $(my_init_rc_new_pairs)

$(my_all_targets) : $(my_init_rc_installed)
endif # my_init_rc
endif # !LOCAL_IS_HOST_MODULE

  # Rule to install the module's companion symlinks
  # Rule to install the module's companion symlinks
  my_installed_symlinks := $(addprefix $(my_module_path)/,$(LOCAL_MODULE_SYMLINKS) $(LOCAL_MODULE_SYMLINKS_$(my_32_64_bit_suffix)))
  my_installed_symlinks := $(addprefix $(my_module_path)/,$(LOCAL_MODULE_SYMLINKS) $(LOCAL_MODULE_SYMLINKS_$(my_32_64_bit_suffix)))
  $(foreach symlink,$(my_installed_symlinks),\
  $(foreach symlink,$(my_installed_symlinks),\
@@ -566,13 +549,17 @@ $(my_all_targets) : | $(my_installed_symlinks)
endif # !LOCAL_UNINSTALLABLE_MODULE
endif # !LOCAL_UNINSTALLABLE_MODULE


###########################################################
###########################################################
## VINTF manifest fragment goals
## VINTF manifest fragment and init.rc goals
###########################################################
###########################################################


my_vintf_installed:=
my_vintf_installed:=
my_vintf_pairs:=
my_vintf_pairs:=
my_init_rc_installed :=
my_init_rc_path :=
my_init_rc_pairs :=
ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
  ifndef LOCAL_IS_HOST_MODULE
  ifndef LOCAL_IS_HOST_MODULE
    # Rule to install the module's companion vintf fragments.
    ifneq ($(strip $(LOCAL_FULL_VINTF_FRAGMENTS)),)
    ifneq ($(strip $(LOCAL_FULL_VINTF_FRAGMENTS)),)
      my_vintf_fragments := $(LOCAL_FULL_VINTF_FRAGMENTS)
      my_vintf_fragments := $(LOCAL_FULL_VINTF_FRAGMENTS)
    else
    else
@@ -590,7 +577,32 @@ my_vintf_new_installed := $(call copy-many-vintf-manifest-files-checked,$(my_vin
      ALL_VINTF_MANIFEST_FRAGMENTS_LIST += $(my_vintf_new_pairs)
      ALL_VINTF_MANIFEST_FRAGMENTS_LIST += $(my_vintf_new_pairs)


      $(my_all_targets) : $(my_vintf_new_installed)
      $(my_all_targets) : $(my_vintf_new_installed)
endif # LOCAL_VINTF_FRAGMENTS
    endif # my_vintf_fragments

    # Rule to install the module's companion init.rc.
    ifneq ($(strip $(LOCAL_FULL_INIT_RC)),)
      my_init_rc := $(LOCAL_FULL_INIT_RC)
    else
      my_init_rc := $(foreach rc,$(LOCAL_INIT_RC_$(my_32_64_bit_suffix)) $(LOCAL_INIT_RC),$(LOCAL_PATH)/$(rc))
    endif
    ifneq ($(strip $(my_init_rc)),)
      # Make doesn't support recovery as an output partition, but some Soong modules installed in recovery
      # have init.rc files that need to be installed alongside them. Manually handle the case where the
      # output file is in the recovery partition.
      my_init_rc_path := $(if $(filter $(TARGET_RECOVERY_ROOT_OUT)/%,$(my_module_path)),$(TARGET_RECOVERY_ROOT_OUT)/system/etc,$(TARGET_OUT$(partition_tag)_ETC))
      my_init_rc_pairs := $(foreach rc,$(my_init_rc),$(rc):$(my_init_rc_path)/init/$(notdir $(rc)))
      my_init_rc_installed := $(foreach rc,$(my_init_rc_pairs),$(call word-colon,2,$(rc)))

      # Make sure we only set up the copy rules once, even if another arch variant
      # shares a common LOCAL_INIT_RC.
      my_init_rc_new_pairs := $(filter-out $(ALL_INIT_RC_INSTALLED_PAIRS),$(my_init_rc_pairs))
      my_init_rc_new_installed := $(call copy-many-init-script-files-checked,$(my_init_rc_new_pairs))

      ALL_INIT_RC_INSTALLED_PAIRS += $(my_init_rc_new_pairs)

      $(my_all_targets) : $(my_init_rc_installed)
    endif # my_init_rc

  endif # !LOCAL_IS_HOST_MODULE
  endif # !LOCAL_IS_HOST_MODULE
endif # !LOCAL_UNINSTALLABLE_MODULE
endif # !LOCAL_UNINSTALLABLE_MODULE


@@ -902,7 +914,29 @@ ifndef LOCAL_IS_HOST_MODULE
ALL_MODULES.$(my_register_name).TARGET_BUILT := \
ALL_MODULES.$(my_register_name).TARGET_BUILT := \
    $(ALL_MODULES.$(my_register_name).TARGET_BUILT) $(LOCAL_BUILT_MODULE)
    $(ALL_MODULES.$(my_register_name).TARGET_BUILT) $(LOCAL_BUILT_MODULE)
endif
endif
ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
ifneq (,$(LOCAL_SOONG_INSTALLED_MODULE))
  # Store the list of paths to installed locations of files provided by this
  # module.  Used as dependencies of the image packaging rules when the module
  # is installed by the current product.
  ALL_MODULES.$(my_register_name).INSTALLED := \
    $(strip $(ALL_MODULES.$(my_register_name).INSTALLED) \
      $(foreach f, $(LOCAL_SOONG_INSTALL_PAIRS),\
        $(word 2,$(subst :,$(space),$(f)))) \
      $(LOCAL_SOONG_INSTALL_SYMLINKS) \
      $(my_init_rc_installed) \
      $(my_installed_test_data) \
      $(my_vintf_installed))
  # Store the list of colon-separated pairs of the built and installed locations
  # of files provided by this module.  Used by custom packaging rules like
  # package-modules.mk that need to copy the built files to a custom install
  # location during packaging.
  ALL_MODULES.$(my_register_name).BUILT_INSTALLED := \
    $(strip $(ALL_MODULES.$(my_register_name).BUILT_INSTALLED) \
      $(LOCAL_SOONG_INSTALL_PAIRS) \
      $(my_init_rc_pairs) \
      $(my_test_data_pairs) \
      $(my_vintf_pairs))
else ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
  ALL_MODULES.$(my_register_name).INSTALLED := \
  ALL_MODULES.$(my_register_name).INSTALLED := \
    $(strip $(ALL_MODULES.$(my_register_name).INSTALLED) \
    $(strip $(ALL_MODULES.$(my_register_name).INSTALLED) \
    $(LOCAL_INSTALLED_MODULE) $(my_init_rc_installed) $(my_installed_symlinks) \
    $(LOCAL_INSTALLED_MODULE) $(my_init_rc_installed) $(my_installed_symlinks) \
+3 −0
Original line number Original line Diff line number Diff line
@@ -283,6 +283,9 @@ LOCAL_SOONG_DEX_JAR :=
LOCAL_SOONG_DEXPREOPT_CONFIG :=
LOCAL_SOONG_DEXPREOPT_CONFIG :=
LOCAL_SOONG_EXPORT_PROGUARD_FLAGS :=
LOCAL_SOONG_EXPORT_PROGUARD_FLAGS :=
LOCAL_SOONG_HEADER_JAR :=
LOCAL_SOONG_HEADER_JAR :=
LOCAL_SOONG_INSTALL_PAIRS :=
LOCAL_SOONG_INSTALL_SYMLINKS :=
LOCAL_SOONG_INSTALLED_MODULE :=
LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR :=
LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR :=
LOCAL_SOONG_LINK_TYPE :=
LOCAL_SOONG_LINK_TYPE :=
LOCAL_SOONG_LINT_REPORTS :=
LOCAL_SOONG_LINT_REPORTS :=
+1 −1
Original line number Original line Diff line number Diff line
@@ -534,7 +534,7 @@ FULL_BUILD := true
# Include all of the makefiles in the system
# Include all of the makefiles in the system
#
#


subdir_makefiles := $(SOONG_ANDROID_MK)
subdir_makefiles := $(SOONG_OUT_DIR)/installs-$(TARGET_PRODUCT).mk $(SOONG_ANDROID_MK)
# Android.mk files are only used on Linux builds, Mac only supports Android.bp
# Android.mk files are only used on Linux builds, Mac only supports Android.bp
ifeq ($(HOST_OS),linux)
ifeq ($(HOST_OS),linux)
  subdir_makefiles += $(file <$(OUT_DIR)/.module_paths/Android.mk.list)
  subdir_makefiles += $(file <$(OUT_DIR)/.module_paths/Android.mk.list)