Workaround failing hash derive

This commit is contained in:
Adam Liddell 2023-09-08 12:00:14 +01:00
parent 284f8985ff
commit 6a0f5f93a6
3 changed files with 63 additions and 13 deletions

View File

@ -450,12 +450,34 @@ Full example project can be found `here <https://github.com/rules-proto-grpc/rul
.. code-block:: python
load("@rules_proto_grpc//rust:defs.bzl", "rust_tonic_grpc_library")
load("@rules_proto_grpc//rust:defs.bzl", "rust_tonic_grpc_library", "rust_prost_proto_library")
rust_tonic_grpc_library(
name = "greeter_rust_tonic_grpc",
declared_proto_packages = ["example.proto"],
protos = [
"@rules_proto_grpc//example/proto:greeter_grpc",
"@rules_proto_grpc//example/proto:person_proto",
"@rules_proto_grpc//example/proto:place_proto",
# "@rules_proto_grpc//example/proto:thing_proto",
],
options = {
"//rust:rust_prost_plugin": [
"type_attribute=.example.proto.Person=#[derive(Eq\\,Hash)]",
"type_attribute=.example.proto.Place=#[derive(Eq\\,Hash)]",
# "type_attribute=.example.proto.Thing=#[derive(Eq\\,Hash)]",
],
},
prost_proto_deps = [
":thing_prost",
],
)
# See https://github.com/rules-proto-grpc/rules_proto_grpc/pull/265/#issuecomment-1577920311
rust_prost_proto_library(
name = "thing_prost",
declared_proto_packages = ["example.proto"],
protos = [
"@rules_proto_grpc//example/proto:thing_proto",
],
)

View File

@ -1,25 +1,31 @@
load("@rules_proto_grpc//rust:defs.bzl", "rust_tonic_grpc_library", "rust_prost_proto_library")
rust_tonic_grpc_library(
name = "greeter_tonic",
name = "greeter_rust_tonic_grpc",
declared_proto_packages = ["example.proto"],
protos = [
"@rules_proto_grpc//example/proto:greeter_grpc",
"@rules_proto_grpc//example/proto:person_proto",
"@rules_proto_grpc//example/proto:place_proto",
"@rules_proto_grpc//example/proto:thing_proto",
# "@rules_proto_grpc//example/proto:thing_proto",
],
options = {
"//rust:rust_prost_plugin": [
"type_attribute=.example.proto.Person=#[derive(Eq\\,Hash)]",
"type_attribute=.example.proto.Place=#[derive(Eq\\,Hash)]",
]},
# "type_attribute=.example.proto.Thing=#[derive(Eq\\,Hash)]",
],
},
prost_proto_deps = [
":thing_prost",
],
)
# See https://github.com/rules-proto-grpc/rules_proto_grpc/pull/265/#issuecomment-1577920311
rust_prost_proto_library(
name = "thing_prost",
declared_proto_packages = ["example.proto"],
protos = [
"@rules_proto_grpc//example/proto:thing_proto",
],
)
# rust_prost_proto_library(
# name = "thing_prost",
# declared_proto_packages = ["example.proto"],
# protos = [
# "@rules_proto_grpc//example/proto:thing_proto",
# ],
# )

View File

@ -213,12 +213,34 @@ var rustProtoLibraryExampleTemplate = mustTemplate(`load("@rules_proto_grpc//{{
},
)`)
var rustGrpcLibraryExampleTemplate = mustTemplate(`load("@rules_proto_grpc//{{ .Lang.Dir }}:defs.bzl", "{{ .Rule.Name }}")
var rustGrpcLibraryExampleTemplate = mustTemplate(`load("@rules_proto_grpc//{{ .Lang.Dir }}:defs.bzl", "{{ .Rule.Name }}", "rust_prost_proto_library")
{{ .Rule.Name }}(
name = "greeter_{{ .Rule.Base }}_{{ .Rule.Kind }}",
declared_proto_packages = ["example.proto"],
protos = [
"@rules_proto_grpc//example/proto:greeter_grpc",
"@rules_proto_grpc//example/proto:person_proto",
"@rules_proto_grpc//example/proto:place_proto",
# "@rules_proto_grpc//example/proto:thing_proto",
],
options = {
"//rust:rust_prost_plugin": [
"type_attribute=.example.proto.Person=#[derive(Eq\\,Hash)]",
"type_attribute=.example.proto.Place=#[derive(Eq\\,Hash)]",
# "type_attribute=.example.proto.Thing=#[derive(Eq\\,Hash)]",
],
},
prost_proto_deps = [
":thing_prost",
],
)
# See https://github.com/rules-proto-grpc/rules_proto_grpc/pull/265/#issuecomment-1577920311
rust_prost_proto_library(
name = "thing_prost",
declared_proto_packages = ["example.proto"],
protos = [
"@rules_proto_grpc//example/proto:thing_proto",
],
)`)