Don't build automatic RROs for tests

Automatic RROs don't make sense for tests, the tests can't rely on
overlays being installed on product or vendor.  Creating the RROs
causes a race during builds that build both droid and device-tests
goals, as the RROs may be installed to the vendor directory as a
dependency of the device-tests goal before or after the vendor image
is packaged as a dependency of the droid goal.  If the RROs are
installed first and the vendor image is low on space it may result
in an out-of-space error.

Bug: 282885159
Test: Rule to build $OUT/vendor/overlay/SystemUITests__*__auto_generated_rro_vendor.apk no longer exists
Ignore-AOSP-First: high priority build fix
Change-Id: I760355ffb1818e91c02a98473312f9f21c149361
This commit is contained in:
Colin Cross
2023-05-17 10:56:44 -07:00
parent e4783d4b7a
commit 2e55115ab3
2 changed files with 39 additions and 35 deletions

View File

@@ -111,24 +111,26 @@ include $(BUILD_SYSTEM)/support_libraries.mk
# Determine whether auto-RRO is enabled for this package. # Determine whether auto-RRO is enabled for this package.
enforce_rro_enabled := enforce_rro_enabled :=
ifneq (,$(filter *, $(PRODUCT_ENFORCE_RRO_TARGETS))) ifeq (,$(filter tests,$(LOCAL_MODULE_TAGS)))
# * means all system and system_ext APKs, so enable conditionally based on module path. ifneq (,$(filter *, $(PRODUCT_ENFORCE_RRO_TARGETS)))
# * means all system and system_ext APKs, so enable conditionally based on module path.
# Note that base_rules.mk has not yet been included, so it's likely that only # Note that base_rules.mk has not yet been included, so it's likely that only
# one of LOCAL_MODULE_PATH and the LOCAL_X_MODULE flags has been set. # one of LOCAL_MODULE_PATH and the LOCAL_X_MODULE flags has been set.
ifeq (,$(LOCAL_MODULE_PATH)) ifeq (,$(LOCAL_MODULE_PATH))
non_rro_target_module := $(filter true,\ non_rro_target_module := $(filter true,\
$(LOCAL_ODM_MODULE) \ $(LOCAL_ODM_MODULE) \
$(LOCAL_OEM_MODULE) \ $(LOCAL_OEM_MODULE) \
$(LOCAL_PRODUCT_MODULE) \ $(LOCAL_PRODUCT_MODULE) \
$(LOCAL_PROPRIETARY_MODULE) \ $(LOCAL_PROPRIETARY_MODULE) \
$(LOCAL_VENDOR_MODULE)) $(LOCAL_VENDOR_MODULE))
enforce_rro_enabled := $(if $(non_rro_target_module),,true) enforce_rro_enabled := $(if $(non_rro_target_module),,true)
else ifneq ($(filter $(TARGET_OUT)/%,$(LOCAL_MODULE_PATH)),) else ifneq ($(filter $(TARGET_OUT)/%,$(LOCAL_MODULE_PATH)),)
enforce_rro_enabled := true
endif
else ifneq (,$(filter $(LOCAL_PACKAGE_NAME), $(PRODUCT_ENFORCE_RRO_TARGETS)))
enforce_rro_enabled := true enforce_rro_enabled := true
endif endif
else ifneq (,$(filter $(LOCAL_PACKAGE_NAME), $(PRODUCT_ENFORCE_RRO_TARGETS)))
enforce_rro_enabled := true
endif endif
product_package_overlays := $(strip \ product_package_overlays := $(strip \

View File

@@ -239,26 +239,28 @@ my_common := COMMON
include $(BUILD_SYSTEM)/link_type.mk include $(BUILD_SYSTEM)/link_type.mk
endif # !LOCAL_IS_HOST_MODULE endif # !LOCAL_IS_HOST_MODULE
ifdef LOCAL_SOONG_DEVICE_RRO_DIRS ifeq (,$(filter tests,$(LOCAL_MODULE_TAGS)))
$(call append_enforce_rro_sources, \ ifdef LOCAL_SOONG_DEVICE_RRO_DIRS
$(my_register_name), \ $(call append_enforce_rro_sources, \
false, \ $(my_register_name), \
$(LOCAL_FULL_MANIFEST_FILE), \ false, \
$(if $(LOCAL_EXPORT_PACKAGE_RESOURCES),true,false), \ $(LOCAL_FULL_MANIFEST_FILE), \
$(LOCAL_SOONG_DEVICE_RRO_DIRS), \ $(if $(LOCAL_EXPORT_PACKAGE_RESOURCES),true,false), \
vendor \ $(LOCAL_SOONG_DEVICE_RRO_DIRS), \
) vendor \
endif )
endif
ifdef LOCAL_SOONG_PRODUCT_RRO_DIRS ifdef LOCAL_SOONG_PRODUCT_RRO_DIRS
$(call append_enforce_rro_sources, \ $(call append_enforce_rro_sources, \
$(my_register_name), \ $(my_register_name), \
false, \ false, \
$(LOCAL_FULL_MANIFEST_FILE), \ $(LOCAL_FULL_MANIFEST_FILE), \
$(if $(LOCAL_EXPORT_PACKAGE_RESOURCES),true,false), \ $(if $(LOCAL_EXPORT_PACKAGE_RESOURCES),true,false), \
$(LOCAL_SOONG_PRODUCT_RRO_DIRS), \ $(LOCAL_SOONG_PRODUCT_RRO_DIRS), \
product \ product \
) )
endif
endif endif
ifdef LOCAL_PREBUILT_COVERAGE_ARCHIVE ifdef LOCAL_PREBUILT_COVERAGE_ARCHIVE