xref: /aosp_15_r20/external/pigweed/pw_build/pigweed.bazelrc (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1*61c4878aSAndroid Build Coastguard Worker# Copyright 2024 The Pigweed Authors
2*61c4878aSAndroid Build Coastguard Worker#
3*61c4878aSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4*61c4878aSAndroid Build Coastguard Worker# use this file except in compliance with the License. You may obtain a copy of
5*61c4878aSAndroid Build Coastguard Worker# the License at
6*61c4878aSAndroid Build Coastguard Worker#
7*61c4878aSAndroid Build Coastguard Worker#     https://www.apache.org/licenses/LICENSE-2.0
8*61c4878aSAndroid Build Coastguard Worker#
9*61c4878aSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software
10*61c4878aSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11*61c4878aSAndroid Build Coastguard Worker# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12*61c4878aSAndroid Build Coastguard Worker# License for the specific language governing permissions and limitations under
13*61c4878aSAndroid Build Coastguard Worker# the License.
14*61c4878aSAndroid Build Coastguard Worker
15*61c4878aSAndroid Build Coastguard Worker# Standard Bazel configuration flags required for all Pigweed projects.
16*61c4878aSAndroid Build Coastguard Worker
17*61c4878aSAndroid Build Coastguard Worker# Don't automatically create __init__.py files.
18*61c4878aSAndroid Build Coastguard Worker#
19*61c4878aSAndroid Build Coastguard Worker# This prevents spurious package name collisions at import time, and should be
20*61c4878aSAndroid Build Coastguard Worker# the default (https://github.com/bazelbuild/bazel/issues/7386). It's
21*61c4878aSAndroid Build Coastguard Worker# particularly helpful for Pigweed, because we have many potential package name
22*61c4878aSAndroid Build Coastguard Worker# collisions due to a profusion of stuttering paths like
23*61c4878aSAndroid Build Coastguard Worker# pw_transfer/py/pw_transfer.
24*61c4878aSAndroid Build Coastguard Workercommon --incompatible_default_to_explicit_init_py
25*61c4878aSAndroid Build Coastguard Worker
26*61c4878aSAndroid Build Coastguard Worker# Required for new toolchain resolution API.
27*61c4878aSAndroid Build Coastguard Workerbuild --incompatible_enable_cc_toolchain_resolution
28*61c4878aSAndroid Build Coastguard Worker
29*61c4878aSAndroid Build Coastguard Worker# Do not attempt to configure an autodetected (local) toolchain. We vendor all
30*61c4878aSAndroid Build Coastguard Worker# our toolchains, and CI VMs may not have any local toolchain to detect.
31*61c4878aSAndroid Build Coastguard Workercommon --repo_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
32*61c4878aSAndroid Build Coastguard Worker
33*61c4878aSAndroid Build Coastguard Worker# Don't propagate flags or defines to the exec config. This will become the
34*61c4878aSAndroid Build Coastguard Worker# default one day (https://github.com/bazelbuild/bazel/issues/22457) and will
35*61c4878aSAndroid Build Coastguard Worker# improve cache hit rates between builds targeting different platforms.
36*61c4878aSAndroid Build Coastguard Workercommon --experimental_exclude_defines_from_exec_config
37*61c4878aSAndroid Build Coastguard Workercommon --experimental_exclude_starlark_flags_from_exec_config
38*61c4878aSAndroid Build Coastguard Worker
39*61c4878aSAndroid Build Coastguard Worker# Enforces consistent action environment variables. This is important to
40*61c4878aSAndroid Build Coastguard Worker# address Protobuf's rebuild sensitivity on changes to the environment
41*61c4878aSAndroid Build Coastguard Worker# variables. It also improves cache hit rates. Should be true by default one
42*61c4878aSAndroid Build Coastguard Worker# day (https://github.com/bazelbuild/bazel/issues/7026).
43*61c4878aSAndroid Build Coastguard Workerbuild --incompatible_strict_action_env
44*61c4878aSAndroid Build Coastguard Worker
45*61c4878aSAndroid Build Coastguard Worker# Expose exec toolchains for Python. We use these toolchains in some rule
46*61c4878aSAndroid Build Coastguard Worker# implementations (git grep for
47*61c4878aSAndroid Build Coastguard Worker# "@rules_python//python:exec_tools_toolchain_type").
48*61c4878aSAndroid Build Coastguard Workerbuild --@rules_python//python/config_settings:exec_tools_toolchain=enabled
49