Closed echochamber closed 1 year ago
@aaliddell The majority of the logic here is done and ready for review/initial feedback. All of the targets in rust/example/ should build and run just fine.
I'm still working on getting the rules to work outside of the main rules_proto_grpc Workspace. Currently getting an error when I try to bazel build //:thing_rust_proto
in the example/rust/rust_prost_proto_compile/WORKSPACE
.
external/rules_proto_grpc/rust/3rdparty/crates/BUILD.bazel:161:6: no such package '@rules_proto_grpc_rust__protoc-gen-prost-serde-0.2.3//': The repository '@rules_proto_grpc_rust__protoc-gen-prost-serde-0.2.3' could not be resolved: Repository '@rules_proto_grpc_rust__protoc-gen-prost-serde-0.2.3' is not defined and referenced by '@rules_proto_grpc//rust/3rdparty/crates:protoc-gen-prost-serde__protoc-gen-prost-serde'
And it works! All of the examples build and run smoothly.
That said, there is something interesting going on with deriving the hash/eq type for the pbjson types.
However this only occurs in this second example code snippet below, in the first the build succeeds (even though Thing doesn't derive Hash in the generated code), which is interesting.
Ok, time for me to get reading. Thankfully most of those 20,000 lines changed are just raze -> crate_universe :scream:
I'm trying to think if there's any tricks we can play with an aspect that'd let us discover the externs automatically
As an update of where I am with this:
I'll start adding commits here as I do the above
I've spun the aspect investigation off into #282 as future work, so it doesn't hold this up any further. The rest is now passing with rulegen aligned with your work. Sorry it's taken me so long
Status: It works!
Updated version of @titanous PR https://github.com/rules-proto-grpc/rules_proto_grpc/pull/202.
Users will need to manually declare the
declared_proto_packages=["proto.package.name", ...]
. The compile rule also requires thecrate_name=my_crate
be provided (but the macros take care of this part for you).However, with this information the custom rule implementation will handle creating all the necessary
--externs_path=.proto.package.name=::my_create::proto::package::name
mappings for you (prost docs).Things I've tested on both
rust_prost_proto_library
andrust_tonic_grpc_library
:nested.proto.namespaces
rust_prost_proto_library
.Known limitations: