Merge changes Ib89ef776,I5cdc56c7

* changes:
  Disable required modules check on darwin
  Require required modules to exist
This commit is contained in:
Yo Chiang 2020-08-12 03:56:10 +00:00 committed by Gerrit Code Review
commit 2dcabab1c9
3 changed files with 34 additions and 4 deletions

View file

@ -1,5 +1,15 @@
# 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

View file

@ -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) \

View file

@ -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,37 @@ $(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))
# HOST OS darwin build is broken, disable this check for darwin for now.
# TODO(b/162102724): Remove this
ifeq (,$(filter $(HOST_OS),darwin))
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
endif # HOST_OS != darwin
define add-required-deps
$(1): | $(2)