Add special cases for builds that cannot switch to ART prebuilts.

Test: env TARGET_PRODUCT=mainline_modules_x86_64 \
        build/soong/soong_ui.bash \
        --dumpvar-mode SOONG_CONFIG_art_module_source_build
  returns true with http://ag/15234812
Test: env TARGET_PRODUCT=module_arm build/soong/soong_ui.bash \
        --dumpvar-mode SOONG_CONFIG_art_module_source_build
  returns true with http://ag/15234812
Test: env TARGET_PRODUCT=cf_arm64_phone build/soong/soong_ui.bash \
        --dumpvar-mode SOONG_CONFIG_art_module_source_build
  returns true with http://ag/15234812
Test: env TARGET_PRODUCT=sdk_g3titan_x86_64 build/soong/soong_ui.bash \
        --dumpvar-mode SOONG_CONFIG_art_module_source_build
  returns true with http://ag/15234812
Test: env TARGET_PRODUCT=cf_x86_64_phone build/soong/soong_ui.bash \
        --dumpvar-mode SOONG_CONFIG_art_module_source_build
  returns false with http://ag/15234812
Test: env TARGET_PRODUCT=cf_x86_phone build/soong/soong_ui.bash \
        --dumpvar-mode SOONG_CONFIG_art_module_source_build
  returns false with http://ag/15234812
Test: env TARGET_PRODUCT=bonito build/soong/soong_ui.bash \
        --dumpvar-mode SOONG_CONFIG_art_module_source_build
  returns false with http://ag/15234812
Test: env TARGET_PRODUCT=aosp_flame build/soong/soong_ui.bash \
        --dumpvar-mode SOONG_CONFIG_art_module_source_build
  returns true with http://ag/15234812
Bug: 192542393
Change-Id: I544a0cfc9dfe6d738f75e60b7fec6d57f2b51d22
This commit is contained in:
Martin Stjernholm 2021-07-07 14:44:48 +01:00
parent ddfa249778
commit fa089f76e6

View file

@ -37,6 +37,10 @@ endif
ifneq (,$(findstring .android.art,$(TARGET_BUILD_APPS)))
# Build ART modules from source if they are listed in TARGET_BUILD_APPS.
SOONG_CONFIG_art_module_source_build := true
else ifeq (,$(filter-out modules_% mainline_modules_%,$(TARGET_PRODUCT)))
# Always build from source for the module targets. This ought to be covered by
# the TARGET_BUILD_APPS check above, but there are test builds that don't set it.
SOONG_CONFIG_art_module_source_build := true
else ifneq (,$(filter true,$(NATIVE_COVERAGE) $(CLANG_COVERAGE)))
# Always build ART APEXes from source in coverage builds since the prebuilts
# aren't built with instrumentation.
@ -49,6 +53,13 @@ else ifneq (,$(PRODUCT_FUCHSIA))
# Fuchsia picks out ART internal packages that aren't available in the
# prebuilt.
SOONG_CONFIG_art_module_source_build := true
else ifeq (,$(filter x86 x86_64,$(HOST_CROSS_ARCH)))
# We currently only provide prebuilts for x86 on host. This skips prebuilts in
# cuttlefish builds for ARM servers.
SOONG_CONFIG_art_module_source_build := true
else ifneq (,$(filter dex2oatds dex2oats,$(PRODUCT_HOST_PACKAGES)))
# Some products depend on host tools that aren't available as prebuilts.
SOONG_CONFIG_art_module_source_build := true
else ifeq (,$(filter com.google.android.art,$(PRODUCT_PACKAGES)))
# TODO(b/192006406): There is currently no good way to control which prebuilt
# APEX (com.google.android.art or com.android.art) gets picked for deapexing