Skip to content

Commit 8a35249

Browse files
committed
Add support for bazel 9.x
This doesn't flip the default bazel version, but instead makes this repo compatible with the current version and bazel 9.x. The primary changes for 9.x support are adding new load statements for things that were previously built in. This cascaded into a few dep updates to pull in their missing load statement fixes.
1 parent 6efbc12 commit 8a35249

19 files changed

Lines changed: 415 additions & 42 deletions

File tree

.bazelci/presubmit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# LINT.IfChange(bazelci_presubmit)
22
matrix:
33
platform: ["debian10", "macos", "macos_arm64", "ubuntu2004", "windows"]
4-
bazel: [8.x]
4+
bazel: [8.x, 9.x]
55

66
tasks:
77
verify_targets:

.bazelrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,7 @@ build --features=layering_check
3737

3838
common --enable_platform_specific_config
3939

40+
common --incompatible_check_testonly_for_output_files
41+
4042
# Use clang-cl by default on Windows (see https://github.com/protocolbuffers/protobuf/issues/20085).
4143
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

.bcr/presubmit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ bcr_test_module:
33
module_path: examples
44
matrix:
55
platform: ["debian10", "macos", "macos_arm64", "ubuntu2004", "windows"]
6-
bazel: [8.x]
6+
bazel: [8.x, 9.x]
77

88
tasks:
99
verify_targets:

.github/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
load("@build_bazel_apple_support//xcode:xcode_config.bzl", "xcode_config")
2+
load("@build_bazel_apple_support//xcode:xcode_version.bzl", "xcode_version")
3+
14
# This information is extracted from the MacOS runner specs located at:
25
# https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md
36
#

MODULE.bazel

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,10 @@ module(
1313
# https://bazel.build/versions/6.0.0/build/bzlmod#version-resolution
1414
# Thus the highest version in their module graph is resolved.
1515

16-
bazel_dep(name = "apple_support", version = "1.15.1", repo_name = "build_bazel_apple_support")
16+
bazel_dep(name = "apple_support", version = "1.16.0", repo_name = "build_bazel_apple_support")
1717

18-
# Keep apple_support on 1.15.1 for now to avoid this issue:
19-
# https://github.com/bazelbuild/apple_support/issues/316
20-
single_version_override(
21-
module_name = "apple_support",
22-
version = "1.15.1",
23-
)
18+
# Unused but must be pinned to avoid old broken versions
19+
bazel_dep(name = "rules_proto", version = "7.1.0")
2420

2521
#ifndef PROTO2_OPENSOURCE
2622
# LINT.IfChange
@@ -36,16 +32,16 @@ bazel_dep(name = "zlib", version = "1.3.1.bcr.5")
3632
# other dependencies
3733
bazel_dep(name = "bazel_features", version = "1.33.0", repo_name = "proto_bazel_features")
3834
bazel_dep(name = "bazel_skylib", version = "1.9.0")
39-
bazel_dep(name = "jsoncpp", version = "1.9.6")
35+
bazel_dep(name = "jsoncpp", version = "1.9.6.bcr.1")
4036
bazel_dep(name = "rules_java", version = "8.6.1")
4137
bazel_dep(name = "rules_jvm_external", version = "6.7")
42-
bazel_dep(name = "rules_kotlin", version = "1.9.6")
38+
bazel_dep(name = "rules_kotlin", version = "2.2.2")
4339
bazel_dep(name = "rules_license", version = "1.0.0")
4440
bazel_dep(name = "rules_pkg", version = "1.0.1")
4541
bazel_dep(name = "rules_python", version = "1.6.0")
4642
bazel_dep(name = "rules_rust", version = "0.63.0")
4743

48-
bazel_dep(name = "rules_ruby", version = "0.17.3", dev_dependency = True)
44+
bazel_dep(name = "rules_ruby", version = "0.20.1", dev_dependency = True)
4945

5046
# Workaround for https://github.com/bazelbuild/bazel-central-registry/issues/4230
5147
# rules_fuzzing 0.5.3 is not yet available in BCR.
@@ -65,12 +61,11 @@ single_version_override(
6561
patch_strip = 1,
6662
patches = [
6763
"@com_google_protobuf//:Disable_bundle_install.patch",
68-
"@com_google_protobuf//:Neverlink_jruby_jars.patch",
6964
],
70-
version = "0.17.3",
7165
)
7266

73-
bazel_dep(name = "rules_shell", version = "0.2.0")
67+
bazel_dep(name = "aspect_bazel_lib", version = "2.22.5")
68+
bazel_dep(name = "rules_shell", version = "0.6.1")
7469
bazel_dep(name = "platforms", version = "0.0.11")
7570

7671
# Ruby toolchains
@@ -267,7 +262,7 @@ protobuf_maven_dev.install(
267262
)
268263
use_repo(protobuf_maven_dev, "protobuf_maven_dev")
269264

270-
bazel_dep(name = "googletest", version = "1.15.2", dev_dependency = True)
265+
bazel_dep(name = "googletest", version = "1.17.0.bcr.2", dev_dependency = True)
271266
bazel_dep(name = "rules_buf", version = "0.3.0", dev_dependency = True)
272267
bazel_dep(name = "rules_testing", version = "0.9.0", dev_dependency = True)
273268
bazel_dep(
@@ -302,6 +297,7 @@ archive_override(
302297
"@com_google_protobuf//:patches/protobuf_v25/0005-Make-rules_ruby-a-dev-only-dependency.patch",
303298
"@com_google_protobuf//:patches/protobuf_v25/0006-Add-repo_name.patch",
304299
"@com_google_protobuf//:patches/protobuf_v25/0007-Java-bazel8.patch",
300+
"@com_google_protobuf//:patches/protobuf_v25/0008-bazel9.patch",
305301
],
306302
strip_prefix = "protobuf-25.0",
307303
urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v25.0/protobuf-25.0.tar.gz"],
@@ -314,6 +310,7 @@ archive_override(
314310
patch_strip = 1,
315311
patches = [
316312
"@com_google_protobuf//:patches/protobuf_v29/0001-Update-module-name.patch",
313+
"@com_google_protobuf//:patches/protobuf_v29/0002-bazel9.patch",
317314
],
318315
strip_prefix = "protobuf-29.0",
319316
urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v29.0/protobuf-29.0.tar.gz"],

Neverlink_jruby_jars.patch

Lines changed: 0 additions & 16 deletions
This file was deleted.

bazel/private/file_concat/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
2+
13
cc_binary(
24
name = "file_concat",
35
srcs = [

bazel/tests/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
2+
load("@rules_cc//cc:cc_test.bzl", "cc_test")
23
load("//bazel:proto_descriptor_set.bzl", "proto_descriptor_set")
34
load("//bazel:proto_library.bzl", "proto_library")
45
load(":bazel_proto_library_tests.bzl", "bazel_proto_library_test_suite")

bazel/tests/bazel_proto_library_tests.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ def _test_experimental_proto_descriptor_sets_include_source_info(name):
649649
name = name,
650650
target = name + "_a_proto",
651651
impl = _test_experimental_proto_descriptor_sets_include_source_info_impl,
652-
config_settings = {"//bazel/flags:experimental_proto_descriptor_sets_include_source_info": True},
652+
config_settings = {"@@//bazel/flags:experimental_proto_descriptor_sets_include_source_info": True},
653653
)
654654

655655
def _test_experimental_proto_descriptor_sets_include_source_info_impl(env, target):

cmake/dependencies.cmake

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,28 @@ if(${CMAKE_VERSION} VERSION_GREATER 3.16 OR ${CMAKE_VERSION} VERSION_EQUAL 3.16)
1010
include_guard()
1111
endif()
1212

13-
set(apple_support-version "1.15.1")
13+
set(apple_support-version "1.16.0")
14+
set(rules_proto-version "7.1.0")
1415
set(abseil-cpp-version "20250512.1")
1516
set(rules_cc-version "0.0.17")
16-
set(zlib-version "1.3.1.bcr.5")
17+
set(zlib-version "1.3.1")
1718
set(bazel_features-version "1.33.0")
1819
set(bazel_skylib-version "1.9.0")
1920
set(jsoncpp-version "1.9.6")
2021
set(rules_java-version "8.6.1")
2122
set(rules_jvm_external-version "6.7")
22-
set(rules_kotlin-version "1.9.6")
23+
set(rules_kotlin-version "2.2.2")
2324
set(rules_license-version "1.0.0")
2425
set(rules_pkg-version "1.0.1")
2526
set(rules_python-version "1.6.0")
2627
set(rules_rust-version "0.63.0")
27-
set(rules_ruby-version "0.17.3")
28+
set(rules_ruby-version "0.20.1")
2829
set(rules_fuzzing-version "0.5.3")
29-
set(rules_shell-version "0.2.0")
30+
set(aspect_bazel_lib-version "2.22.5")
31+
set(rules_shell-version "0.6.1")
3032
set(platforms-version "0.0.11")
31-
set(re2-version "2024-07-02.bcr.1")
32-
set(googletest-version "1.15.2")
33+
set(re2-version "2024-07-02")
34+
set(googletest-version "1.17.0")
3335
set(rules_buf-version "0.3.0")
3436
set(rules_testing-version "0.9.0")
3537
set(abseil-py-version "2.1.0")

0 commit comments

Comments
 (0)