From 5a9c3f9e8d9b90bbbe8feb32902146cb8f7c1757 Mon Sep 17 00:00:00 2001 From: Derek Mauro Date: Thu, 5 Feb 2026 08:42:21 -0800 Subject: [PATCH] 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 --- MODULE.bazel | 2 +- ci/linux-presubmit.sh | 4 ++-- ci/macos-presubmit.sh | 2 +- ci/windows-presubmit.bat | 2 +- googlemock/test/gmock-function-mocker_test.cc | 7 +++++++ googlemock/test/gmock_link_test.h | 6 +++--- googletest_deps.bzl | 6 +++--- 7 files changed, 18 insertions(+), 11 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index c07e6a93..8f46b66b 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -49,7 +49,7 @@ bazel_dep( ) bazel_dep( name = "re2", - version = "2024-07-02.bcr.1", + version = "2025-11-05.bcr.1", ) bazel_dep( diff --git a/ci/linux-presubmit.sh b/ci/linux-presubmit.sh index 54419dce..c598c573 100644 --- a/ci/linux-presubmit.sh +++ b/ci/linux-presubmit.sh @@ -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 " diff --git a/ci/macos-presubmit.sh b/ci/macos-presubmit.sh index 408f8f86..f330f4f8 100644 --- a/ci/macos-presubmit.sh +++ b/ci/macos-presubmit.sh @@ -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} diff --git a/ci/windows-presubmit.bat b/ci/windows-presubmit.bat index 2bfc4cd9..6cbbba2a 100644 --- a/ci/windows-presubmit.bat +++ b/ci/windows-presubmit.bat @@ -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 diff --git a/googlemock/test/gmock-function-mocker_test.cc b/googlemock/test/gmock-function-mocker_test.cc index c3719f9a..2b54e5b6 100644 --- a/googlemock/test/gmock-function-mocker_test.cc +++ b/googlemock/test/gmock-function-mocker_test.cc @@ -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 diff --git a/googlemock/test/gmock_link_test.h b/googlemock/test/gmock_link_test.h index cb5179b2..41bfba05 100644 --- a/googlemock/test/gmock_link_test.h +++ b/googlemock/test/gmock_link_test.h @@ -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); } diff --git a/googletest_deps.bzl b/googletest_deps.bzl index 13770005..351b901b 100644 --- a/googletest_deps.bzl +++ b/googletest_deps.bzl @@ -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"):