Skip to content

Add Rust proto support: proto_rust_library rule + prost/prost-serde/tonic plugins#419

Merged
pcj merged 9 commits intomasterfrom
feat/rust
May 9, 2026
Merged

Add Rust proto support: proto_rust_library rule + prost/prost-serde/tonic plugins#419
pcj merged 9 commits intomasterfrom
feat/rust

Conversation

@pcj
Copy link
Copy Markdown
Member

@pcj pcj commented May 8, 2026

Implements a Go-based proto_rust_library rule and three protoc-gen-* Go plugins
(prost, prost-serde, tonic) so Rust codegen participates in dependency
resolution instead of relying on starlark plugins. Adds proto_compile rule
merging for package-level plugins whose outputs overlap across proto_libraries,
and a Rust keyword escape utility (r# prefix) for proto packages whose
segments collide with Rust reserved words (e.g. google.type → google/r#type).

pcj added 9 commits April 21, 2026 12:44
When gazelle:proto file mode generates per-file proto_library rules,
plugins that produce package-level outputs (e.g. protoc-gen-prost)
cause conflicting Bazel actions since multiple proto_compile rules
try to declare the same output file.

This adds automatic merging: when proto_compile detects overlapping
outputs with an existing rule in the same package, it merges them
into a single rule using a new "protos" (label_list) attribute
instead of the singular "proto" attribute.

Changes:
- proto_compile.bzl: add "protos" attr, support multiple ProtoInfo
  providers, make "proto" non-mandatory
- proto_compile.go: add Rule(otherGen) merge logic following the
  existing go_library aggregation pattern
- proto_compile_test.go: unit tests for overlap detection and
  end-to-end aggregation via ExamplePackage_aggregation
…onic plugins

Implements a Go-based proto_rust_library rule and three protoc-gen-* Go plugins
(prost, prost-serde, tonic) so Rust codegen participates in dependency
resolution instead of relying on starlark plugins. Adds proto_compile rule
merging for package-level plugins whose outputs overlap across proto_libraries,
and a Rust keyword escape utility (r# prefix) for proto packages whose
segments collide with Rust reserved words (e.g. google.type → google/r#type).
@pcj pcj merged commit a9a41ba into master May 9, 2026
1 check passed
@pcj pcj deleted the feat/rust branch May 9, 2026 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant