xref: /aosp_15_r20/bootable/libbootloader/gbl/bazel.bazelrc (revision 5225e6b173e52d2efc6bcf950c27374fd72adabc)
1*5225e6b1SAndroid Build Coastguard Worker# Lock down the PATH variable in actions to /usr/bin and /usr/local/bin.
2*5225e6b1SAndroid Build Coastguard Workerbuild --incompatible_strict_action_env
3*5225e6b1SAndroid Build Coastguard Worker
4*5225e6b1SAndroid Build Coastguard Worker# By default, output all the logs to stdout/stderr by disabling the console limit
5*5225e6b1SAndroid Build Coastguard Workerbuild --experimental_ui_max_stdouterr_bytes=-1
6*5225e6b1SAndroid Build Coastguard Worker
7*5225e6b1SAndroid Build Coastguard Worker# Make output directories writable so `rm -rf out/` works.
8*5225e6b1SAndroid Build Coastguard Workerbuild --experimental_writable_outputs
9*5225e6b1SAndroid Build Coastguard Worker
10*5225e6b1SAndroid Build Coastguard Worker# NOTE: To ensure a strict no external access policy, the following three flags
11*5225e6b1SAndroid Build Coastguard Worker#   need to be set/unset, see https://github.com/bazelbuild/bazel/discussions/18281
12*5225e6b1SAndroid Build Coastguard Worker#   for more details about this.
13*5225e6b1SAndroid Build Coastguard Worker# An empty string as argument requests the cache to be disabled.
14*5225e6b1SAndroid Build Coastguard Workercommon --repository_cache=
15*5225e6b1SAndroid Build Coastguard Worker# Additional places to search for archives before accessing the network to download them.
16*5225e6b1SAndroid Build Coastguard Workercommon --distdir=
17*5225e6b1SAndroid Build Coastguard Worker# If set, downloading using ctx.download{,_and_extract} is not allowed during repository fetching.
18*5225e6b1SAndroid Build Coastguard Workercommon --repository_disable_download
19*5225e6b1SAndroid Build Coastguard Worker
20*5225e6b1SAndroid Build Coastguard Worker# bzlmod
21*5225e6b1SAndroid Build Coastguard Workercommon --enable_bzlmod
22*5225e6b1SAndroid Build Coastguard Workercommon --registry=file://%workspace%/external/bazelbuild-bazel-central-registry
23*5225e6b1SAndroid Build Coastguard Worker# Set --lockfile_mode=off to prevent generation of MODULE.bazel.lock
24*5225e6b1SAndroid Build Coastguard Worker# and caching of source declarations in the registry.
25*5225e6b1SAndroid Build Coastguard Worker# See https://github.com/bazelbuild/bazel/issues/20477
26*5225e6b1SAndroid Build Coastguard Worker# Note: If the registry files are modified, one needs to run `bazel shutdown`
27*5225e6b1SAndroid Build Coastguard Worker#   as well as setting this flag. Usually, files are only added to the registry.
28*5225e6b1SAndroid Build Coastguard Workercommon --lockfile_mode=off
29*5225e6b1SAndroid Build Coastguard Worker
30*5225e6b1SAndroid Build Coastguard Worker# CC toolchain
31*5225e6b1SAndroid Build Coastguard Worker# Use --platforms to select toolchains, not the legacy --cpu --cross_top --compiler.
32*5225e6b1SAndroid Build Coastguard Worker# See https://bazel.build/concepts/platforms#cxx
33*5225e6b1SAndroid Build Coastguard Workerbuild --incompatible_enable_cc_toolchain_resolution
34*5225e6b1SAndroid Build Coastguard Worker
35*5225e6b1SAndroid Build Coastguard Worker# Do not use host toolchain
36*5225e6b1SAndroid Build Coastguard Workerbuild --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
37*5225e6b1SAndroid Build Coastguard Worker
38*5225e6b1SAndroid Build Coastguard Workerbuild --@rules_rust//rust/settings:experimental_toolchain_generated_sysroot=false
39*5225e6b1SAndroid Build Coastguard Workercommon --extra_toolchains=@gbl//toolchain:all
40*5225e6b1SAndroid Build Coastguard Workertest  --test_output=errors
41*5225e6b1SAndroid Build Coastguard Worker
42*5225e6b1SAndroid Build Coastguard Worker# Set up remote caching
43*5225e6b1SAndroid Build Coastguard Worker# https://developers.google.com/remote-build-execution/docs/set-up/set-up-caching
44*5225e6b1SAndroid Build Coastguard Workertest:ants --remote_cache=grpcs://remotebuildexecution.googleapis.com
45*5225e6b1SAndroid Build Coastguard Workertest:ants --google_default_credentials=true
46*5225e6b1SAndroid Build Coastguard Workertest:ants --remote_instance_name=projects/android-build-farm/instances/default_instance
47*5225e6b1SAndroid Build Coastguard Workertest:ants --noremote_upload_local_results
48*5225e6b1SAndroid Build Coastguard Worker
49*5225e6b1SAndroid Build Coastguard Worker# Upload results to BES backend.
50*5225e6b1SAndroid Build Coastguard Worker# Refer to go/bazel-ants-docs
51*5225e6b1SAndroid Build Coastguard Workertest:ants --bes_backend=buildeventservice-pa.googleapis.com
52*5225e6b1SAndroid Build Coastguard Workertest:ants --bes_keywords=android-test-storage
53*5225e6b1SAndroid Build Coastguard Workertest:ants --bes_instance_name=android-build-farm
54*5225e6b1SAndroid Build Coastguard Workertest:ants --build_metadata=run_type=critical
55*5225e6b1SAndroid Build Coastguard Worker
56*5225e6b1SAndroid Build Coastguard Worker# Show URI to test results
57*5225e6b1SAndroid Build Coastguard Workertest:ants --build_metadata=generate_test_uri=fusion
58*5225e6b1SAndroid Build Coastguard Worker
59*5225e6b1SAndroid Build Coastguard Worker# These need to be set in the command line
60*5225e6b1SAndroid Build Coastguard Worker# test:ants --build_metadata="ab_build_id=${BUILD_ID}"
61*5225e6b1SAndroid Build Coastguard Worker# test:ants --build_metadata="ab_target=???",
62*5225e6b1SAndroid Build Coastguard Worker# test:ants --build_metadata="test_definition_name=kernel/kleaf/???"
63*5225e6b1SAndroid Build Coastguard Worker
64*5225e6b1SAndroid Build Coastguard Workercommon:android_ci --noshow_progress
65*5225e6b1SAndroid Build Coastguard Workertest:android_ci --config=ants
66