commit fc4d962f0bdfcaa1cc1b2e306301eec48719d847 Author: Keith Smiley AuthorDate: Tue Mar 3 15:14:28 2026 -0800 Commit: Keith Smiley CommitDate: Tue Mar 3 15:20:01 2026 -0800 NEED diff --git a/bazel/upb_c_proto_library.bzl b/bazel/upb_c_proto_library.bzl index ebeebed..0bdf741 100644 --- a/bazel/upb_c_proto_library.bzl +++ b/bazel/upb_c_proto_library.bzl @@ -1,5 +1,6 @@ """upb_c_proto_library() exposes upb's generated C API for protobuf (foo.upb.h)""" +load("@rules_cc//cc/common:cc_info.bzl", "CcInfo") load("//bazel:upb_minitable_proto_library.bzl", "UpbMinitableCcInfo", "upb_minitable_proto_library_aspect") load("//bazel/common:proto_info.bzl", "ProtoInfo") load("//bazel/private:upb_proto_library_internal/aspect.bzl", "upb_proto_aspect_impl") diff --git a/bazel/upb_minitable_proto_library.bzl b/bazel/upb_minitable_proto_library.bzl index 0a17842..a77c572 100644 --- a/bazel/upb_minitable_proto_library.bzl +++ b/bazel/upb_minitable_proto_library.bzl @@ -1,5 +1,7 @@ """upb_minitable_proto_library() exposes upb's generated minitables (foo.upb_minitable.h)""" +load("@rules_cc//cc/common:cc_common.bzl", "cc_common") +load("@rules_cc//cc/common:cc_info.bzl", "CcInfo") load("//bazel/common:proto_info.bzl", "ProtoInfo") load("//bazel/private:upb_proto_library_internal/aspect.bzl", "upb_proto_aspect_impl") load("//bazel/private:upb_proto_library_internal/cc_library_func.bzl", "upb_use_cpp_toolchain") diff --git a/bazel/upb_proto_reflection_library.bzl b/bazel/upb_proto_reflection_library.bzl index 8347dfb..fb28ef3 100644 --- a/bazel/upb_proto_reflection_library.bzl +++ b/bazel/upb_proto_reflection_library.bzl @@ -1,5 +1,6 @@ """upb_c_proto_reflection_library() exposes upb reflection for protobuf (foo.upbdefs.h)""" +load("@rules_cc//cc/common:cc_info.bzl", "CcInfo") load("//bazel:upb_minitable_proto_library.bzl", "UpbMinitableCcInfo", "upb_minitable_proto_library_aspect") load("//bazel/common:proto_common.bzl", "proto_common") load("//bazel/common:proto_info.bzl", "ProtoInfo") diff --git a/build_defs/cc_proto_blacklist_test.bzl b/build_defs/cc_proto_blacklist_test.bzl index 260abde..2c100d9 100644 --- a/build_defs/cc_proto_blacklist_test.bzl +++ b/build_defs/cc_proto_blacklist_test.bzl @@ -1,6 +1,7 @@ """Contains a unittest to verify that `cc_proto_library` does not generate code for blacklisted `.proto` sources (i.e. WKPs).""" load("@bazel_skylib//lib:unittest.bzl", "asserts", "unittest") +load("@rules_cc//cc/common:cc_info.bzl", "CcInfo") def _cc_proto_blacklist_test_impl(ctx): """Verifies that there are no C++ compile actions for Well-Known-Protos. diff --git a/src/google/protobuf/BUILD.bazel b/src/google/protobuf/BUILD.bazel index 5cfd160..c9117de 100644 --- a/src/google/protobuf/BUILD.bazel +++ b/src/google/protobuf/BUILD.bazel @@ -452,7 +452,6 @@ cc_library( "@com_google_absl//absl/numeric:bits", "@com_google_absl//absl/synchronization", "@com_google_absl//absl/types:span", - "@com_google_absl//absl/utility:if_constexpr", ], ) @@ -578,7 +577,6 @@ cc_library( "@com_google_absl//absl/time", "@com_google_absl//absl/types:optional", "@com_google_absl//absl/types:span", - "@com_google_absl//absl/utility:if_constexpr", ], ) diff --git a/src/google/protobuf/compiler/java/full/BUILD.bazel b/src/google/protobuf/compiler/java/full/BUILD.bazel index 1fb6f07..b5b2cbd 100644 --- a/src/google/protobuf/compiler/java/full/BUILD.bazel +++ b/src/google/protobuf/compiler/java/full/BUILD.bazel @@ -1,3 +1,5 @@ +load("@rules_cc//cc:cc_library.bzl", "cc_library") + # We use abbreviated target names in this directory to work around: # https://github.com/bazelbuild/bazel/issues/18683 cc_library( diff --git a/src/google/protobuf/compiler/java/lite/BUILD.bazel b/src/google/protobuf/compiler/java/lite/BUILD.bazel index 1046739..92e82cc 100644 --- a/src/google/protobuf/compiler/java/lite/BUILD.bazel +++ b/src/google/protobuf/compiler/java/lite/BUILD.bazel @@ -1,3 +1,5 @@ +load("@rules_cc//cc:cc_library.bzl", "cc_library") + cc_library( name = "field_generators", srcs = [ diff --git a/src/google/protobuf/compiler/kotlin/BUILD.bazel b/src/google/protobuf/compiler/kotlin/BUILD.bazel index 5555ade..2ecc09a 100644 --- a/src/google/protobuf/compiler/kotlin/BUILD.bazel +++ b/src/google/protobuf/compiler/kotlin/BUILD.bazel @@ -1,3 +1,5 @@ +load("@rules_cc//cc:cc_library.bzl", "cc_library") + cc_library( name = "kotlin", srcs = ["generator.cc"], diff --git a/src/google/protobuf/compiler/php/BUILD.bazel b/src/google/protobuf/compiler/php/BUILD.bazel index 7e21518..271e67b 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 91c8145..50d0aa7 100644 --- a/src/google/protobuf/compiler/rust/BUILD.bazel +++ b/src/google/protobuf/compiler/rust/BUILD.bazel @@ -2,6 +2,7 @@ # Protocol Buffers Compiler - Rust code generator ################################################################################ +load("@rules_cc//cc:cc_test.bzl", "cc_test") load("@rules_cc//cc:defs.bzl", "cc_library") load("//build_defs:cpp_opts.bzl", "COPTS") diff --git a/src/google/protobuf/compiler/test_plugin_injection.bzl b/src/google/protobuf/compiler/test_plugin_injection.bzl index aec2544..210d942 100644 --- a/src/google/protobuf/compiler/test_plugin_injection.bzl +++ b/src/google/protobuf/compiler/test_plugin_injection.bzl @@ -28,6 +28,7 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +load("@rules_cc//cc:cc_library.bzl", "cc_library") load("//build_defs:cpp_opts.bzl", "COPTS") # This works around https://github.com/bazelbuild/bazel/issues/19124 by using a generated header to @@ -55,8 +56,7 @@ cat <<'EOF' >$(OUTS) visibility = ["//visibility:private"], testonly = True, ) - - native.cc_library( + cc_library( name = name, hdrs = [hdr], strip_include_prefix = "/src", diff --git a/third_party/utf8_range/BUILD.bazel b/third_party/utf8_range/BUILD.bazel index 90b1088..2e07ede 100644 --- a/third_party/utf8_range/BUILD.bazel +++ b/third_party/utf8_range/BUILD.bazel @@ -4,6 +4,8 @@ # license that can be found in the LICENSE file or at # https://opensource.org/licenses/MIT. +load("@rules_cc//cc:cc_library.bzl", "cc_library") +load("@rules_cc//cc:cc_test.bzl", "cc_test") load("@rules_license//rules:license.bzl", "license") DEFAULT_VISIBILITY = [ diff --git a/upb/BUILD b/upb/BUILD index b282b6e..b5cbcfe 100644 --- a/upb/BUILD +++ b/upb/BUILD @@ -6,7 +6,7 @@ # https://developers.google.com/open-source/licenses/bsd load("@bazel_skylib//rules:common_settings.bzl", "bool_flag") -load("@rules_python//python:defs.bzl", "py_binary") +load("@rules_cc//cc:cc_library.bzl", "cc_library") load("//bazel/private:upb_proto_library_internal/copts.bzl", "upb_proto_library_copts") load( "//upb/bazel:amalgamation.bzl", diff --git a/upb/port/BUILD b/upb/port/BUILD index 9088825..a8e9a13 100644 --- a/upb/port/BUILD +++ b/upb/port/BUILD @@ -5,6 +5,7 @@ # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd +load("@rules_cc//cc:cc_library.bzl", "cc_library") load("//upb/bazel:build_defs.bzl", "UPB_DEFAULT_COPTS") package(default_applicable_licenses = ["//:license"]) diff --git a/upb_generator/bootstrap_compiler.bzl b/upb_generator/bootstrap_compiler.bzl index be2ff5f..8d9a017 100644 --- a/upb_generator/bootstrap_compiler.bzl +++ b/upb_generator/bootstrap_compiler.bzl @@ -1,5 +1,7 @@ """Macros that implement bootstrapping for the upb code generator.""" +load("@rules_cc//cc:cc_binary.bzl", "cc_binary") +load("@rules_cc//cc:cc_library.bzl", "cc_library") load( "//bazel:upb_minitable_proto_library.bzl", "upb_minitable_proto_library", @@ -53,7 +55,7 @@ def bootstrap_cc_library(name, visibility = [], deps = [], bootstrap_deps = [], upb_proto_library(). """ for stage in _stages: - native.cc_library( + cc_library( name = name + stage, deps = deps + [dep + stage for dep in bootstrap_deps], visibility = _stage_visibility(stage, visibility), @@ -77,7 +79,7 @@ def bootstrap_cc_binary(name, visibility = [], deps = [], bootstrap_deps = [], * upb_proto_library(). """ for stage in _stages: - native.cc_binary( + cc_binary( name = name + stage, deps = deps + [dep + stage for dep in bootstrap_deps], visibility = _stage_visibility(stage, visibility), @@ -212,7 +214,7 @@ def bootstrap_upb_proto_library( _stage0_proto_staleness_test(name, oss_src_files, oss_src_rules, oss_strip_prefix) # stage0 uses checked-in protos, and has no MiniTable. - native.cc_library( + cc_library( name = name + "_stage0", srcs = _generated_hdrs_and_srcs(oss_src_files, "stage0", "upb"), hdrs = [bootstrap_hdr], @@ -231,8 +233,7 @@ def bootstrap_upb_proto_library( # Generate stage1 protos (C API and MiniTables) using stage0 compiler. _generate_stage1_proto(name, src_files, src_rules, "upb", kwargs) _generate_stage1_proto(name, src_files, src_rules, "upb_minitable", kwargs) - - native.cc_library( + cc_library( name = name + "_minitable_stage1", srcs = _generated_files(src_files, "stage1", "upb_minitable", "c"), hdrs = _generated_files(src_files, "stage1", "upb_minitable", "h"), @@ -243,7 +244,7 @@ def bootstrap_upb_proto_library( ] + [dep + "_minitable_stage1" for dep in deps], **kwargs ) - native.cc_library( + cc_library( name = name + "_stage1", srcs = _generated_files(src_files, "stage1", "upb", "h"), hdrs = [bootstrap_hdr], @@ -262,7 +263,7 @@ def bootstrap_upb_proto_library( deps = proto_lib_deps, **kwargs ) - native.cc_library( + cc_library( name = name, hdrs = [bootstrap_hdr], deps = [name + "_upb_proto"], diff --git a/upb_generator/common/BUILD b/upb_generator/common/BUILD index 8687b7f..982ba6f 100644 --- a/upb_generator/common/BUILD +++ b/upb_generator/common/BUILD @@ -5,6 +5,8 @@ # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd +load("@rules_cc//cc:cc_library.bzl", "cc_library") + package(default_applicable_licenses = ["//:license"]) # Note: this library should not depend on upb reflection or C++ proto diff --git a/upb_generator/minitable/BUILD b/upb_generator/minitable/BUILD index a5eadfe..62a153e 100644 --- a/upb_generator/minitable/BUILD +++ b/upb_generator/minitable/BUILD @@ -5,6 +5,7 @@ # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd +load("@rules_cc//cc:cc_library.bzl", "cc_library") load("//bazel/toolchains:proto_lang_toolchain.bzl", "proto_lang_toolchain") load("//upb/bazel:build_defs.bzl", "UPB_DEFAULT_CPPOPTS") load(