1# Use the target platform (android_x86, android_arm) in the bazel-out/ output 2# directory name fragment instead of the CPU (darwin, k8). This avoids 3# thrashing the output directory when switching between top level target 4# --platforms values. 5build --experimental_platform_in_output_dir 6 7# Use toolchain resolution to find the cc toolchain. 8build --incompatible_enable_cc_toolchain_resolution 9 10# Ensure that the host_javabase always use the checked-in JDK. 11build --tool_java_runtime_version=jdk17 12build --java_runtime_version=jdk17 13 14# Lock down the PATH variable in actions to /usr/bin and /usr/local/bin. 15build --experimental_strict_action_env 16 17# Explicitly allow unresolved symlinks (it's an experimental Bazel feature) 18build --experimental_allow_unresolved_symlinks 19 20# Enable SCL because some files are shared between bazel and make/soong 21common --experimental_enable_scl_dialect 22 23# Enable usage of experimental cc-related build APIs 24common --experimental_cc_shared_library 25build --experimental_starlark_cc_import 26 27# Do not enable BzlMod as the migration to bzlmod has not been done yet 28common --noenable_bzlmod 29 30# Do not tokenize copts, other than strings that consist of a single Make 31# variable. This prevents the need to double-escape characters like backslashes 32# and quotes in copts. 33build --features no_copts_tokenization 34 35# Disable local cpp toolchain detection, as it is explicitly declared in AOSP. 36build --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 37 38build --proto_compiler=//external/protobuf:aprotoc 39 40# Disable sandboxing for CppCompile actions, as headers are not fully specified. 41# TODO(b/186116353): This is a temporary fix, as appropriately-sandboxed actions 42# are a long term goal. 43build --strategy=CppCompile=standalone 44 45# Enable use of the implementation_deps attribute in native cc rules 46build --experimental_cc_implementation_deps 47 48# Use the llvm_coverage_map_format feature to turn on native code coverage. 49build --experimental_use_llvm_covmap 50 51# Always emit the stdout of failing tests as they should be emphasized. (b/247516541) 52test --test_output=errors 53 54# Enable building targets in //external:__subpackages__. 55common --experimental_sibling_repository_layout 56common --experimental_disable_external_package 57 58# Disable all repository_ctx.download calls. 59common --repository_disable_download 60 61# Increase refresh rate of command line UI for improved perceived responsiveness. 62common --show_progress_rate_limit=0.05 63 64# These are disabled when running under soong_ui (default = auto). Force enable them here. 65common --color=yes 66common --curses=yes 67 68# Configurations specific to CI builds, generally to improve signal-to-noise ratio in server logs. 69common:ci --color=yes 70common:ci --curses=no 71common:ci --show_progress_rate_limit=5 72common:ci --noshow_loading_progress 73# Show the full set of flags for observability and debuggability. 74common:ci --announce_rc 75build:ci --verbose_failures 76test:ci --keep_going 77 78# Support a local user-specific bazelrc file. 79try-import %workspace%/user.bazelrc 80 81# Get rid no-op "affected by Starlark transition" config when label-based flag 82# (i.e. //command_line_option:fdo_profile) is set back to None 83build --experimental_output_directory_naming_scheme=diff_against_baseline 84common --experimental_google_legacy_api 85build --android_sdk=//prebuilts/sdk:android_sdk 86build --incompatible_enable_android_toolchain_resolution 87common --experimental_enable_android_migration_apis 88common --incompatible_java_common_parameters 89build --android_databinding_use_v3_4_args 90build --experimental_android_databinding_v2 91build --define=android_incremental_dexing_tool=d8_dexbuilder 92build --define=android_dexmerger_tool=d8_dexmerger 93 94# TODO(b/199038020): Use a python_toolchain when we have Starlark rules_python. 95# This also means all python scripts are using py3 runtime. 96build --python_top=//prebuilts/build-tools:python3 97build --noincompatible_use_python_toolchains 98 99 100# Enable optimization compilation mode to build cc with fdo 101# https://github.com/bazelbuild/bazel/blob/de7b26acfdfcd9c36ec957305a889ac29f0da30e/src/main/java/com/google/devtools/build/lib/rules/cpp/FdoHelper.java#L55 102build --compilation_mode=opt 103 104common --incompatible_remove_rule_name_parameter=false 105 106common --override_repository=rules_java_builtin=%workspace%/external/bazelbuild-rules_java 107 108# TODO(b/264304464): Remove when bugs with java_binary starlark impl are fixed. 109 110common --experimental_builtins_injection_override=-java_binary 111 112common --experimental_java_library_export 113 114# Set writable bit for all bazel outputs. This makes it easy to remove 115# the output directory and its contents after a build (using `rm`). 116build --experimental_writable_outputs 117 118# Make the Linux sandbox work under /tmp 119build --incompatible_sandbox_hermetic_tmp 120 121# TODO(b/275690057, b/275727890): Remove this and fix cc_shared_library usage proper. 122build --noexperimental_link_static_libraries_once 123 124# native.py rules are being ported to Starlark: https://github.com/bazelbuild/bazel/issues/15897 125# 126# TODO(b/200202912): Resolve/delete this when rules_python is pulled into AOSP. 127# 128# Need this, otherwise: 129# 130# ERROR: .. in py_runtime rule //prebuilts/build-tools:python2: 131# Traceback (most recent call last): 132# File "/virtual_builtins_bzl/common/python/py_runtime_rule.bzl", line 24, column 25, in _py_runtime_impl 133# File "/virtual_builtins_bzl/common/python/common.bzl", line 509, column 13, in check_native_allowed 134# Error in fail: //prebuilts/build-tools:python2 not allowed to use native.py_runtime 135# Generated by: py_runtime(name=python2) in prebuilts/build-tools/BUILD.bazel:63:11 136# Allowlist: no allowlist specified; all disallowed; specify one with --python_native_rules_allowlist 137# Migrate to using @rules_python, see https://github.com/bazelbuild/bazel/issues/17773 138# FIXCMD: add_python_loads --target=//prebuilts/build-tools:python2 --rule=py_runtime --generator_name=python2 --location=prebuilts/build-tools/BUILD.bazel:63:11 139# 140# See also message in https://github.com/bazelbuild/bazel/commit/2e558ed5dccdcc72622df52bf6d4dfe90ddc390c 141build --noincompatible_python_disallow_native_rules 142 143# Google internal operations 144try-import %workspace%/vendor/google/tools/soong_config/googler.bazelrc 145 146build --incompatible_visibility_private_attributes_at_definition 147 148# Some targets in rules_go use config_setting(s) that are not visible to them 149# TODO - b/289074954: Fix the visibility defs in rules_go and re-enable this enforcement. 150build --incompatible_enforce_config_setting_visibility=false 151 152# By default, b test will run all tests regardless of deviceless or device variants. 153# Use these configs to filter the tests to run, e.g. b test //system/... --config=deviceless_tests 154# The filter value is the name of the rule, but without the "_test" suffix. 155test:deviceless_tests --test_lang_filters=tradefed_deviceless 156test:device_tests --test_lang_filters=tradefed_device_driven,tradefed_host_driven_device 157 158# Supporting cgo for building go code is not required 159# Disable it explcitly to prevent issues with C toolchain setup 160build --@io_bazel_rules_go//go/config:pure 161 162# Breaking bazel feature for the 7/25 release. b/292565910 163common --noincompatible_use_host_features 164 165# Run GoToolchainBinaryBuild in a sandbox 166# Without sandboxing, the action will run in an execution root that contains a symlink to prebuilts/go 167# This causes issues due to two separate factors combining together 168# a. The GOROOT in our checked in go binary is relative to android build top 169# b. GoToolchainBinaryBuild uses GOCACHE=$(mktemp -d) 170build --strategy GoToolchainBinaryBuild=sandboxed 171 172startup --connect_timeout_secs=45 173 174# TODO(b/300376073): Reuse the RBE instance of BES for remote test. 175###### Remote Virtual Device Test Execution Configuration. 176###### 177# --flag_alias does not work with --config, has to be defined for top level build command 178build --flag_alias=ab_build_id=//build/bazel_common_rules/rules/remote_device:build_id 179build --flag_alias=ab_target=//build/bazel_common_rules/rules/remote_device:target 180build --flag_alias=ab_branch=//build/bazel_common_rules/rules/remote_device:branch 181 182test:remote_avd --config=remote 183test:remote_avd --test_timeout=3600 184test:remote_avd --//build/bazel_common_rules/rules/remote_device:target_device=//build/bazel_common_rules/rules/remote_device:cf_x86_64_phone 185test:remote_avd --//build/bazel_common_rules/rules/remote_device:exec_mode=remote 186test:remote_avd --experimental_credential_helper_timeout=60s 187test:remote_avd --google_default_credentials=true 188 189build:remote_avd --spawn_strategy=sandboxed # force disable remote cache, some actions don't work with it 190build:remote_avd --strategy=AbiDump=local # force disable sandbox 191build:remote_avd --strategy=AbiLink=local # force disable sandbox 192build:remote_avd --strategy=AbiDiff=local # force disable sandbox 193test:remote_avd --strategy=DownloadCvd=remote 194# Certain tests are tagged "no-remote", so allow sandboxed fallback to avoid forcing all tests to run remotely. 195test:remote_avd --strategy=TestRunner=remote,sandboxed 196test:remote_avd --test_env=PATH="/bin:/usr/bin/" 197 198# Depending on how many machines are in the remote execution instance, setting 199# this higher can make builds faster by allowing more jobs to run in parallel. 200# Setting it too high can result in jobs that timeout, however, while waiting 201# for a remote machine to execute them. 202test:remote --jobs=200 203test:remote --remote_cache=grpcs://remotebuildexecution.googleapis.com 204test:remote --remote_executor=grpcs://remotebuildexecution.googleapis.com 205test:remote --remote_timeout=3600 206 207