• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# TODO: ErrorProne's SelfAssertions are violated in tests
2build --javacopt=-Xep:SelfAssertion:WARN
3
4build:dbg --compilation_mode=dbg
5
6build:opt --compilation_mode=opt
7
8build:san-common --config=dbg --strip=never --copt=-O0 --copt=-fno-omit-frame-pointer
9
10build:asan --config=san-common --copt=-fsanitize=address --linkopt=-fsanitize=address
11# ASAN hits ODR violations with shared linkage due to rules_proto.
12build:asan --dynamic_mode=off
13
14build:msan --config=san-common --copt=-fsanitize=memory --linkopt=-fsanitize=memory
15build:msan --copt=-fsanitize-memory-track-origins
16build:msan --copt=-fsanitize-memory-use-after-dtor
17build:msan --action_env=MSAN_OPTIONS=poison_in_dtor=1
18
19# Use our instrumented LLVM libc++ in Kokoro.
20build:docker-msan --config=msan
21build:docker-msan --linkopt=-L/opt/libcxx_msan/lib --linkopt=-lc++abi
22build:docker-msan --linkopt=-Wl,-rpath,/opt/libcxx_msan/lib
23build:docker-msan --cxxopt=-stdlib=libc++ --linkopt=-stdlib=libc++
24
25
26build:tsan --config=san-common --copt=-fsanitize=thread --linkopt=-fsanitize=thread
27
28build:ubsan --config=san-common --copt=-fsanitize=undefined --linkopt=-fsanitize=undefined
29build:ubsan --action_env=UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1
30# Workaround for the fact that Bazel links with $CC, not $CXX
31# https://github.com/bazelbuild/bazel/issues/11122#issuecomment-613746748
32build:ubsan --copt=-fno-sanitize=function --copt=-fno-sanitize=vptr
33# Abseil passes nullptr to memcmp with 0 size
34build:ubsan --copt=-fno-sanitize=nonnull-attribute
35
36# Workaround Bazel 7 remote cache issues.
37# See https://github.com/bazelbuild/bazel/issues/20161
38build --experimental_remote_cache_eviction_retries=5
39build --remote_download_outputs=all
40
41# Build with all --incompatible flags that we can. This helps us prepare for
42# upcoming breaking changes in Bazel. This list was generated for Bazel 6 by
43# running bazelisk with the --migrate flag and filtering out all flags that
44# default to true or are deprecated.
45build --incompatible_check_sharding_support
46build --incompatible_default_to_explicit_init_py
47build --incompatible_disable_native_android_rules
48build --incompatible_disable_target_provider_fields
49build --incompatible_disallow_empty_glob
50build --incompatible_dont_use_javasourceinfoprovider
51build --incompatible_enable_android_toolchain_resolution
52build --incompatible_enable_apple_toolchain_resolution
53build --incompatible_exclusive_test_sandboxed
54build --incompatible_remote_output_paths_relative_to_input_root
55build --incompatible_remote_use_new_exit_code_for_lost_inputs
56build --incompatible_sandbox_hermetic_tmp
57build --incompatible_struct_has_no_methods
58build --incompatible_top_level_aspects_require_providers
59build --incompatible_use_cc_configure_from_rules_cc
60build --incompatible_use_host_features
61
62# We cannot yet build successfully with the following flags:
63#   --incompatible_check_testonly_for_output_files
64#   --incompatible_config_setting_private_default_visibility
65#   --incompatible_disable_starlark_host_transitions
66#   --incompatible_disallow_struct_provider_syntax
67#   --incompatible_no_implicit_file_export
68#   --incompatible_no_rule_outputs_param
69#   --incompatible_stop_exporting_language_modules
70#   --incompatible_strict_action_env
71#   --incompatible_visibility_private_attributes_at_definition
72
73# We might be compatible with these flags, but they are not available in all
74# Bazel versions we are currently using:
75#   --incompatible_disable_objc_library_transition
76#   --incompatible_fail_on_unknown_attributes
77#   --incompatible_merge_fixed_and_default_shell_env
78
79# TODO: migrate all dependencies from WORKSPACE to MODULE.bazel
80# https://github.com/protocolbuffers/protobuf/issues/14313
81common --noenable_bzlmod
82
83# Important: this flag ensures that we remain compliant with the C++ layering
84# check.
85build --features=layering_check
86