blob: da63f1acb60318fb31f79cec8fdb9f34dff3b945 [file] [edit]
# bazelrc file
common --downloader_config=bazel/downloader.cfg
common:bzlmod --enable_bzlmod
common:bzlmod --noenable_workspace
# Needed because bzlmod can break PEP 420 implicit workspace package.
# WORKSPACE seems unaffected, possibly because it doesn't do repo name mangling.
#
# See also https://github.com/bazel-contrib/rules_python/issues/55
#
# Error message: ModuleNotFoundError: No module named 'src.python'
# A list of tests that need this flag to pass:
#
# //src/python/grpcio_tests/tests_aio/interop:local_interop_test
# //src/python/grpcio_tests/tests_aio/reflection:reflection_servicer_test
# //src/python/grpcio_tests/tests_aio/unit:*
# //src/python/grpcio_tests/tests_py3_only/interop:xds_interop_client_test
# //src/python/grpcio_tests/tests/admin:admin_test
# //src/python/grpcio_tests/tests/csds:csds_test
# //src/python/grpcio_tests/tests/fork:fork_test
# //src/python/grpcio_tests/tests/interop:_insecure_intraop_test
# //src/python/grpcio_tests/tests/interop:_secure_intraop_test
# //src/python/grpcio_tests/tests/reflection:_reflection_client_test
# //src/python/grpcio_tests/tests/reflection:_reflection_servicer_test
build:python-bzlmod --incompatible_default_to_explicit_init_py
build:python-bzlmod --config=bzlmod # inherit bzlmod configuration
# Can be explicitly disable via --config=no-bzlmod
# TODO(weizheyuan): Remove this after migration is done.
common:no-bzlmod --noenable_bzlmod
common:no-bzlmod --enable_workspace
# Enable bzlmod by default.
common --config=bzlmod
# Bazel 8 needs this
common --incompatible_disallow_empty_glob=false
common --incompatible_disallow_struct_provider_syntax=false
# for platform-appropriate cxxopts
common --enable_platform_specific_config
build:windows --cxxopt='/std:c++17'
build:windows --host_cxxopt='/std:c++17'
build:linux --cxxopt='-std=c++17'
build:linux --host_cxxopt='-std=c++17'
build:macos --cxxopt='-std=c++17'
build:macos --host_cxxopt='-std=c++17'
build:freebsd --cxxopt='-std=c++17'
build:freebsd --host_cxxopt='-std=c++17'
# Don't trigger --config=<host platform> when cross-compiling.
build:android --noenable_platform_specific_config
build:ios --noenable_platform_specific_config
build --client_env=CC=clang
build --copt=-DGRPC_BAZEL_BUILD
build --host_copt=-DGRPC_BAZEL_BUILD
build --action_env=GRPC_BAZEL_RUNTIME=1
build:opt --compilation_mode=opt
build:opt --copt=-Wframe-larger-than=16384
build:dbg --compilation_mode=dbg
# Dynamic link cause issues like: `dyld: malformed mach-o: load commands size (59272) > 32768`
# https://github.com/bazelbuild/bazel/issues/9190
build:macos --dynamic_mode=off
build:windows_opt --compilation_mode=opt
build:windows_dbg --compilation_mode=dbg
build:clang-cl --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl
build:clang-cl --extra_execution_platforms=//:x64_windows-clang-cl
build:clang-cl --incompatible_enable_cc_toolchain_resolution
build:clang-cl --define=use_strict_warning_windows=true
build:clang-cl --compiler=clang-cl
build:asan --strip=never
build:asan --copt=-fsanitize=address
build:asan --copt=-O0
build:asan --copt=-fno-omit-frame-pointer
build:asan --copt=-DGRPC_ASAN
build:asan --copt=-DADDRESS_SANITIZER # used by absl
build:asan --linkopt=-fsanitize=address
build:asan --action_env=ASAN_OPTIONS=detect_leaks=1:color=always
build:asan --action_env=LSAN_OPTIONS=suppressions=test/core/test_util/lsan_suppressions.txt:report_objects=1
build:coverage --copt=-fprofile-instr-generate
build:coverage --copt=-fcoverage-mapping
build:coverage --linkopt=-fprofile-instr-generate
build:fork_support --cxxopt=-DGRPC_ENABLE_FORK_SUPPORT=1
build:fork_support --cxxopt=-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK=1
build:fork_support --action_env=GRPC_ENABLE_FORK_SUPPORT=1
# We have a separate ASAN config for macOS to workaround a couple of bugs:
# 1. https://github.com/bazelbuild/bazel/issues/6932
# _FORTIFY_SOURCE=1 is enabled by default on macOS, which breaks ASAN.
# We workaround it by setting _FORTIFY_SOURCE=0 and ignoring macro redefined
# warnings.
# 2. https://github.com/google/sanitizers/issues/1026
# LSAN is not supported by the version of Clang that ships with macOS, so
# we disable it.
build:asan_macos --strip=never
build:asan_macos --copt=-fsanitize=address
build:asan_macos --copt -Wno-macro-redefined
build:asan_macos --copt -D_FORTIFY_SOURCE=0
build:asan_macos --copt=-fsanitize=address
build:asan_macos --copt=-O0
build:asan_macos --copt=-fno-omit-frame-pointer
build:asan_macos --linkopt=-fsanitize=address
build:asan_macos --action_env=ASAN_OPTIONS=detect_leaks=0
build:asan_macos --dynamic_mode=off
build:msan --strip=never
build:msan --copt=-fsanitize=memory
build:msan --copt=-O0
build:msan --copt=-fsanitize-memory-track-origins
build:msan --copt=-fsanitize-memory-use-after-dtor
build:msan --copt=-fno-omit-frame-pointer
build:msan --linkopt=-fsanitize=memory
build:msan --action_env=MSAN_OPTIONS=poison_in_dtor=1
build:tsan --strip=never
build:tsan --copt=-fsanitize=thread
build:tsan --copt=-fno-omit-frame-pointer
build:tsan --copt=-DGRPC_TSAN
build:tsan --linkopt=-fsanitize=thread
build:tsan --action_env=TSAN_OPTIONS=suppressions=test/core/test_util/tsan_suppressions.txt:halt_on_error=1:second_deadlock_stack=1
build:tsan_macos --strip=never
build:tsan_macos --copt=-fsanitize=thread
build:tsan_macos --copt=-fno-omit-frame-pointer
build:tsan_macos --copt=-DGRPC_TSAN
build:tsan_macos --linkopt=-fsanitize=thread
build:tsan_macos --action_env=TSAN_OPTIONS=suppressions=test/core/test_util/tsan_suppressions.txt:halt_on_error=1:second_deadlock_stack=1
build:tsan_macos --dynamic_mode=off
build:ubsan --strip=never
build:ubsan --copt=-fsanitize=undefined
build:ubsan --copt=-fsanitize-link-c++-runtime
build:ubsan --copt=-fno-omit-frame-pointer
build:ubsan --copt=-DGRPC_UBSAN
build:ubsan --copt=-DNDEBUG
build:ubsan --copt=-fno-sanitize=function,vptr
build:ubsan --linkopt=-fsanitize=undefined
# avoid ubsan build error with int128 by linking against libc++
# see b/200667821
build:ubsan --linkopt=-fsanitize-link-c++-runtime
build:ubsan --linkopt=-lc++
build:ubsan --linkopt=-lc++abi
build:ubsan --linkopt=-lm
build:ubsan --action_env=UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1:suppressions=test/core/test_util/ubsan_suppressions.txt
# if you want to run ubsan locally, uncomment following three lines
# build:ubsan --linkopt=-lgcc_s
# build:ubsan --linkopt=-lubsan
# build:ubsan --linkopt=--rtlib=compiler-rt
build:python_single_threaded_unary_stream --test_env="GRPC_SINGLE_THREADED_UNARY_STREAM=true"
build:python --config=python-bzlmod
build:python --copt=-DGRPC_PYTHON_BUILD
# Compile database generation config
build:compdb --build_tag_filters=-nocompdb
build:compdb --skip_incompatible_explicit_targets
try-import %workspace%/tools/fuzztest.bazelrc
# OpenTelemetry C++ needs this option to build with absl
build --@io_opentelemetry_cpp//api:with_abseil
# Custom checks
test:postmortem --//:postmortem_checks=true