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 32ifeq (,$(filter com.google.android.conscrypt,$(PRODUCT_PACKAGES))) 33 # Prebuilt module SDKs require prebuilt modules to work, and currently 34 # prebuilt modules are only provided for com.google.android.xxx. If we can't 35 # find one of them in PRODUCT_PACKAGES then assume com.android.xxx are in use, 36 # and disable prebuilt SDKs. In particular this applies to AOSP builds. 37 MODULE_BUILD_FROM_SOURCE := true 38endif 39 40# TODO(b/172480615): Remove when platform uses ART Module prebuilts by default. 41ifeq (,$(filter art_module,$(SOONG_CONFIG_NAMESPACES))) 42 $(call add_soong_config_namespace,art_module) 43 SOONG_CONFIG_art_module += source_build 44endif 45ifneq (,$(findstring .android.art,$(TARGET_BUILD_APPS))) 46 # Build ART modules from source if they are listed in TARGET_BUILD_APPS. 47 SOONG_CONFIG_art_module_source_build := true 48else ifeq (,$(filter-out modules_% mainline_modules_%,$(TARGET_PRODUCT))) 49 # Always build from source for the module targets. This ought to be covered by 50 # the TARGET_BUILD_APPS check above, but there are test builds that don't set it. 51 SOONG_CONFIG_art_module_source_build := true 52else ifdef MODULE_BUILD_FROM_SOURCE 53 # Build from source if other Mainline modules are. 54 SOONG_CONFIG_art_module_source_build := true 55else ifneq (,$(filter true,$(NATIVE_COVERAGE) $(CLANG_COVERAGE))) 56 # Always build ART APEXes from source in coverage builds since the prebuilts 57 # aren't built with instrumentation. 58 # TODO(b/172480617): Find another solution for this. 59 SOONG_CONFIG_art_module_source_build := true 60else ifneq (,$(SANITIZE_TARGET)$(SANITIZE_HOST)) 61 # Prebuilts aren't built with sanitizers either. 62 SOONG_CONFIG_art_module_source_build := true 63 MODULE_BUILD_FROM_SOURCE := true 64else ifneq (,$(PRODUCT_FUCHSIA)) 65 # Fuchsia picks out ART internal packages that aren't available in the 66 # prebuilt. 67 SOONG_CONFIG_art_module_source_build := true 68else ifeq (,$(filter x86 x86_64,$(HOST_CROSS_ARCH))) 69 # We currently only provide prebuilts for x86 on host. This skips prebuilts in 70 # cuttlefish builds for ARM servers. 71 SOONG_CONFIG_art_module_source_build := true 72else ifneq (,$(filter dex2oatds dex2oats,$(PRODUCT_HOST_PACKAGES))) 73 # Some products depend on host tools that aren't available as prebuilts. 74 SOONG_CONFIG_art_module_source_build := true 75else ifeq (,$(filter com.google.android.art,$(PRODUCT_PACKAGES))) 76 # TODO(b/192006406): There is currently no good way to control which prebuilt 77 # APEX (com.google.android.art or com.android.art) gets picked for deapexing 78 # to provide dex jars for hiddenapi and dexpreopting. Instead the AOSP APEX is 79 # completely disabled, and we build from source for AOSP products. 80 SOONG_CONFIG_art_module_source_build := true 81else 82 # This sets the default for building ART APEXes from source rather than 83 # prebuilts (in packages/modules/ArtPrebuilt and prebuilt/module_sdk/art) in 84 # all other platform builds. 85 SOONG_CONFIG_art_module_source_build ?= false 86endif 87 88# Apex build mode variables 89ifdef APEX_BUILD_FOR_PRE_S_DEVICES 90$(call add_soong_config_var_value,ANDROID,library_linking_strategy,prefer_static) 91endif 92 93ifdef MODULE_BUILD_FROM_SOURCE 94$(call add_soong_config_var_value,ANDROID,module_build_from_source,true) 95endif 96