Merge "Add ART_MODULE_BUILD_FROM_SOURCE to control the equivalent soong config variable"

This commit is contained in:
Cole Faust 2022-03-04 22:02:24 +00:00 committed by Gerrit Code Review
commit 1421f7c7c3

View file

@ -49,52 +49,56 @@ else ifeq (,$(findstring com.google.android.conscrypt,$(PRODUCT_PACKAGES)))
MODULE_BUILD_FROM_SOURCE := true MODULE_BUILD_FROM_SOURCE := true
endif endif
# TODO(b/172480615): Remove when platform uses ART Module prebuilts by default. # TODO(b/220940864): Remove when build scripts have been changed to use
ifeq (,$(filter art_module,$(SOONG_CONFIG_NAMESPACES))) # ART_MODULE_BUILD_FROM_SOURCE instead of SOONG_CONFIG_art_module_source_build
$(call add_soong_config_namespace,art_module)
SOONG_CONFIG_art_module += source_build
endif
ifneq (,$(SOONG_CONFIG_art_module_source_build)) ifneq (,$(SOONG_CONFIG_art_module_source_build))
ART_MODULE_BUILD_FROM_SOURCE := $(SOONG_CONFIG_art_module_source_build)
endif
# TODO(b/172480615): Remove when platform uses ART Module prebuilts by default.
ifneq (,$(ART_MODULE_BUILD_FROM_SOURCE))
# Keep an explicit setting. # Keep an explicit setting.
else ifneq (,$(findstring .android.art,$(TARGET_BUILD_APPS))) else ifneq (,$(findstring .android.art,$(TARGET_BUILD_APPS)))
# Build ART modules from source if they are listed in TARGET_BUILD_APPS. # Build ART modules from source if they are listed in TARGET_BUILD_APPS.
SOONG_CONFIG_art_module_source_build := true ART_MODULE_BUILD_FROM_SOURCE := true
else ifeq (,$(filter-out modules_% mainline_modules_%,$(TARGET_PRODUCT))) else ifeq (,$(filter-out modules_% mainline_modules_%,$(TARGET_PRODUCT)))
# Always build from source for the module targets. This ought to be covered by # 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. # the TARGET_BUILD_APPS check above, but there are test builds that don't set it.
SOONG_CONFIG_art_module_source_build := true ART_MODULE_BUILD_FROM_SOURCE := true
else ifeq (true,$(MODULE_BUILD_FROM_SOURCE)) else ifeq (true,$(MODULE_BUILD_FROM_SOURCE))
# Build from source if other Mainline modules are. # Build from source if other Mainline modules are.
SOONG_CONFIG_art_module_source_build := true ART_MODULE_BUILD_FROM_SOURCE := true
else ifneq (,$(filter true,$(NATIVE_COVERAGE) $(CLANG_COVERAGE))) else ifneq (,$(filter true,$(NATIVE_COVERAGE) $(CLANG_COVERAGE)))
# Always build ART APEXes from source in coverage builds since the prebuilts # Always build ART APEXes from source in coverage builds since the prebuilts
# aren't built with instrumentation. # aren't built with instrumentation.
# TODO(b/172480617): Find another solution for this. # TODO(b/172480617): Find another solution for this.
SOONG_CONFIG_art_module_source_build := true ART_MODULE_BUILD_FROM_SOURCE := true
else ifneq (,$(SANITIZE_TARGET)$(SANITIZE_HOST)) else ifneq (,$(SANITIZE_TARGET)$(SANITIZE_HOST))
# Prebuilts aren't built with sanitizers either. # Prebuilts aren't built with sanitizers either.
SOONG_CONFIG_art_module_source_build := true ART_MODULE_BUILD_FROM_SOURCE := true
MODULE_BUILD_FROM_SOURCE := true MODULE_BUILD_FROM_SOURCE := true
else ifeq (,$(filter x86 x86_64,$(HOST_CROSS_ARCH))) else ifeq (,$(filter x86 x86_64,$(HOST_CROSS_ARCH)))
# We currently only provide prebuilts for x86 on host. This skips prebuilts in # We currently only provide prebuilts for x86 on host. This skips prebuilts in
# cuttlefish builds for ARM servers. # cuttlefish builds for ARM servers.
SOONG_CONFIG_art_module_source_build := true ART_MODULE_BUILD_FROM_SOURCE := true
else ifneq (,$(filter dex2oatds dex2oats,$(PRODUCT_HOST_PACKAGES))) else ifneq (,$(filter dex2oatds dex2oats,$(PRODUCT_HOST_PACKAGES)))
# Some products depend on host tools that aren't available as prebuilts. # Some products depend on host tools that aren't available as prebuilts.
SOONG_CONFIG_art_module_source_build := true ART_MODULE_BUILD_FROM_SOURCE := true
else ifeq (,$(findstring com.google.android.art,$(PRODUCT_PACKAGES))) else ifeq (,$(findstring com.google.android.art,$(PRODUCT_PACKAGES)))
# TODO(b/192006406): There is currently no good way to control which prebuilt # 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 # APEX (com.google.android.art or com.android.art) gets picked for deapexing
# to provide dex jars for hiddenapi and dexpreopting. Instead the AOSP APEX is # to provide dex jars for hiddenapi and dexpreopting. Instead the AOSP APEX is
# completely disabled, and we build from source for AOSP products. # completely disabled, and we build from source for AOSP products.
SOONG_CONFIG_art_module_source_build := true ART_MODULE_BUILD_FROM_SOURCE := true
else else
# This sets the default for building ART APEXes from source rather than # This sets the default for building ART APEXes from source rather than
# prebuilts (in packages/modules/ArtPrebuilt and prebuilt/module_sdk/art) in # prebuilts (in packages/modules/ArtPrebuilt and prebuilt/module_sdk/art) in
# all other platform builds. # all other platform builds.
SOONG_CONFIG_art_module_source_build ?= true ART_MODULE_BUILD_FROM_SOURCE := true
endif endif
$(call soong_config_set,art_module,source_build,$(ART_MODULE_BUILD_FROM_SOURCE))
# Apex build mode variables # Apex build mode variables
ifdef APEX_BUILD_FOR_PRE_S_DEVICES ifdef APEX_BUILD_FOR_PRE_S_DEVICES
$(call add_soong_config_var_value,ANDROID,library_linking_strategy,prefer_static) $(call add_soong_config_var_value,ANDROID,library_linking_strategy,prefer_static)