'Temporary' fix to avoid breakage from to_json and to_proto on crate_info() on some bazel versions.

PiperOrigin-RevId: 680648840
pull/18553/head
Protobuf Team Bot 2 months ago committed by Copybara-Service
parent 6621ed7a38
commit eeb7dc88f2
  1. 12
      rust/defs.bzl

@ -1,7 +1,4 @@
"""This file implements an experimental, do-not-use-kind of rust_proto_library.
Disclaimer: This project is experimental, under heavy development, and should not
be used yet."""
"""This file implements rust_proto_library."""
load("@rules_rust//rust:defs.bzl", "rust_common")
load("//bazel/common:proto_common.bzl", "proto_common")
@ -20,7 +17,6 @@ def rust_proto_library(name, deps, **args):
Hopefully no user will ever need to read this code.
Args:
name: name of the Rust protobuf target.
deps: proto_library target for which to generate Rust gencode.
@ -102,6 +98,12 @@ def _rust_proto_library_impl(ctx):
pkg, name = _user_visible_label(ctx).rsplit(":")
label = struct(**{"name": name, "pkg": pkg})
fields["name"] = label_to_crate_name(ctx, label, toolchain)
# These two fields present on the dir(crate_info) but break on some versions of Bazel when
# passed back in to crate_info. Strip them for now.
fields.pop("to_json")
fields.pop("to_proto")
crate_info_with_rust_proto_name = rust_common.crate_info(**fields)
return [

Loading…
Cancel
Save