forked from openkylin/platform_build
Require required modules to exist
Error if a required module doesn't exist unless
ALLOW_MISSING_DEPENDENCIES or BUILD_BROKEN_MISSING_REQUIRED_MODULES
is true.
Bug: 7456955
Test: TH build_test
Change-Id: I5cdc56c7433b7ce15da155993b7100af9af604fa
Merged-In: I5cdc56c7433b7ce15da155993b7100af9af604fa
(cherry picked from commit c6159372b7
)
This commit is contained in:
parent
79d10eddbf
commit
64faf88940
10
Changes.md
10
Changes.md
|
@ -1,5 +1,15 @@
|
||||||
# Build System Changes for Android.mk Writers
|
# 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
|
## Changes in system properties settings
|
||||||
|
|
||||||
### Product variables
|
### Product variables
|
||||||
|
|
|
@ -97,13 +97,14 @@ _board_strip_readonly_list += \
|
||||||
|
|
||||||
_build_broken_var_list := \
|
_build_broken_var_list := \
|
||||||
BUILD_BROKEN_DUP_RULES \
|
BUILD_BROKEN_DUP_RULES \
|
||||||
|
BUILD_BROKEN_DUP_SYSPROP \
|
||||||
BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES \
|
BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES \
|
||||||
|
BUILD_BROKEN_MISSING_REQUIRED_MODULES \
|
||||||
BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS \
|
BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS \
|
||||||
BUILD_BROKEN_PREBUILT_ELF_FILES \
|
BUILD_BROKEN_PREBUILT_ELF_FILES \
|
||||||
BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW \
|
BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW \
|
||||||
BUILD_BROKEN_USES_NETWORK \
|
BUILD_BROKEN_USES_NETWORK \
|
||||||
BUILD_BROKEN_VINTF_PRODUCT_COPY_FILES \
|
BUILD_BROKEN_VINTF_PRODUCT_COPY_FILES \
|
||||||
BUILD_BROKEN_DUP_SYSPROP \
|
|
||||||
|
|
||||||
_build_broken_var_list += \
|
_build_broken_var_list += \
|
||||||
$(foreach m,$(AVAILABLE_BUILD_MODULE_TYPES) \
|
$(foreach m,$(AVAILABLE_BUILD_MODULE_TYPES) \
|
||||||
|
|
21
core/main.mk
21
core/main.mk
|
@ -633,7 +633,6 @@ $(strip \
|
||||||
)
|
)
|
||||||
endef
|
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:
|
# Resolve the required module names to 32-bit or 64-bit variant for:
|
||||||
# ALL_MODULES.<*>.REQUIRED_FROM_TARGET
|
# ALL_MODULES.<*>.REQUIRED_FROM_TARGET
|
||||||
# ALL_MODULES.<*>.REQUIRED_FROM_HOST
|
# ALL_MODULES.<*>.REQUIRED_FROM_HOST
|
||||||
|
@ -666,7 +665,8 @@ $(foreach m,$(ALL_MODULES), \
|
||||||
$(if $(and $(module_is_native),$(required_is_shared_library_or_native_test)), \
|
$(if $(and $(module_is_native),$(required_is_shared_library_or_native_test)), \
|
||||||
$(if $(ALL_MODULES.$(m).FOR_2ND_ARCH),$(r_i_2nd),$(r_i)), \
|
$(if $(ALL_MODULES.$(m).FOR_2ND_ARCH),$(r_i_2nd),$(r_i)), \
|
||||||
$(r_i) $(r_i_2nd)))) \
|
$(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))) \
|
$(r_m))) \
|
||||||
$(eval ALL_MODULES.$(m).REQUIRED_FROM_$(1) := $(sort $(r_r))) \
|
$(eval ALL_MODULES.$(m).REQUIRED_FROM_$(1) := $(sort $(r_r))) \
|
||||||
) \
|
) \
|
||||||
|
@ -689,18 +689,33 @@ $(foreach m,$(ALL_MODULES), \
|
||||||
$(eval r_r := \
|
$(eval r_r := \
|
||||||
$(foreach r_i,$(r), \
|
$(foreach r_i,$(r), \
|
||||||
$(eval r_m := $(call resolve-bitness-for-modules,$(1),$(r_i))) \
|
$(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))) \
|
$(r_m))) \
|
||||||
$(eval ALL_MODULES.$(m).$(1)_REQUIRED_FROM_$(2) := $(sort $(r_r))) \
|
$(eval ALL_MODULES.$(m).$(1)_REQUIRED_FROM_$(2) := $(sort $(r_r))) \
|
||||||
) \
|
) \
|
||||||
)
|
)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
_nonexistent_required :=
|
||||||
$(call select-bitness-of-required-modules,TARGET)
|
$(call select-bitness-of-required-modules,TARGET)
|
||||||
$(call select-bitness-of-required-modules,HOST)
|
$(call select-bitness-of-required-modules,HOST)
|
||||||
$(call select-bitness-of-required-modules,HOST_CROSS)
|
$(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,TARGET,HOST)
|
||||||
$(call select-bitness-of-target-host-required-modules,HOST,TARGET)
|
$(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
|
define add-required-deps
|
||||||
$(1): | $(2)
|
$(1): | $(2)
|
||||||
|
|
Loading…
Reference in New Issue