-
Notifications
You must be signed in to change notification settings - Fork 47
/
.bazelrc
59 lines (49 loc) · 2.44 KB
/
.bazelrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# See e.g. https://blog.aspect.dev/bazelrc-flags
# https://github.com/bazelbuild/rules_foreign_cc/issues/1129
# Mandatory at the moment for Bazel 7.0.0.
build --noincompatible_sandbox_hermetic_tmp
# This is mandatory if your build env doesn't have a proper Python 3 exe
# -- like the CI build image for this repo.
# The build image is using a fake python exe, see
# https://github.com/mvukov/bazel_builder/blob/main/Dockerfile.
# If blzmod is enabled, but not used as in this repo at the moment),
# then bazel for some reason tries to auto-detect a Python exe.
build --noenable_bzlmod
# Fix the wrong default to generate __init__.py to delimit a Python package.
# This is a mandatory flag.
build --incompatible_default_to_explicit_init_py
# All code will be compiled with C++17 flag.
# Users can naturally override copts for cc_* targets.
# NOTE: googletest >=v1.13.0 requires min C++14.
# This is a mandatory flag.
build --cxxopt=-std=c++17
# Ensure that you don't accidentally make non-hermetic actions/tests
# which depend on remote services. Tag an individual target with
# tags=["requires-network"] to opt-out of the enforcement.
# In ROS context this is important such that each test target is executed
# in a separate network environment.
# This is a mandatory flag.
build --sandbox_default_allow_network=false
# Don't let local Python site packages leak into the build and cause problems
common --action_env=PYTHONNOUSERSITE=1
# Don't let environment variables like $PATH sneak into the build,
# which can cause massive cache misses when they change.
common --incompatible_strict_action_env
# Helps debugging when Bazel runs out of memory
build --heap_dump_on_oom
# Speed up all builds by not checking if output files have been modified.
build --noexperimental_check_output_files
# Don't bother building targets which aren't dependencies of the tests.
test --build_tests_only
# Show all the problems
test --test_output=errors
# To use a clang compiler, invoke Bazel with `--config=clang`.
build:clang --repo_env=CC=clang
build:clang --repo_env=CXX=clang++
build:clang --linkopt="-fuse-ld=lld"
# Load any settings specific to the current user.
# user.bazelrc should appear in .gitignore so that settings are not shared with
# team members. This needs to be last statement in this config,
# as the user configuration should be able to overwrite flags from this file.
# See https://docs.bazel.build/versions/master/best-practices.html#bazelrc
try-import %workspace%/user.bazelrc