mirror of
https://github.com/protocolbuffers/protobuf
synced 2026-08-26 02:23:14 -04:00
Currently if you build with `--incompatible_enable_proto_toolchain_resolution`
(on by default in Bazel 9) on main or any recent Git commit, you end up using
an old v33.0 prebuilt protoc binary. The `authenticity_validation` rule does
not catch this, because it just checks that the `RELEASE_VERSION` prebuilt we
downloaded has version `RELEASE_VERSION`. This constant is never updated in
Git, only in releases published to BCR. As a result, we get mysterious compiler
errors rather than a clear error about what is going wrong.
This commit fixes the problem by keeping `RELEASE_VERSION` up to date with the
existing `PROTOC_VERSION`. This will cause the build to fail loudly if you try
to use a prebuilt protoc binary with a protobuf Git checkout. To make sure that
developers do not hit this issue, I updated .bazelrc to explicitly turn off use
of the prebuilt protoc.
I also removed `examples/example_without_cc_toolchain/`, because I don't think
this test is doing anything useful anymore. It attempts to exercise the
prebuilt protoc, but that is something we do not expect to work correctly with
unreleased protobuf code, and with my change it would result in a build error.
Closes #28167
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/28167 from protocolbuffers:prebuilt d7c67c9ce7
PiperOrigin-RevId: 943511369
53 lines
2.4 KiB
Text
53 lines
2.4 KiB
Text
build --cxxopt=-std=c++17 --host_cxxopt=-std=c++17
|
|
|
|
# TODO: ErrorProne's SelfAssertions are violated in protobuf's test
|
|
build --javacopt=-Xep:SelfAssertion:WARN
|
|
|
|
# Disable prebuilt protoc on CI. On both main and release branches,
|
|
# PROTOBUF_VERSION ordinarily points to the next release, which doesn't
|
|
# exist and therefore doesn't have a prebuilt yet.
|
|
build --@com_google_protobuf//bazel/toolchains:prefer_prebuilt_protoc=false
|
|
|
|
# This flag works around some issues with Rust linking.
|
|
build --@rules_rust//rust/settings:experimental_use_cc_common_link=True
|
|
|
|
build:dbg --compilation_mode=dbg
|
|
|
|
build:opt --compilation_mode=opt
|
|
|
|
build:san-common --config=dbg --strip=never --copt=-O0 --copt=-fno-omit-frame-pointer
|
|
|
|
build:asan --config=san-common --copt=-fsanitize=address --linkopt=-fsanitize=address
|
|
# ASAN hits ODR violations with shared linkage due to rules_proto.
|
|
build:asan --dynamic_mode=off
|
|
|
|
build:msan --config=san-common --copt=-fsanitize=memory --linkopt=-fsanitize=memory
|
|
build:msan --copt=-fsanitize-memory-track-origins
|
|
build:msan --copt=-fsanitize-memory-use-after-dtor
|
|
build:msan --action_env=MSAN_OPTIONS=poison_in_dtor=1
|
|
|
|
build:tsan --config=san-common --copt=-fsanitize=thread --linkopt=-fsanitize=thread
|
|
|
|
build:ubsan --config=san-common --copt=-fsanitize=undefined --linkopt=-fsanitize=undefined
|
|
build:ubsan --action_env=UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1
|
|
# Workaround for the fact that Bazel links with $CC, not $CXX
|
|
# https://github.com/bazelbuild/bazel/issues/11122#issuecomment-613746748
|
|
build:ubsan --copt=-fno-sanitize=function --copt=-fno-sanitize=vptr
|
|
# Abseil passes nullptr to memcmp with 0 size
|
|
build:ubsan --copt=-fno-sanitize=nonnull-attribute
|
|
|
|
# Important: this flag ensures that we remain compliant with the C++ layering
|
|
# check.
|
|
build --features=layering_check
|
|
|
|
common --enable_platform_specific_config
|
|
|
|
common --incompatible_check_testonly_for_output_files
|
|
|
|
# Import Bazel 9 specific flags (such as --repo_contents_cache)
|
|
# TODO: Remove it when --repo_contents_cache issue
|
|
# has been resolved in bazel
|
|
try-import-if-bazel-version >=9.0.0 %workspace%/ci/bazel9.bazelrc
|
|
|
|
# Use clang-cl by default on Windows (see https://github.com/protocolbuffers/protobuf/issues/20085).
|
|
build:windows --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl --extra_execution_platforms=//build_defs:x64_windows-clang-cl --host_platform=//build_defs:x64_windows-clang-cl
|