Skip to content

Commit c42c7b7

Browse files
committed
Add community/anthropics-buffa plugin v0.2.0
buffa is a zero-copy Rust Protobuf implementation with editions support (2023/2024), no_std compatibility, and view types for borrowed field access. Passes the protobuf conformance suite (5539 binary+JSON tests). The plugin emits one .rs file per proto file using a flat naming convention (`foo/v1/bar.proto` -> `foo.v1.bar.rs`), matching what BSR expects. Module tree assembly is a separate `protoc-gen-buffa-packaging` plugin in the same repo, not needed for BSR (which synthesizes lib.rs server-side). Crates: https://crates.io/crates/protoc-gen-buffa Repo: https://github.com/anthropics/buffa
1 parent b429f98 commit c42c7b7

4 files changed

Lines changed: 62 additions & 0 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
source:
2+
github:
3+
owner: anthropics
4+
repository: buffa
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!Dockerfile
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# syntax=docker/dockerfile:1.19
2+
FROM rust:1.91.1-alpine3.22 AS builder
3+
RUN apk add --no-cache musl-dev
4+
WORKDIR /app
5+
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
6+
RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked --mount=type=cache,target=/root/target \
7+
cargo install protoc-gen-buffa --version 0.2.0 --locked --root /app
8+
9+
FROM gcr.io/distroless/static-debian12:latest@sha256:87bce11be0af225e4ca761c40babb06d6d559f5767fbf7dc3c47f0f1a466b92c AS base
10+
11+
FROM scratch
12+
COPY --link --from=base / /
13+
COPY --link --from=builder /app/bin/protoc-gen-buffa /protoc-gen-buffa
14+
USER nobody
15+
ENTRYPOINT ["/protoc-gen-buffa"]
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
version: v1
2+
name: buf.build/community/anthropics-buffa
3+
plugin_version: v0.2.0
4+
source_url: https://github.com/anthropics/buffa
5+
description: Generates Rust message types with buffa, a zero-copy Protobuf implementation with editions support and no_std compatibility.
6+
output_languages:
7+
- rust
8+
spdx_license_id: Apache-2.0
9+
license_url: https://github.com/anthropics/buffa/blob/v0.2.0/LICENSE
10+
registry:
11+
cargo:
12+
rust_version: "1.85"
13+
deps:
14+
# Runtime: wire format, Message trait, view types, JSON helpers.
15+
# https://github.com/anthropics/buffa/blob/v0.2.0/buffa/Cargo.toml
16+
- name: "buffa"
17+
req: "0.2.0"
18+
default_features: true
19+
features:
20+
- json
21+
# Well-known types (Timestamp, Duration, Any, Struct, etc.).
22+
# Generated code references these via the auto-injected
23+
# extern_path mapping `.google.protobuf` -> `::buffa_types::google::protobuf`.
24+
- name: "buffa-types"
25+
req: "0.2.0"
26+
default_features: true
27+
features:
28+
- json
29+
# Generated code derives `::serde::Serialize` / `::serde::Deserialize`
30+
# directly when json=true, so serde must be a direct dep.
31+
- name: "serde"
32+
req: "1"
33+
default_features: true
34+
features:
35+
- derive
36+
opts:
37+
# Enable serde derives + proto3 JSON mapping helpers. Required for
38+
# downstream plugins that need the Connect protocol's JSON codec.
39+
- json=true
40+
# Zero-copy view types. Default, but explicit for clarity.
41+
- views=true

0 commit comments

Comments
 (0)