I'm relatively new to using bazel, so I may be missing something.
Running bazel test //... after cloning the repo fails with the following error:
ERROR: /Users/steffen/Library/Caches/bazel/_bazel_steffen/db40a9edcec09ee158f65602c865e6bf/external/protobuf+/build_defs/cc_proto_blacklist_test.bzl:35:26: The CcInfo symbol has been removed, add the following to your BUILD/bzl file:
load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")
I have found two ways to make the tests run successfully:
One way is to add the following additional patches to the protobuf_load-cc-rules.patch:
diff --git a/build_defs/cc_proto_blacklist_test.bzl b/build_defs/cc_proto_blacklist_test.bzl
index 260abdef4..2c100d9b9 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/bazel/upb_proto_reflection_library.bzl b/bazel/upb_proto_reflection_library.bzl
index 5fa7ccf1a..3271ebbfa 100644
--- a/bazel/upb_proto_reflection_library.bzl
+++ b/bazel/upb_proto_reflection_library.bzl
@@ -3,6 +3,7 @@
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")
+load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")
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")
load("//bazel/private:upb_proto_library_internal/rule.bzl", "upb_proto_rule_impl")
diff --git a/bazel/private/upb_proto_library_internal/cc_library_func.bzl b/bazel/private/upb_proto_library_internal/cc_library_func.bzl
index 4753d1841..547964911 100644
--- a/bazel/private/upb_proto_library_internal/cc_library_func.bzl
+++ b/bazel/private/upb_proto_library_internal/cc_library_func.bzl
@@ -1,6 +1,7 @@
"""A function to compile C/C++ code, like cc_library() but from Starlark."""
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_cpp_toolchain")
+load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")
def upb_use_cpp_toolchain():
return use_cpp_toolchain()
diff --git a/bazel/private/upb_proto_library_internal/aspect.bzl b/bazel/private/upb_proto_library_internal/aspect.bzl
index cd666cc14..18c46f120 100644
--- a/bazel/private/upb_proto_library_internal/aspect.bzl
+++ b/bazel/private/upb_proto_library_internal/aspect.bzl
@@ -3,6 +3,7 @@
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain")
load("//bazel/common:proto_common.bzl", "proto_common")
load("//bazel/common:proto_info.bzl", "ProtoInfo")
+load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")
load(":upb_proto_library_internal/cc_library_func.bzl", "cc_library_func")
load(":upb_proto_library_internal/copts.bzl", "UpbProtoLibraryCoptsInfo")
diff --git a/bazel/upb_minitable_proto_library.bzl b/bazel/upb_minitable_proto_library.bzl
index ee84cee8f..8946f56bb 100644
--- a/bazel/upb_minitable_proto_library.bzl
+++ b/bazel/upb_minitable_proto_library.bzl
@@ -1,5 +1,6 @@
"""upb_minitable_proto_library() exposes upb's generated minitables (foo.upb_minitable.h)"""
+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_c_proto_library.bzl b/bazel/upb_c_proto_library.bzl
index ba33dc65a..8094485fd 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")
The other way is to use a local clone of protobuf. Using protobuf 34.1 (the latest version) does not work. That fails with the same CcInfo error, however this time it is in rules_go, specifically in rules_go/go/private/rules/cgo.bzl.
In either case the java version in .bazelrc has to be set to at least 11. Using 17, 21 or 25 however causes the //test/java/toolchains:test_java_toolchain_flag_default test to fail. The java version has to be set to at least 11 as otherwise stardoc fails to build because it uses newer Java features/APIs.
Am I missing something or doing anything wrong in getting the tests to run?
I'm relatively new to using bazel, so I may be missing something.
Running
bazel test //...after cloning the repo fails with the following error:I have found two ways to make the tests run successfully:
One way is to add the following additional patches to the
protobuf_load-cc-rules.patch:The other way is to use a local clone of protobuf. Using protobuf 34.1 (the latest version) does not work. That fails with the same
CcInfoerror, however this time it is in rules_go, specifically inrules_go/go/private/rules/cgo.bzl.In either case the java version in
.bazelrchas to be set to at least 11. Using 17, 21 or 25 however causes the//test/java/toolchains:test_java_toolchain_flag_defaulttest to fail. The java version has to be set to at least 11 as otherwise stardoc fails to build because it uses newer Java features/APIs.Am I missing something or doing anything wrong in getting the tests to run?