diff --git a/bazel/cel-cpp.patch b/bazel/cel-cpp.patch new file mode 100644 index 000000000000..aa8d795b1410 --- /dev/null +++ b/bazel/cel-cpp.patch @@ -0,0 +1,33 @@ +diff --git a/eval/eval/field_backed_map_impl.cc b/eval/eval/field_backed_map_impl.cc +index cd56f51..4d2a546 100644 +--- a/eval/eval/field_backed_map_impl.cc ++++ b/eval/eval/field_backed_map_impl.cc +@@ -117,7 +117,9 @@ int FieldBackedMapImpl::size() const { + const CelList* FieldBackedMapImpl::ListKeys() const { return key_list_.get(); } + + absl::optional FieldBackedMapImpl::operator[](CelValue key) const { +-#ifdef GOOGLE_PROTOBUF_HAS_CEL_MAP_REFLECTION_FRIEND ++#ifdef XXX_GOOGLE_PROTOBUF_HAS_CEL_MAP_REFLECTION_FRIEND ++ static_assert(false); ++ + // Fast implementation. + google::protobuf::MapKey inner_key; + switch (key.type()) { +@@ -171,7 +173,7 @@ absl::optional FieldBackedMapImpl::operator[](CelValue key) const { + return CreateErrorValue(arena_, status.message()); + } + return result; +-#else // GOOGLE_PROTOBUF_HAS_CEL_MAP_REFLECTION_FRIEND ++#else // XXX_GOOGLE_PROTOBUF_HAS_CEL_MAP_REFLECTION_FRIEND + // Slow implementation. + CelValue result = CelValue::CreateNull(); + CelValue inner_key = CelValue::CreateNull(); +@@ -228,7 +230,7 @@ absl::optional FieldBackedMapImpl::operator[](CelValue key) const { + } + + return {}; +-#endif // GOOGLE_PROTOBUF_HAS_CEL_MAP_REFLECTION_FRIEND ++#endif // XXX_GOOGLE_PROTOBUF_HAS_CEL_MAP_REFLECTION_FRIEND + } + + } // namespace runtime diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 2e1b6280b5b7..43bb0e6e03f1 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -426,7 +426,15 @@ def _com_github_zlib_ng_zlib_ng(): ) def _com_google_cel_cpp(): - _repository_impl("com_google_cel_cpp") + _repository_impl( + name = "com_google_cel_cpp", + patch_args = ["-p1"], + # Patches to remove "fast" protobuf-internal access + # The patch can be removed when the "fast" access is safe to be enabled back. + # This requires public visibility of Reflection::LookupMapValue in protobuf and + # any release of cel-cpp after 10/27/2020. + patches = ["@envoy//bazel:cel-cpp.patch"], + ) _repository_impl("rules_antlr") location = _get_location("antlr4_runtimes") http_archive(