1- # build
2- # ld: warning: -undefined dynamic_lookup may not work with chained fixups
3- # temporary solution: https://github.com/bazelbuild/bazel/issues/16413
4- # build --linkopt=-Wl,-no_fixup_chains
5- build --platforms=//config/platforms:macos_arm64_platform
6-
7- # Gcov config
8- # build:gcov --copt -fprofile-arcs
9- # build:gcov --copt -ftest-coverage
10-
1+ ####################################
2+ # General Bazel Configuration
3+ ####################################
114
12- ###############################
13- # test #
14- ###############################
5+ common --color=yes
6+ common --curses=yes
157
16- test --test_verbose_timeout_warnings
17- test --verbose_failures
18- test --keep_going
19- test --test_output=all
8+ ####################################
9+ # Default Platform (macOS ARM64)
10+ ####################################
2011
21- ###############################
22- # sanitizer #
23- ###############################
12+ build --platforms=//config/platforms:macos_arm64_platform
2413
25- build:asan --strip=never
26- build:asan --copt -fsanitize=address
27- build:asan --copt -DADDRESS_SANITIZER
28- build:asan --copt -O1
29- build:asan --copt -g
30- build:asan --copt -fno-omit-frame-pointer
31- build:asan --linkopt -fsanitize=address
14+ ####################################
15+ # Compiler & Linker Warnings
16+ ####################################
3217
33- # do not use in production code:
34- build --config=asan
18+ build --copt=-Wall
19+ build --copt=-Wextra
20+ build --copt=-Wpedantic
21+ build --copt=-Wno-unused-parameter
22+ build --copt=-Werror=implicit-function-declaration
3523
36- ###############################
37- # Profile #
38- ###############################
24+ ####################################
25+ # Cache Configuration
26+ ####################################
3927
40- build --generate_json_trace_profile
28+ build --disk_cache=.cache/bazel_cache
29+ build --workspace_status_command=tools/scripts/workspace_status.sh
4130
42- ###############################
43- # macOS SDK Version #
44- ###############################
31+ ####################################
32+ # Test Configuration
33+ ####################################
4534
46- # build --macos_sdk_version=15.1
35+ test --test_verbose_timeout_warnings
36+ test --verbose_failures
37+ test --keep_going
38+ test --test_output=all
4739
48- ###############################
49- # Output #
50- ###############################
40+ ####################################
41+ # Debug Build (with ASAN/UBSAN)
42+ ####################################
43+
44+ build:debug --compilation_mode=dbg
45+ build:debug --strip=never
46+ build:debug --copt=-O0
47+ build:debug --copt=-g
48+ build:debug --copt=-fno-omit-frame-pointer
49+ build:debug --copt=-fsanitize=address
50+ build:debug --copt=-fsanitize=undefined
51+ build:debug --linkopt=-fsanitize=address
52+ build:debug --linkopt=-fsanitize=undefined
53+ build:debug --define=DEBUG=1
54+ build:debug --features=layering_check
55+ build:debug --sandbox_debug
56+
57+ test:debug --config=debug
58+
59+ ####################################
60+ # Release Build (Optimized)
61+ ####################################
62+
63+ build:opt --compilation_mode=opt
64+ build:opt --strip=always
65+ build:opt --copt=-O3
66+ build:opt --define=NDEBUG=1
67+ build:opt --copt=-march=native
68+
69+ ####################################
70+ # Profile/Report Build
71+ ####################################
72+
73+ build:profile --compilation_mode=opt
74+ build:profile --copt=-O2
75+ build:profile --copt=-g
76+ build:profile --copt=-ftime-report
77+ build:profile --profile=profile.gz
78+ build:profile --generate_json_trace_profile
79+
80+ ####################################
81+ # Benchmark Build
82+ ####################################
83+
84+ build:benchmark --compilation_mode=opt
85+ build:benchmark --strip=always
86+ build:benchmark --define=NDEBUG=1
87+ build:benchmark --copt=-O3
88+ build:benchmark --copt=-march=native
89+
90+ test:benchmark --config=benchmark
91+
92+ ####################################
93+ # Code Coverage (LLVM Coverage)
94+ ####################################
95+
96+ coverage --combined_report=lcov
97+ coverage --instrumentation_filter="^lib/.*"
98+ coverage --experimental_use_llvm_covmap
99+ coverage --copt=-fprofile-instr-generate
100+ coverage --copt=-fcoverage-mapping
101+ coverage --copt=-ffile-prefix-map=$(PWD)=.
102+ coverage --copt=-fdebug-prefix-map=$(PWD)=.
103+ coverage --linkopt=-fprofile-instr-generate
104+ coverage --linkopt=-fcoverage-mapping
105+ coverage --experimental_generate_llvm_lcov
106+
107+ ####################################
108+ # Static Analysis (clang-tidy)
109+ ####################################
110+
111+ build:tidy --aspects=@bazel_tools//tools/cpp:cc_code_coverage.aspect
112+ build:tidy --features=layering_check
113+ build:tidy --copt=-fdiagnostics-color=always
114+
115+ ####################################
116+ # Linux with Homebrew LLVM
117+ ####################################
118+
119+ build:linux_llvm --action_env=CC=/opt/homebrew/opt/llvm/bin/clang
120+ build:linux_llvm --action_env=CXX=/opt/homebrew/opt/llvm/bin/clang++
121+ build:linux_llvm --action_env=BAZEL_USE_CPP_ONLY_TOOLCHAIN=1
122+ build:linux_llvm --cxxopt=-stdlib=libc++
123+ build:linux_llvm --linkopt=-fuse-ld=lld
124+ build:linux_llvm --platforms=@platforms//os:linux
125+ build:linux_llvm --cpu=x86_64
126+
127+ test:linux_llvm --config=linux_llvm
128+
129+ ####################################
130+ # Heap Dump on OOM
131+ ####################################
132+
133+ build --heap_dump_on_oom
134+
135+ ####################################
136+ # Query Output Format
137+ ####################################
51138
52- # A more useful default output mode for bazel query, which
53- # prints "ng_module rule //foo:bar" instead of just "//foo:bar".
54139query --output=label_kind
55140
56- ###############################
57- # Build Debug #
58- ###############################
59-
60- # build --compilation_mode=dbg --spawn_strategy=local
61-
62- ###############################
63- # Coverage #
64- ###############################
141+ ####################################
142+ # Output Filter
143+ ####################################
65144
66- # # Use Clang as the compiler
67- build --compiler=clang
68- build --collect_code_coverage
69- build --copt=-fprofile-instr-generate
70- build --copt=-fcoverage-mapping
71- build --linkopt=-fprofile-instr-generate
72- build --linkopt=-fcoverage-mapping
145+ # Suppresses most of the build output, leaving just the summary line
146+ # build --output_filter=^$ # Uncomment for cleaner output
0 commit comments