| # Bazel doesn't need more than 200MB of memory for local build based on memory profiling: |
| # https://docs.bazel.build/versions/master/skylark/performance.html#memory-profiling |
| # The default JVM max heapsize is 1/4 of physical memory up to 32GB which could be large |
| # enough to consume all memory constrained by cgroup in large host. |
| # Limiting JVM heapsize here to let it do GC more when approaching the limit to |
| # leave room for compiler/linker. |
| # The number 2G is chosen heuristically to both support large VM and small VM with RBE. |
| # Startup options cannot be selected via config. |
| startup --host_jvm_args=-Xmx2g |
| |
| run --color=yes |
| |
| build --color=yes |
| |
| build --host_force_python=PY3 |
| |
| # https://docs.bazel.build/versions/main/command-line-reference.html#flag--enable_platform_specific_config |
| # If true, Bazel picks up host-OS-specific config lines from bazelrc files. For example, if the host OS is Linux and |
| # you run bazel build, Bazel picks up lines starting with build:linux. Supported OS identifiers are linux, macos, |
| # windows, freebsd, and openbsd. Enabling this flag is equivalent to using --config=linux on Linux, |
| # --config=windows on Windows, etc. |
| build --enable_platform_specific_config |
| |
| build:windows --cxxopt=/std:c++14 |
| |
| build:macos --cxxopt=-std=c++11 |
| build:macos --strip=never |
| build:macos --copt -g |
| # Workaround, see https://github.com/grpc/grpc/issues/19645 |
| build:macos --copt -DGRPC_BAZEL_BUILD |
| |
| # Enable position independent code (this is the default on macOS and Windows) |
| # (Workaround for https://github.com/bazelbuild/rules_foreign_cc/issues/421) |
| build:linux --copt=-fPIC |
| build:linux --cxxopt=-std=c++11 |
| build:linux --strip=never |
| |
| # We already have absl in the build, define absl=1 to tell googletest to use absl for backtrace. |
| build --define absl=1 |
| build --define SPDLOG_FMT_EXTERNAL=1 |
| |
| # Pass PATH, CC, CXX and LLVM_CONFIG variables from the environment. |
| build --action_env=CC |
| build --action_env=CXX |
| build --action_env=LD_LIBRARY_PATH |
| build --action_env=LLVM_CONFIG |
| build --action_env=PATH |
| |
| build:linux --copt=-maes |
| |
| # Common flags for sanitizers |
| build:sanitizer --define tcmalloc=disabled |
| build:sanitizer --linkopt -ldl |
| build:sanitizer --build_tag_filters=-no_san |
| build:sanitizer --test_tag_filters=-no_san |
| |
| # Common flags for Clang |
| build:clang --action_env=BAZEL_COMPILER=clang |
| build:clang --linkopt=-fuse-ld=lld |
| |
| |
| # Address sanitizer |
| # To use it: bazel build --config=asan |
| build:asan --config=sanitizer |
| build:asan --compiler clang |
| build:asan --strip=never |
| build:asan --copt -fsanitize=address |
| # ASAN needs -O1 to get reasonable performance. |
| build:asan --copt -O1 |
| build:asan --copt -fno-optimize-sibling-calls |
| build:asan --copt -g |
| build:asan --copt -fno-omit-frame-pointer |
| build:asan --linkopt -fsanitize=address |
| build:asan --copt -DADDRESS_SANITIZER=1 |
| build:asan --copt -D__SANITIZE_ADDRESS__ |
| |
| # Clang ASAN/UBSAN |
| build:clang-asan --config=asan |
| build:clang-asan --linkopt -fuse-ld=lld |
| |
| build:macos-asan --config=asan |
| # Workaround, see https://github.com/bazelbuild/bazel/issues/6932 |
| build:macos-asan --copt -Wno-macro-redefined |
| build:macos-asan --copt -D_FORTIFY_SOURCE=0 |
| # Workaround, see https://github.com/bazelbuild/bazel/issues/4341 |
| build:macos-asan --copt -DGRPC_BAZEL_BUILD |
| # Dynamic link cause issues like: `dyld: malformed mach-o: load commands size (59272) > 32768` |
| build:macos-asan --dynamic_mode=off |
| |
| # Thread sanitizer |
| # bazel build --config=tsan |
| build:tsan --config=sanitizer |
| build:tsan --compiler clang |
| build:tsan --strip=never |
| build:tsan --copt -fsanitize=thread |
| build:tsan --copt -DTHREAD_SANITIZER |
| build:tsan --copt -DDYNAMIC_ANNOTATIONS_ENABLED=1 |
| build:tsan --copt -DDYNAMIC_ANNOTATIONS_EXTERNAL_IMPL=1 |
| build:tsan --copt -O1 |
| build:tsan --copt -fno-omit-frame-pointer |
| build:tsan --linkopt -fsanitize=thread |
| |
| # --config msan: Memory sanitizer |
| build:msan --compiler clang |
| build:msan --strip=never |
| build:msan --copt -fsanitize=memory |
| build:msan --copt -DADDRESS_SANITIZER |
| build:msan --copt -O1 |
| build:msan --copt -fno-omit-frame-pointer |
| build:msan --linkopt -fsanitize=memory |
| |
| # --config ubsan: Undefined Behavior Sanitizer |
| build:ubsan --compiler clang |
| build:ubsan --strip=never |
| build:ubsan --copt -fsanitize=undefined |
| build:ubsan --copt -O1 |
| build:ubsan --copt -fno-omit-frame-pointer |
| build:ubsan --linkopt -fsanitize=undefined |
| build:ubsan --linkopt -lubsan |
| |
| # Coverage options |
| coverage --config=coverage |
| # 1.5x original timeout + 300s for trace merger in all categories |
| build:coverage --test_timeout=390,750,1500,5700 |
| build:coverage --define=dynamic_link_tests=true |
| build:coverage --combined_report=lcov |
| build:coverage --strategy=TestRunner=sandboxed,local |
| build:coverage --strategy=CoverageReport=sandboxed,local |
| build:coverage --collect_code_coverage |
| build:coverage --instrumentation_filter="//source[/:],//include[/:],-//source/base/mocks[/:],-//source/client/mocks[/:],-//source/rocketmq/mocks[/:]" |
| |
| test --test_output=errors |
| |
| # RBE |
| build:remote --bes_results_url=https://app.buildbuddy.io/invocation/ |
| build:remote --bes_backend=grpcs://remote.buildbuddy.io |
| build:remote --remote_cache=grpcs://remote.buildbuddy.io |
| build:remote --remote_timeout=3600 |
| build:remote --grpc_keepalive_time=360s |
| build:remote --grpc_keepalive_timeout=360s |
| build:remote --remote_executor=grpcs://remote.buildbuddy.io |
| build:remote --host_platform=@buildbuddy_toolchain//:platform |
| build:remote --platforms=@buildbuddy_toolchain//:platform |
| build:remote --extra_execution_platforms=@buildbuddy_toolchain//:platform |
| build:remote --crosstool_top=@buildbuddy_toolchain//:toolchain |
| build:remote --extra_toolchains=@buildbuddy_toolchain//:cc_toolchain |
| build:remote --jobs=250 |
| build:remote --remote_download_minimal |
| build:remote --experimental_remote_cache_compression |
| build:remote --experimental_remote_cache_async |
| build:remote --spawn_strategy=remote |
| # try-import %workspace%/user.bazelrc |