1# Copyright (C) 2020 The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15# This file defines the Soong Config Variable namespace ANDROID, and also any 16# variables in that namespace. 17 18# The expectation is that no vendor should be using the ANDROID namespace. This 19# check ensures that we don't collide with any existing vendor usage. 20 21ifdef SOONG_CONFIG_ANDROID 22$(error The Soong config namespace ANDROID is reserved.) 23endif 24 25$(call add_soong_config_namespace,ANDROID) 26 27# Add variables to the namespace below: 28 29$(call add_soong_config_var,ANDROID,TARGET_ENABLE_MEDIADRM_64) 30$(call add_soong_config_var,ANDROID,BOARD_USES_ODMIMAGE) 31$(call add_soong_config_var,ANDROID,PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT) 32 33ifeq (,$(findstring com.google.android.conscrypt,$(PRODUCT_PACKAGES))) 34 # Prebuilt module SDKs require prebuilt modules to work, and currently 35 # prebuilt modules are only provided for com.google.android.xxx. If we can't 36 # find one of them in PRODUCT_PACKAGES then assume com.android.xxx are in use, 37 # and disable prebuilt SDKs. In particular this applies to AOSP builds. 38 MODULE_BUILD_FROM_SOURCE := true 39endif 40 41# TODO(b/172480615): Remove when platform uses ART Module prebuilts by default. 42ifeq (,$(filter art_module,$(SOONG_CONFIG_NAMESPACES))) 43 $(call add_soong_config_namespace,art_module) 44 SOONG_CONFIG_art_module += source_build 45endif 46ifneq (,$(findstring .android.art,$(TARGET_BUILD_APPS))) 47 # Build ART modules from source if they are listed in TARGET_BUILD_APPS. 48 SOONG_CONFIG_art_module_source_build := true 49else ifeq (,$(filter-out modules_% mainline_modules_%,$(TARGET_PRODUCT))) 50 # Always build from source for the module targets. This ought to be covered by 51 # the TARGET_BUILD_APPS check above, but there are test builds that don't set it. 52 SOONG_CONFIG_art_module_source_build := true 53else ifeq (true,$(MODULE_BUILD_FROM_SOURCE)) 54 # Build from source if other Mainline modules are. 55 SOONG_CONFIG_art_module_source_build := true 56else ifneq (,$(filter true,$(NATIVE_COVERAGE) $(CLANG_COVERAGE))) 57 # Always build ART APEXes from source in coverage builds since the prebuilts 58 # aren't built with instrumentation. 59 # TODO(b/172480617): Find another solution for this. 60 SOONG_CONFIG_art_module_source_build := true 61else ifneq (,$(SANITIZE_TARGET)$(SANITIZE_HOST)) 62 # Prebuilts aren't built with sanitizers either. 63 SOONG_CONFIG_art_module_source_build := true 64 MODULE_BUILD_FROM_SOURCE := true 65else ifneq (,$(PRODUCT_FUCHSIA)) 66 # Fuchsia picks out ART internal packages that aren't available in the 67 # prebuilt. 68 SOONG_CONFIG_art_module_source_build := true 69else ifeq (,$(filter x86 x86_64,$(HOST_CROSS_ARCH))) 70 # We currently only provide prebuilts for x86 on host. This skips prebuilts in 71 # cuttlefish builds for ARM servers. 72 SOONG_CONFIG_art_module_source_build := true 73else ifneq (,$(filter dex2oatds dex2oats,$(PRODUCT_HOST_PACKAGES))) 74 # Some products depend on host tools that aren't available as prebuilts. 75 SOONG_CONFIG_art_module_source_build := true 76else ifeq (,$(findstring com.google.android.art,$(PRODUCT_PACKAGES))) 77 # TODO(b/192006406): There is currently no good way to control which prebuilt 78 # APEX (com.google.android.art or com.android.art) gets picked for deapexing 79 # to provide dex jars for hiddenapi and dexpreopting. Instead the AOSP APEX is 80 # completely disabled, and we build from source for AOSP products. 81 SOONG_CONFIG_art_module_source_build := true 82else 83 # This sets the default for building ART APEXes from source rather than 84 # prebuilts (in packages/modules/ArtPrebuilt and prebuilt/module_sdk/art) in 85 # all other platform builds. 86 SOONG_CONFIG_art_module_source_build ?= false 87endif 88 89# Apex build mode variables 90ifdef APEX_BUILD_FOR_PRE_S_DEVICES 91$(call add_soong_config_var_value,ANDROID,library_linking_strategy,prefer_static) 92endif 93 94ifeq (true,$(MODULE_BUILD_FROM_SOURCE)) 95$(call add_soong_config_var_value,ANDROID,module_build_from_source,true) 96endif 97