blob: 40b8caa20cda7d4e67dfd16381b99da646660ed1 [file] [log] [blame]
Ted Pudlik448df692023-10-16 21:17:27 +00001# Copyright 2023 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7# https://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, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
Ted Pudlik24475792024-01-11 19:39:57 +000014
Ted Pudlik16c686b2024-08-08 22:14:02 +000015# Don't automatically create __init__.py files.
16#
17# This prevents spurious package name collisions at import time, and should be
18# the default (https://github.com/bazelbuild/bazel/issues/7386). It's
19# particularly helpful for Pigweed, because we have many potential package name
20# collisions due to a profusion of stuttering paths like
21# pw_transfer/py/pw_transfer.
22common --incompatible_default_to_explicit_init_py
Ted Pudlik24475792024-01-11 19:39:57 +000023
Ted Pudlik448df692023-10-16 21:17:27 +000024# Do not attempt to configure an autodetected (local) toolchain. We vendor all
25# our toolchains, and CI VMs may not have any local toolchain to detect.
26common --repo_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
27
28# Required for new toolchain resolution API.
29build --incompatible_enable_cc_toolchain_resolution
Ted Pudlik5e7f1e32024-08-02 22:32:12 +000030
Ted Pudlik16c686b2024-08-08 22:14:02 +000031# Don't propagate flags or defines to the exec config. This will become the
32# default one day (https://github.com/bazelbuild/bazel/issues/22457) and will
33# improve cache hit rates between builds targeting different platforms.
34common --experimental_exclude_defines_from_exec_config
35common --experimental_exclude_starlark_flags_from_exec_config
36
37# Enforces consistent action environment variables. This is important to
38# address Protobuf's rebuild sensitivity on changes to the environment
39# variables. It also improves cache hit rates. Should be true by default one
40# day (https://github.com/bazelbuild/bazel/issues/7026).
41build --incompatible_strict_action_env
42
43# Expose exec toolchains for Python. We use these toolchains in some rule
44# implementations (git grep for
45# "@rules_python//python:exec_tools_toolchain_type").
46build --@rules_python//python/config_settings:exec_tools_toolchain=enabled
47
Ted Pudlikfe93ea82024-09-27 18:40:54 +000048# Remote execution config definitions
49# ===================================
50# Use the remote cache. This will only work for users who have permission to access it.
51common:remote_cache --remote_cache=grpcs://remotebuildexecution.googleapis.com
52common:remote_cache --google_default_credentials=true
53common:remote_cache --remote_instance_name=projects/pigweed-rbe-open/instances/default-instance
54common:remote_cache --remote_upload_local_results=false
55common:remote_cache --bes_backend="buildeventservice.googleapis.com"
56# Required to use buildeventservice on Bazel 8+.
57# TODO: b/345556899 -- Remove this flag when no longer required.
58common:remote_cache --legacy_important_outputs
59common:remote_cache --bes_timeout=600s
60common:remote_cache --bes_results_url="https://source.cloud.google.com/results/invocations/"
61common:remote_cache --bes_instance_name=pigweed-rbe-open
62
Ted Pudlik5e7f1e32024-08-02 22:32:12 +000063# User bazelrc file; see
64# https://bazel.build/configure/best-practices#bazelrc-file
65#
66# Note: this should be at the bottom of the file, so that user-specified
67# options override anything in this file
68# (https://bazel.build/run/bazelrc#imports)
69try-import %workspace%/user.bazelrc