xref: /aosp_15_r20/external/pigweed/pw_build/pigweed.bazelrc (revision 61c4878ac05f98d0ceed94b57d316916de578985)
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 Bazel configuration flags required for all Pigweed projects.
16
17# Don't automatically create __init__.py files.
18#
19# This prevents spurious package name collisions at import time, and should be
20# the default (https://github.com/bazelbuild/bazel/issues/7386). It's
21# particularly helpful for Pigweed, because we have many potential package name
22# collisions due to a profusion of stuttering paths like
23# pw_transfer/py/pw_transfer.
24common --incompatible_default_to_explicit_init_py
25
26# Required for new toolchain resolution API.
27build --incompatible_enable_cc_toolchain_resolution
28
29# Do not attempt to configure an autodetected (local) toolchain. We vendor all
30# our toolchains, and CI VMs may not have any local toolchain to detect.
31common --repo_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
32
33# Don't propagate flags or defines to the exec config. This will become the
34# default one day (https://github.com/bazelbuild/bazel/issues/22457) and will
35# improve cache hit rates between builds targeting different platforms.
36common --experimental_exclude_defines_from_exec_config
37common --experimental_exclude_starlark_flags_from_exec_config
38
39# Enforces consistent action environment variables. This is important to
40# address Protobuf's rebuild sensitivity on changes to the environment
41# variables. It also improves cache hit rates. Should be true by default one
42# day (https://github.com/bazelbuild/bazel/issues/7026).
43build --incompatible_strict_action_env
44
45# Expose exec toolchains for Python. We use these toolchains in some rule
46# implementations (git grep for
47# "@rules_python//python:exec_tools_toolchain_type").
48build --@rules_python//python/config_settings:exec_tools_toolchain=enabled
49