Upgrade most builds to use Bazel 9.0.0

Keep one build on 8.5.1 to test WORKSPACE

Fixes the -Wdeprecated-declaration warnings
enabled by default in Bazel 9 that come from the
single-arg Invoke().

Fixes the new -Winconsistent-missing-override that
we intentionally use in a test.

Upgrades RE2 to a version compatible with Bazel 9.

PiperOrigin-RevId: 865966282
Change-Id: I5f7c3b60daf5f8a90be08004d96aaa59611e35c4
This commit is contained in:
Derek Mauro 2026-02-05 08:42:21 -08:00 committed by Copybara-Service
parent 32c3dce34b
commit 5a9c3f9e8d
7 changed files with 18 additions and 11 deletions

View File

@ -49,7 +49,7 @@ bazel_dep(
)
bazel_dep(
name = "re2",
version = "2024-07-02.bcr.1",
version = "2025-11-05.bcr.1",
)
bazel_dep(

View File

@ -129,7 +129,7 @@ for std in ${STD}; do
--rm \
--env="CC=/usr/local/bin/gcc" \
--env="BAZEL_CXXOPTS=-std=${std}" \
--env="USE_BAZEL_VERSION=8.5.1" \
--env="USE_BAZEL_VERSION=9.0.0" \
${DOCKER_EXTRA_ARGS:-} \
${LINUX_LATEST_CONTAINER} \
/bin/bash --login -c "
@ -158,7 +158,7 @@ for std in ${STD}; do
--rm \
--env="CC=/opt/llvm/bin/clang" \
--env="BAZEL_CXXOPTS=-std=${std}" \
--env="USE_BAZEL_VERSION=8.5.1" \
--env="USE_BAZEL_VERSION=9.0.0" \
${DOCKER_EXTRA_ARGS:-} \
${LINUX_LATEST_CONTAINER} \
/bin/bash --login -c "

View File

@ -61,7 +61,7 @@ done
# Test the Bazel build
# If we are running on Kokoro, check for a versioned Bazel binary.
KOKORO_GFILE_BAZEL_BIN="bazel-8.5.1-darwin-x86_64"
KOKORO_GFILE_BAZEL_BIN="bazel-9.0.0-darwin-x86_64"
if [[ ${KOKORO_GFILE_DIR:-} ]] && [[ -f ${KOKORO_GFILE_DIR}/${KOKORO_GFILE_BAZEL_BIN} ]]; then
BAZEL_BIN="${KOKORO_GFILE_DIR}/${KOKORO_GFILE_BAZEL_BIN}"
chmod +x ${BAZEL_BIN}

View File

@ -1,6 +1,6 @@
SETLOCAL ENABLEDELAYEDEXPANSION
SET BAZEL_EXE=%KOKORO_GFILE_DIR%\bazel-8.5.1-windows-x86_64.exe
SET BAZEL_EXE=%KOKORO_GFILE_DIR%\bazel-9.0.0-windows-x86_64.exe
SET PATH=C:\Python34;%PATH%
SET BAZEL_PYTHON=C:\python34\python.exe

View File

@ -35,6 +35,13 @@
// Silence C4503 (decorated name length exceeded) for MSVC.
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4503)
#ifdef __clang__
#pragma clang diagnostic push
// This file intentionally tests many ways of writing Mock classes, including
// with and without the override keyword.
#pragma clang diagnostic ignored "-Winconsistent-missing-override"
#endif
#ifdef GTEST_OS_WINDOWS
// MSDN says the header file to be included for STDMETHOD is BaseTyps.h but
// we are getting compiler errors if we use basetyps.h, hence including

View File

@ -327,7 +327,7 @@ TEST(LinkTest, TestInvoke) {
InvokeHelper test_invoke_helper;
EXPECT_CALL(mock, VoidFromString(_))
.WillOnce(Invoke(&InvokeHelper::StaticVoidFromString))
.WillOnce(&InvokeHelper::StaticVoidFromString)
.WillOnce(Invoke(&test_invoke_helper, &InvokeHelper::VoidFromString));
mock.VoidFromString(nullptr);
mock.VoidFromString(nullptr);
@ -360,7 +360,7 @@ TEST(LinkTest, TestWithArg) {
Mock mock;
EXPECT_CALL(mock, VoidFromString(_))
.WillOnce(WithArg<0>(Invoke(&InvokeHelper::StaticVoidFromString)));
.WillOnce(WithArg<0>(&InvokeHelper::StaticVoidFromString));
mock.VoidFromString(nullptr);
}
@ -369,7 +369,7 @@ TEST(LinkTest, TestWithArgs) {
Mock mock;
EXPECT_CALL(mock, VoidFromString(_))
.WillOnce(WithArgs<0>(Invoke(&InvokeHelper::StaticVoidFromString)));
.WillOnce(WithArgs<0>(&InvokeHelper::StaticVoidFromString));
mock.VoidFromString(nullptr);
}

View File

@ -9,9 +9,9 @@ def googletest_deps():
if not native.existing_rule("re2"):
http_archive(
name = "re2",
sha256 = "eb2df807c781601c14a260a507a5bb4509be1ee626024cb45acbd57cb9d4032b",
strip_prefix = "re2-2024-07-02",
urls = ["https://github.com/google/re2/releases/download/2024-07-02/re2-2024-07-02.tar.gz"],
sha256 = "87f6029d2f6de8aa023654240a03ada90e876ce9a4676e258dd01ea4c26ffd67",
strip_prefix = "re2-2025-11-05",
urls = ["https://github.com/google/re2/releases/download/2025-11-05/re2-2025-11-05.tar.gz"],
)
if not native.existing_rule("abseil-cpp"):