Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,34 @@ module(
)

bazel_dep(name = "platforms", version = "0.0.11")
bazel_dep(name = "rules_cc", version = "0.0.15")
bazel_dep(name = "rules_cc", version = "0.2.8")
bazel_dep(name = "bazel_features", version = "1.30.0")
bazel_dep(name = "bazel_skylib", version = "1.6.1")
bazel_dep(name = "protobuf", version = "27.0", repo_name = "com_google_protobuf")
bazel_dep(name = "protobuf", version = "32.1", repo_name = "com_google_protobuf")
bazel_dep(name = "zlib", version = "1.3.1.bcr.5")

# Required by @remote_java_tools, which is loaded via module extension.
bazel_dep(name = "rules_license", version = "0.0.3")
bazel_dep(name = "abseil-cpp", version = "20230802.1", repo_name = "com_google_absl")
bazel_dep(name = "abseil-cpp", version = "20250814.0", repo_name = "com_google_absl")

# TODO: Remove this override after the next release of abseil-cpp.
single_version_override(
module_name = "abseil-cpp",
patch_strip = 1,
patches = [
"//third_party:abseil-cpp_load-cc-rules.patch",
],
version = "20250814.0",
)

single_version_override(
module_name = "protobuf",
patch_strip = 1,
patches = [
"//third_party:protobuf_load-cc-rules.patch",
],
version = "32.1",
)

register_toolchains("//toolchains:all")

Expand Down Expand Up @@ -97,9 +116,9 @@ use_repo(compat, "compatibility_proxy")

# Dev dependencies
bazel_dep(name = "rules_pkg", version = "0.9.1", dev_dependency = True)
bazel_dep(name = "stardoc", version = "0.7.1", dev_dependency = True)
bazel_dep(name = "stardoc", version = "0.8.0", dev_dependency = True)
bazel_dep(name = "rules_shell", version = "0.2.0", dev_dependency = True)
bazel_dep(name = "rules_testing", version = "0.7.0", dev_dependency = True)
bazel_dep(name = "rules_testing", dev_dependency = True)
archive_override(
module_name = "rules_testing",
integrity = "sha256-0+3pLjeZCqn+K1qS7HNr7HbwMXBjxLvJm+pMSUhDel8=",
Expand Down
Empty file added third_party/BUILD
Empty file.
36 changes: 36 additions & 0 deletions third_party/abseil-cpp_load-cc-rules.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
From 2370ccf579bd0fb4484c343389b8121c6b7f9bb8 Mon Sep 17 00:00:00 2001
From: Keith Smiley <keithbsmiley@gmail.com>
Date: Sat, 20 Sep 2025 20:02:06 -0700
Subject: [PATCH] PR #1939: Add missing rules_cc loads

Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1939

This is required for use with bazel past this commit: https://github.com/bazelbuild/bazel/commit/71ca0ed111ff3d842a0d23bc3a46bd2e6745491d

Most files do this already these were just missing

Merge f7d58947afdb0549c9e5c287a5e5851a7d72e1e0 into 620d600442769b7ec4b61bd87667899908eec4ef

Merging this change closes #1939

COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1939 from keith:ks/add-missing-rules_cc-loads f7d58947afdb0549c9e5c287a5e5851a7d72e1e0
PiperOrigin-RevId: 809556509
Change-Id: I494a118b851685a03393485514a3b6fbe3a10597
---
absl/debugging/BUILD.bazel | 3 +++
1 file changed, 3 insertions(+)

diff --git a/absl/debugging/BUILD.bazel b/absl/debugging/BUILD.bazel
index ed7cc493e90..7cc053e783e 100644
--- a/absl/debugging/BUILD.bazel
+++ b/absl/debugging/BUILD.bazel
@@ -14,6 +14,9 @@
# limitations under the License.
#

+load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
+load("@rules_cc//cc:cc_library.bzl", "cc_library")
+load("@rules_cc//cc:cc_test.bzl", "cc_test")
load(
"//absl:copts/configure_copts.bzl",
"ABSL_DEFAULT_COPTS",
157 changes: 157 additions & 0 deletions third_party/protobuf_load-cc-rules.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
Backported from https://github.com/protocolbuffers/protobuf/pull/23584 to 32.0:

From 733a0ccf6f53f469352b19440a1d152eccea6bec Mon Sep 17 00:00:00 2001
From: Keith Smiley <keithbsmiley@gmail.com>
Date: Sat, 20 Sep 2025 09:30:37 -0700
Subject: [PATCH] bazel: add missing rules_cc loads

This is required for use with bazel after this commit https://github.com/bazelbuild/bazel/commit/71ca0ed111ff3d842a0d23bc3a46bd2e6745491d

Many files have these already
---
lua/BUILD.bazel | 3 +++
pkg/test/BUILD.bazel | 1 +
ruby/ext/google/protobuf_c/BUILD.bazel | 1 +
ruby/lib/google/BUILD.bazel | 1 +
rust/defs.bzl | 1 +
src/google/protobuf/compiler/cpp/BUILD.bazel | 1 +
src/google/protobuf/compiler/java/full/BUILD.bazel | 1 +
src/google/protobuf/compiler/java/lite/BUILD.bazel | 1 +
src/google/protobuf/compiler/kotlin/BUILD.bazel | 1 +
src/google/protobuf/compiler/php/BUILD.bazel | 1 +
src/google/protobuf/compiler/rust/BUILD.bazel | 2 ++
toolchain/BUILD.bazel | 2 ++
12 files changed, 16 insertions(+)

diff --git a/lua/BUILD.bazel b/lua/BUILD.bazel
index 389e5da7635ca..db956713bd849 100644
--- a/lua/BUILD.bazel
+++ b/lua/BUILD.bazel
@@ -5,6 +5,9 @@
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd

+load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
+load("@rules_cc//cc:cc_library.bzl", "cc_library")
+load("@rules_cc//cc:cc_test.bzl", "cc_test")
load("//bazel:proto_library.bzl", "proto_library")
load(
"//lua:lua_proto_library.bzl",
diff --git a/pkg/test/BUILD.bazel b/pkg/test/BUILD.bazel
index d0954f0126ba2..4fd01c9759643 100644
--- a/pkg/test/BUILD.bazel
+++ b/pkg/test/BUILD.bazel
@@ -1,5 +1,6 @@
# Tests for CMake file list generation

+load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_shell//shell:sh_test.bzl", "sh_test")
load("//pkg:build_systems.bzl", "gen_file_lists")
load("//pkg:cc_dist_library.bzl", "cc_dist_library")
diff --git a/ruby/ext/google/protobuf_c/BUILD.bazel b/ruby/ext/google/protobuf_c/BUILD.bazel
index 00458e2eedbe4..63276d538cc5c 100644
--- a/ruby/ext/google/protobuf_c/BUILD.bazel
+++ b/ruby/ext/google/protobuf_c/BUILD.bazel
@@ -1,4 +1,5 @@
load("@build_bazel_rules_apple//apple:apple_binary.bzl", "apple_binary")
+load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
load("//upb/cmake:build_defs.bzl", "staleness_test")

diff --git a/ruby/lib/google/BUILD.bazel b/ruby/lib/google/BUILD.bazel
index db0d7cd6b89bc..157df81b6d734 100644
--- a/ruby/lib/google/BUILD.bazel
+++ b/ruby/lib/google/BUILD.bazel
@@ -1,3 +1,4 @@
+load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
load("@rules_java//java:java_binary.bzl", "java_binary")
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
load("@rules_ruby//ruby:defs.bzl", "rb_library")
diff --git a/rust/defs.bzl b/rust/defs.bzl
index b787d108fc743..54dab26e25048 100644
--- a/rust/defs.bzl
+++ b/rust/defs.bzl
@@ -1,4 +1,5 @@
"""This file implements rust_proto_library."""

+load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")
load("@rules_rust//rust:defs.bzl", "rust_common")
load("//bazel/common:proto_common.bzl", "proto_common")
diff --git a/src/google/protobuf/compiler/cpp/BUILD.bazel b/src/google/protobuf/compiler/cpp/BUILD.bazel
index 4d4e99d774772..ced92c04e235d 100644
--- a/src/google/protobuf/compiler/cpp/BUILD.bazel
+++ b/src/google/protobuf/compiler/cpp/BUILD.bazel
@@ -2,6 +2,7 @@
# Protocol Buffers Compiler - C++ code generator
################################################################################

+load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
load("//bazel:cc_proto_library.bzl", "cc_proto_library")
diff --git a/src/google/protobuf/compiler/java/full/BUILD.bazel b/src/google/protobuf/compiler/java/full/BUILD.bazel
index 6bffaa10fbc87..54b4ae9cd186d 100644
--- a/src/google/protobuf/compiler/java/full/BUILD.bazel
+++ b/src/google/protobuf/compiler/java/full/BUILD.bazel
@@ -1,6 +1,7 @@
# We use abbreviated target names in this directory to work around:
# https://github.com/bazelbuild/bazel/issues/18683

+load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("//build_defs:cpp_opts.bzl", "COPTS")

cc_library(
diff --git a/src/google/protobuf/compiler/java/lite/BUILD.bazel b/src/google/protobuf/compiler/java/lite/BUILD.bazel
index 02af1b3f917df..5e04135abbac0 100644
--- a/src/google/protobuf/compiler/java/lite/BUILD.bazel
+++ b/src/google/protobuf/compiler/java/lite/BUILD.bazel
@@ -1,3 +1,4 @@
+load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("//build_defs:cpp_opts.bzl", "COPTS")

cc_library(
diff --git a/src/google/protobuf/compiler/kotlin/BUILD.bazel b/src/google/protobuf/compiler/kotlin/BUILD.bazel
index 4f866ae02e1b7..5a1e1b727092b 100644
--- a/src/google/protobuf/compiler/kotlin/BUILD.bazel
+++ b/src/google/protobuf/compiler/kotlin/BUILD.bazel
@@ -1,3 +1,4 @@
+load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("//build_defs:cpp_opts.bzl", "COPTS")

cc_library(
diff --git a/src/google/protobuf/compiler/php/BUILD.bazel b/src/google/protobuf/compiler/php/BUILD.bazel
index 930db4476125b..d41fe6d122adb 100644
--- a/src/google/protobuf/compiler/php/BUILD.bazel
+++ b/src/google/protobuf/compiler/php/BUILD.bazel
@@ -2,6 +2,7 @@
# Protocol Buffers Compiler - PHP code generator
################################################################################

+load("@rules_cc//cc:cc_test.bzl", "cc_test")
load("@rules_cc//cc:defs.bzl", "cc_library")
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
load("//build_defs:cpp_opts.bzl", "COPTS")
diff --git a/src/google/protobuf/compiler/rust/BUILD.bazel b/src/google/protobuf/compiler/rust/BUILD.bazel
index e5766c2abd40b..116e44b76df9c 100644
--- a/src/google/protobuf/compiler/rust/BUILD.bazel
+++ b/src/google/protobuf/compiler/rust/BUILD.bazel
@@ -9,6 +9,8 @@
# Protocol Buffers Compiler - Rust code generator
################################################################################

+load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
+load("@rules_cc//cc:cc_test.bzl", "cc_test")
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//build_defs:cpp_opts.bzl", "COPTS")
load(
diff --git a/toolchain/BUILD.bazel b/toolchain/BUILD.bazel
index 524fa14390501..4cb056c75ff66 100644
--- a/toolchain/BUILD.bazel
+++ b/toolchain/BUILD.bazel
@@ -1,4 +1,6 @@
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
+load("@rules_cc//cc/toolchains:cc_toolchain.bzl", "cc_toolchain")
+load("@rules_cc//cc/toolchains:cc_toolchain_suite.bzl", "cc_toolchain_suite")
load(":cc_toolchain_config.bzl", "cc_toolchain_config")

package(default_visibility = ["//visibility:public"])