From 92345a1cdb9cb559c4efd669826332a33446f1e9 Mon Sep 17 00:00:00 2001 From: Dario Freni Date: Tue, 29 Mar 2022 15:21:41 +0000 Subject: [PATCH] Prevent enabling prebuilts by default for builds that don't support them Except for santizer and framework Java coverage tests as they require specialized prebuilts built from a matching configuration and we do not provide them. And products that use dex2oat(d)s as they are not available as a prebuilt. And products that cross compile to arm64 and linux_bionic on the host as prebuilts for that are not available. And atv/tv products as they break when building against prebuilts. (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:c7b5e2c0cea30dd084536bdc68dffdfb1c50073d) This uses a completely separate Change-Id as the previous change was applied to lots of downstream branches (so they contain the Change-Id as far as the automerger is concernd) but the change got discarded due to some merge issues. Using the previous Change-Id would cause confusion. The title of this change was also updated as the previous title only made sense within the larger topic to which it belonged. Bug: 230478310 Bug: 223592962 Test: presubmit Change-Id: Ie35ff34f4626070d1a3fe0bb3a6a999a596d0078 --- core/android_soong_config_vars.mk | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/core/android_soong_config_vars.mk b/core/android_soong_config_vars.mk index 6f0706eb64..718adb53a4 100644 --- a/core/android_soong_config_vars.mk +++ b/core/android_soong_config_vars.mk @@ -41,6 +41,37 @@ $(call add_soong_config_var,ANDROID,PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT) # MODULE_BUILD_FROM_SOURCE. BRANCH_DEFAULT_MODULE_BUILD_FROM_SOURCE := true +ifneq ($(SANITIZE_TARGET)$(EMMA_INSTRUMENT_FRAMEWORK),) + # Always use sources when building the framework with Java coverage or + # sanitized builds as they both require purpose built prebuilts which we do + # not provide. + BRANCH_DEFAULT_MODULE_BUILD_FROM_SOURCE := true +endif + +# ART does not provide linux_bionic variants needed for products that +# set HOST_CROSS_OS=linux_bionic. +ifeq (linux_bionic,${HOST_CROSS_OS}) + BRANCH_DEFAULT_MODULE_BUILD_FROM_SOURCE := true +endif + +# ART does not provide host side arm64 variants needed for products that +# set HOST_CROSS_ARCH=arm64. +ifeq (arm64,${HOST_CROSS_ARCH}) + BRANCH_DEFAULT_MODULE_BUILD_FROM_SOURCE := true +endif + +# TV based devices do not seem to work with prebuilts, so build from source +# for now and fix in a follow up. +ifneq (,$(filter tv,$(subst $(comma),$(space),${PRODUCT_CHARACTERISTICS}))) + BRANCH_DEFAULT_MODULE_BUILD_FROM_SOURCE := true +endif + +# ATV based devices do not seem to work with prebuilts, so build from source +# for now and fix in a follow up. +ifneq (,${PRODUCT_IS_ATV}) + BRANCH_DEFAULT_MODULE_BUILD_FROM_SOURCE := true +endif + ifneq (,$(MODULE_BUILD_FROM_SOURCE)) # Keep an explicit setting. else ifeq (,$(filter docs sdk win_sdk sdk_addon,$(MAKECMDGOALS))$(findstring com.google.android.conscrypt,$(PRODUCT_PACKAGES)))