Add anthropics/buffa-packaging plugin v0.3.0#2370
Draft
iainmcgin wants to merge 1 commit intobufbuild:mainfrom
Draft
Add anthropics/buffa-packaging plugin v0.3.0#2370iainmcgin wants to merge 1 commit intobufbuild:mainfrom
iainmcgin wants to merge 1 commit intobufbuild:mainfrom
Conversation
e0f1531 to
a9ac911
Compare
protoc-gen-buffa-packaging emits a mod.rs module tree that includes per-file output from protoc-gen-buffa (or any plugin layered on it). The plugin reads the proto package structure (not message bodies) and writes a mod.rs that include!s each generated file at the right module nesting level. Requires `strategy: all` so the plugin sees the full file set in one invocation. Supports a `filter=services` option for packaging output from service-stub generators that skip files without services. Crates: https://crates.io/crates/protoc-gen-buffa-packaging Repo: https://github.com/anthropics/buffa
a9ac911 to
fd585ed
Compare
Author
|
I'll leave this as draft until we determine if it makes sense for this to be exposed as a remote plugin, or if we should treat this as a local-only helper. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the
protoc-gen-buffa-packagingplugin for assembling buffa-style per-file output into a singlemod.rsmodule tree.What this plugin does
protoc-gen-buffa-packagingreads the proto package structure (not message/service bodies) and writes amod.rsthatinclude!s each generated file at the right module nesting level. It works with any codegen plugin that emits per-file output named via the buffa naming convention (foo/v1/bar.proto->foo.v1.bar.rs), which includesprotoc-gen-buffaitself and plugins layered on top of it (likeprotoc-gen-connect-rust).Why register this in BSR
The buffa plugin (#2333) emits per-file output without a mod.rs. For local
buf generateusers, the packaging plugin assembles the module tree so the generated code can be used aspub mod proto;from a single#[path]. BSR's lib.rs synthesis handles the SDK-crate case differently, but BSR users who pull the plugin into a buf.gen.yaml workflow still need this packaging step.Options
filter=services— only include proto files that declare at least oneservice. Useful when packaging output from a service-stub generator that skips files without services.The plugin requires
strategy: all(client-side concern in buf.gen.yaml) so it sees the full file set in one invocation.No registry block
This plugin emits only
mod.rsfiles containing#[path]andpub moddeclarations - no Rust code with cargo deps. So noregistry:block is needed (same pattern ascommunity/neoeinstein-prost-crate).Dependencies
Logically pairs with #2333 (anthropics/buffa) and #2334 (anthropics/connect-rust). The packaging plugin works on output from those plugins but does not declare them as plugin deps - it operates on the descriptor set, not on the generated code.
Process note
CONTRIBUTING.md asks for an issue first - happy to open one if you would prefer to discuss before reviewing. Filed as draft.