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

Commit b37bb1d8 authored by Yo Chiang's avatar Yo Chiang Committed by Automerger Merge Worker
Browse files

Require required modules to exist am: 64faf889

Original change: https://android-review.googlesource.com/c/platform/build/+/1306572

Change-Id: I15f728dcd0a73269ec99146982f2763f2e169ac3
parents d4aef161 64faf889
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
# Build System Changes for Android.mk Writers

## `LOCAL_REQUIRED_MODULES` requires listed modules to exist {#BUILD_BROKEN_MISSING_REQUIRED_MODULES}

Modules listed in `LOCAL_REQUIRED_MODULES`, `LOCAL_HOST_REQUIRED_MODULES` and
`LOCAL_TARGET_REQUIRED_MODULES` need to exist unless `ALLOW_MISSING_DEPENDENCIES`
is set.

To temporarily relax missing required modules check, use:

`BUILD_BROKEN_MISSING_REQUIRED_MODULES := true`

## Changes in system properties settings

### Product variables
+2 −1
Original line number Diff line number Diff line
@@ -98,13 +98,14 @@ _board_strip_readonly_list += \

_build_broken_var_list := \
  BUILD_BROKEN_DUP_RULES \
  BUILD_BROKEN_DUP_SYSPROP \
  BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES \
  BUILD_BROKEN_MISSING_REQUIRED_MODULES \
  BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS \
  BUILD_BROKEN_PREBUILT_ELF_FILES \
  BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW \
  BUILD_BROKEN_USES_NETWORK \
  BUILD_BROKEN_VINTF_PRODUCT_COPY_FILES \
  BUILD_BROKEN_DUP_SYSPROP \

_build_broken_var_list += \
  $(foreach m,$(AVAILABLE_BUILD_MODULE_TYPES) \
+18 −3
Original line number Diff line number Diff line
@@ -623,7 +623,6 @@ $(strip \
)
endef

# TODO(b/7456955): error if a required module doesn't exist.
# Resolve the required module names to 32-bit or 64-bit variant for:
#   ALL_MODULES.<*>.REQUIRED_FROM_TARGET
#   ALL_MODULES.<*>.REQUIRED_FROM_HOST
@@ -656,7 +655,8 @@ $(foreach m,$(ALL_MODULES), \
            $(if $(and $(module_is_native),$(required_is_shared_library_or_native_test)), \
              $(if $(ALL_MODULES.$(m).FOR_2ND_ARCH),$(r_i_2nd),$(r_i)), \
              $(r_i) $(r_i_2nd)))) \
        $(eval ### TODO(b/7456955): error if r_m is empty / does not exist) \
        $(eval r_m := $(foreach r_j,$(r_m),$(if $(ALL_MODULES.$(r_j).PATH),$(r_j)))) \
        $(if $(r_m),,$(eval _nonexistent_required += $(1)$(comma)$(m)$(comma)$(1)$(comma)$(r_i))) \
        $(r_m))) \
    $(eval ALL_MODULES.$(m).REQUIRED_FROM_$(1) := $(sort $(r_r))) \
  ) \
@@ -679,18 +679,33 @@ $(foreach m,$(ALL_MODULES), \
    $(eval r_r := \
      $(foreach r_i,$(r), \
        $(eval r_m := $(call resolve-bitness-for-modules,$(1),$(r_i))) \
        $(eval ### TODO(b/7456955): error if r_m is empty / does not exist) \
        $(eval r_m := $(foreach r_j,$(r_m),$(if $(ALL_MODULES.$(r_j).PATH),$(r_j)))) \
        $(if $(r_m),,$(eval _nonexistent_required += $(2)$(comma)$(m)$(comma)$(1)$(comma)$(r_i))) \
        $(r_m))) \
    $(eval ALL_MODULES.$(m).$(1)_REQUIRED_FROM_$(2) := $(sort $(r_r))) \
  ) \
)
endef

_nonexistent_required :=
$(call select-bitness-of-required-modules,TARGET)
$(call select-bitness-of-required-modules,HOST)
$(call select-bitness-of-required-modules,HOST_CROSS)
$(call select-bitness-of-target-host-required-modules,TARGET,HOST)
$(call select-bitness-of-target-host-required-modules,HOST,TARGET)
_nonexistent_required := $(sort $(_nonexistent_required))

ifeq (,$(filter true,$(ALLOW_MISSING_DEPENDENCIES) $(BUILD_BROKEN_MISSING_REQUIRED_MODULES)))
ifneq (,$(_nonexistent_required))
  $(warning Missing required dependencies:)
  $(foreach r_i,$(_nonexistent_required), \
    $(eval r := $(subst $(comma),$(space),$(r_i))) \
    $(info $(word 1,$(r)) module $(word 2,$(r)) requires non-existent $(word 3,$(r)) module: $(word 4,$(r))) \
  )
  $(warning Set BUILD_BROKEN_MISSING_REQUIRED_MODULES := true to bypass this check if this is intentional)
  $(error Build failed)
endif # _nonexistent_required != empty
endif # ALLOW_MISSING_DEPENDENCIES != true && BUILD_BROKEN_MISSING_REQUIRED_MODULES != true

define add-required-deps
$(1): | $(2)