-
Notifications
You must be signed in to change notification settings - Fork 591
/
.bazelrc
110 lines (89 loc) · 4.35 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
common --registry=https://bcr.bazel.build
common --extra_toolchains=@llvm_18_toolchain//:all
common --@toolchains_llvm//toolchain/config:libunwind=False
common --@toolchains_llvm//toolchain/config:compiler-rt=False
build --linkopt --unwindlib=libgcc
common:clang-19 --extra_toolchains=@llvm_19_toolchain//:all
build:system-clang --extra_toolchains=@local_config_cc_toolchains//:all
build:system-clang --action_env=BAZEL_COMPILER=clang
build:system-clang --cxxopt=-std=c++20 --host_cxxopt=-std=c++20
build:system-clang --linkopt -fuse-ld=lld
# use a compiler name that doesn't symlink to ccache
build:system-clang-18 --config=system-clang
build:system-clang-18 --action_env=CC=clang-18 --host_action_env=CC=clang-18
build:system-clang-18 --action_env=CXX=clang++-18 --host_action_env=CXX=clang++-18
build:system-clang-19 --config=system-clang
build:system-clang-19 --action_env=CC=clang-19 --host_action_env=CC=clang-19
build:system-clang-19 --action_env=CXX=clang++-19 --host_action_env=CXX=clang++-19
# https://github.com/bazelbuild/rules_foreign_cc/issues/1065
# https://github.com/bazelbuild/rules_foreign_cc/issues/1186#issuecomment-2053550487
build --host_action_env=CXXFLAGS=-Wno-int-conversion
build --action_env=CXXFLAGS=-Wno-int-conversion
build --host_action_env=CFLAGS=-Wno-int-conversion
build --action_env=CFLAGS=-Wno-int-conversion
build --keep_going
# prevent actions and tests from using the network. anything that needs to
# opt-out (e.g. a network test) can use `tags=["requires-network"]`.
build --sandbox_default_allow_network=false
# prevent certain environment variables (e.g. PATH and LD_LIBRARY_PATH) from
# leaking into the build.
build --incompatible_strict_action_env
# Add stack guards by default for better debugging, we disable them in release builds
build --@seastar//:stack_guards=True
# =================================
# Sanitizer
# =================================
build:sanitizer --copt -fsanitize=address,undefined,vptr,function
build:sanitizer --linkopt -fsanitize=address,undefined,vptr,function
build:sanitizer --linkopt --rtlib=compiler-rt
build:sanitizer --linkopt -fsanitize-link-c++-runtime
build:sanitizer --copt -O1
# seastar has to be run with system allocator when using sanitizers
build:sanitizer --@seastar//:system_allocator=True
# krb5 is a foreign cc build and needs explicit list of sanitizers to build the shared library
build:sanitizer --@krb5//:sanitizers=address,undefined,vptr,function
# =================================
# clang-tidy
# =================================
build:clang-tidy --aspects @bazel_clang_tidy//clang_tidy:clang_tidy.bzl%clang_tidy_aspect
build:clang-tidy --@bazel_clang_tidy//:clang_tidy_executable=@llvm_18_toolchain//:clang-tidy
build:clang-tidy --@bazel_clang_tidy//:clang_tidy_config=//:clang_tidy_config
build:clang-tidy --copt -Wno-pragma-once-outside-header
build:clang-tidy --output_groups=report
# =================================
# Security
# =================================
# fortify source requires a high optimization level. when using this feature add
# `--copt -O2` or combine with a compilation mode like `-c opt`. the default
# bazel toolchain adds _FORTIFY_SOURCE=1 in `-c opt`, so first clear the
# definition to avoid -Wmacro-redefined warnings.
build:fortify-source --copt -U_FORTIFY_SOURCE
build:fortify-source --copt -D_FORTIFY_SOURCE=2
build:stack-clash --copt -fstack-clash-protection
build:stack-protector --copt -fstack-protector-strong
build:relro --copt -fno-plt
build:relro --linkopt -Wl,-z,relro,-z,now
# Use `--config=secure` for all supported security settings
build:secure --config=fortify-source
build:secure --config=stack-clash
build:secure --config=stack-protector
build:secure --config=relro
# =================================
# Release
# =================================
build:release --compilation_mode opt
build:release --config=secure
build:release --copt -mllvm --copt -inline-threshold=2500
build:release --linkopt=-flto
build:release --@seastar//:stack_guards=False
build:stamp --stamp --workspace_status_command=./bazel/stamp_vars.sh
# =================================
# Testing
# =================================
# prints out combined stdout/stderr for failed tests
test --test_output=errors
# warn if a timeout is much longer than actual runtime
test --test_verbose_timeout_warnings
test:unit --test_tag_filters=-bench
test:bench --test_tag_filters=bench
try-import %workspace%/user.bazelrc