• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2024 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.
14
15# Standard Pigweed flags
16# ======================
17# All Pigweed projects are expected to set these flags. They mostly pre-adopt
18# future Bazel settings, and most are critical to working around known issues.
19#
20# The source of truth for these flags is @pigweed//pw_build:pigweed.bazelrc in
21# the main Pigweed repo.
22
23# Don't automatically create __init__.py files.
24#
25# This prevents spurious package name collisions at import time, and should be
26# the default (https://github.com/bazelbuild/bazel/issues/7386). It's
27# particularly helpful for Pigweed, because we have many potential package name
28# collisions due to a profusion of stuttering paths like
29# pw_transfer/py/pw_transfer.
30common --incompatible_default_to_explicit_init_py
31
32# Do not attempt to configure an autodetected (local) toolchain. We vendor all
33# our toolchains, and CI VMs may not have any local toolchain to detect.
34common --repo_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
35
36# Don't propagate flags or defines to the exec config. This will become the
37# default one day (https://github.com/bazelbuild/bazel/issues/22457) and will
38# improve cache hit rates between builds targeting different platforms. This is
39# especially impactful for large host tools like protoc, which will have its
40# cache invalidated when your host C++ config changes, causing many rebuilds
41# of protoc (https://pwbug.dev/315871648).
42common --experimental_exclude_defines_from_exec_config
43common --experimental_exclude_starlark_flags_from_exec_config
44
45# Enforces consistent action environment variables. This is important to
46# address Protobuf's rebuild sensitivity on changes to the environment
47# variables. It also improves cache hit rates. Should be true by default one
48# day (https://github.com/bazelbuild/bazel/issues/7026).
49build --incompatible_strict_action_env
50
51# TODO: https://github.com/bazelbuild/rules_python/issues/2515 - This flag was
52# enabled with Bazel 8.0.0, but it breaks py_proto_library imports when using
53# the latest release of rules_python (1.0.0). Flipping this flag is a temporary
54# workaround.
55common --legacy_external_runfiles=True
56
57# Ensures `--run_under` is treated as an exec platform binary.
58# This ensures when targeting `--platform=foo`, a `--run_under` test runner
59# will be built for the host. This was originally intended to be flipped in
60# Bazel 8.0.0, but didn't quite make the cut.
61# Also see: https://github.com/bazelbuild/bazel/issues/23179
62test --incompatible_bazel_test_exec_run_under=True
63