diff --git a/plugins/anthropics/buffa/source.yaml b/plugins/anthropics/buffa/source.yaml new file mode 100644 index 000000000..3ea0ae561 --- /dev/null +++ b/plugins/anthropics/buffa/source.yaml @@ -0,0 +1,3 @@ +source: + crates: + crate_name: protoc-gen-buffa diff --git a/plugins/anthropics/buffa/v0.5.2/.dockerignore b/plugins/anthropics/buffa/v0.5.2/.dockerignore new file mode 100644 index 000000000..5d0f124ff --- /dev/null +++ b/plugins/anthropics/buffa/v0.5.2/.dockerignore @@ -0,0 +1,2 @@ +* +!Dockerfile diff --git a/plugins/anthropics/buffa/v0.5.2/Dockerfile b/plugins/anthropics/buffa/v0.5.2/Dockerfile new file mode 100644 index 000000000..b002aefcd --- /dev/null +++ b/plugins/anthropics/buffa/v0.5.2/Dockerfile @@ -0,0 +1,15 @@ +# syntax=docker/dockerfile:1.23 +FROM rust:1.95.0-alpine3.23@sha256:606fd313a0f49743ee2a7bd49a0914bab7deedb12791f3a846a34a4711db7ed2 AS builder +RUN apk add --no-cache musl-dev +WORKDIR /app +ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse +RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked --mount=type=cache,target=/root/target \ + cargo install protoc-gen-buffa --version 0.5.2 --locked --root /app + +FROM gcr.io/distroless/static-debian13:latest@sha256:47b2d72ff90843eb8a768b5c2f89b40741843b639d065b9b937b07cd59b479c6 AS base + +FROM scratch +COPY --link --from=base / / +COPY --link --from=builder /app/bin/protoc-gen-buffa /protoc-gen-buffa +USER nobody +ENTRYPOINT ["/protoc-gen-buffa"] diff --git a/plugins/anthropics/buffa/v0.5.2/buf.plugin.yaml b/plugins/anthropics/buffa/v0.5.2/buf.plugin.yaml new file mode 100644 index 000000000..0742e91c8 --- /dev/null +++ b/plugins/anthropics/buffa/v0.5.2/buf.plugin.yaml @@ -0,0 +1,45 @@ +version: v1 +name: buf.build/anthropics/buffa +plugin_version: v0.5.2 +source_url: https://github.com/anthropics/buffa +description: Generates Rust message types with buffa, a zero-copy Protobuf implementation with editions support and no_std compatibility. +output_languages: + - rust +spdx_license_id: Apache-2.0 +license_url: https://github.com/anthropics/buffa/blob/v0.5.2/LICENSE +registry: + cargo: + rust_version: "1.85" + deps: + # Runtime: wire format, Message trait, view types, JSON helpers. + # https://github.com/anthropics/buffa/blob/v0.5.2/buffa/Cargo.toml + - name: "buffa" + req: "0.5.2" + default_features: true + features: + - json + # Well-known types (Timestamp, Duration, Any, Struct, etc.). + # Generated code references these via the auto-injected + # extern_path mapping `.google.protobuf` -> `::buffa_types::google::protobuf`. + - name: "buffa-types" + req: "0.5.2" + default_features: true + features: + - json + # Generated code derives `::serde::Serialize` / `::serde::Deserialize` + # directly when json=true, so serde must be a direct dep. + - name: "serde" + req: "1" + default_features: true + features: + - derive + opts: + # Enable serde derives + proto3 JSON mapping helpers. Required for + # downstream plugins that need the Connect protocol's JSON codec. + - json=true + # Zero-copy view types. Default, but explicit for clarity. + - views=true + # Emit one `.rs` per proto package instead of one + # file per proto file. Matches the prost/tonic filename convention + # the BSR Rust SDK lib.rs synthesis expects. + - file_per_package=true diff --git a/plugins/anthropics/connect-rust/source.yaml b/plugins/anthropics/connect-rust/source.yaml new file mode 100644 index 000000000..e017419b4 --- /dev/null +++ b/plugins/anthropics/connect-rust/source.yaml @@ -0,0 +1,3 @@ +source: + crates: + crate_name: connectrpc-codegen diff --git a/plugins/anthropics/connect-rust/v0.4.2/.dockerignore b/plugins/anthropics/connect-rust/v0.4.2/.dockerignore new file mode 100644 index 000000000..5d0f124ff --- /dev/null +++ b/plugins/anthropics/connect-rust/v0.4.2/.dockerignore @@ -0,0 +1,2 @@ +* +!Dockerfile diff --git a/plugins/anthropics/connect-rust/v0.4.2/Dockerfile b/plugins/anthropics/connect-rust/v0.4.2/Dockerfile new file mode 100644 index 000000000..edbe62da0 --- /dev/null +++ b/plugins/anthropics/connect-rust/v0.4.2/Dockerfile @@ -0,0 +1,17 @@ +# syntax=docker/dockerfile:1.23 +FROM rust:1.95.0-alpine3.23@sha256:606fd313a0f49743ee2a7bd49a0914bab7deedb12791f3a846a34a4711db7ed2 AS builder +RUN apk add --no-cache musl-dev +WORKDIR /app +ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse +# The protoc-gen-connect-rust binary is a [[bin]] target in the +# connectrpc-codegen crate. cargo install compiles it by crate name. +RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked --mount=type=cache,target=/root/target \ + cargo install connectrpc-codegen --version 0.4.2 --locked --root /app + +FROM gcr.io/distroless/static-debian13:latest@sha256:47b2d72ff90843eb8a768b5c2f89b40741843b639d065b9b937b07cd59b479c6 AS base + +FROM scratch +COPY --link --from=base / / +COPY --link --from=builder /app/bin/protoc-gen-connect-rust /protoc-gen-connect-rust +USER nobody +ENTRYPOINT ["/protoc-gen-connect-rust"] diff --git a/plugins/anthropics/connect-rust/v0.4.2/buf.plugin.yaml b/plugins/anthropics/connect-rust/v0.4.2/buf.plugin.yaml new file mode 100644 index 000000000..37e8ca9fa --- /dev/null +++ b/plugins/anthropics/connect-rust/v0.4.2/buf.plugin.yaml @@ -0,0 +1,55 @@ +version: v1 +name: buf.build/anthropics/connect-rust +plugin_version: v0.4.2 +source_url: https://github.com/anthropics/connect-rust +description: Generates ConnectRPC service traits, typed clients, and monomorphic dispatchers for Rust. Compatible with the Connect, gRPC, and gRPC-Web protocols. Passes the full ConnectRPC conformance suite. +deps: + - plugin: buf.build/anthropics/buffa:v0.5.2 +output_languages: + - rust +spdx_license_id: Apache-2.0 +license_url: https://github.com/anthropics/connect-rust/blob/v0.4.2/LICENSE +registry: + cargo: + rust_version: "1.88" + deps: + # ConnectRPC runtime: Router, Context, ConnectError, client transports. + # https://github.com/anthropics/connect-rust/blob/v0.4.2/connectrpc/Cargo.toml + - name: "connectrpc" + req: "0.4.2" + default_features: true + # Generated service stubs use buffa::Message, buffa::view::OwnedView, + # buffa::bytes::Bytes directly. Message types live in the buffa SDK + # crate (via the plugin dep above); this dep is for the runtime API. + - name: "buffa" + req: "0.5.2" + default_features: true + # Well-known types. Service stubs whose request/response types are + # WKTs (e.g. google.longrunning.Operations) reference them as + # `::buffa_types::google::protobuf::...`, mirroring buffa-codegen's + # extern_path mapping for `.google.protobuf`. Must be a direct dep + # so the `::buffa_types` path resolves in the generated crate. + - name: "buffa-types" + req: "0.5.2" + default_features: true + features: + - json + # Streaming method signatures use futures::Stream. + - name: "futures" + req: "0.3" + default_features: true + # Client transport bounds reference http_body::Body. + - name: "http-body" + req: "1" + default_features: true + # The plugin accepts `extern_path=.=` (or the shorthand + # `buffa_module=`) to tell it where the buffa-generated message + # types live. BSR should inject this based on the buffa dep's SDK crate + # name, same as tonic receives extern_path for its prost dep. Leaving + # it out here; please advise if an explicit entry is needed. + opts: + # Emit one `.rs` per proto package, mirroring the + # buffa plugin's `file_per_package=true` opt. Matches the + # prost/tonic filename convention the BSR Rust SDK lib.rs + # synthesis expects. + - file_per_package diff --git a/tests/plugins_test.go b/tests/plugins_test.go index b826f5abc..d43e223e2 100644 --- a/tests/plugins_test.go +++ b/tests/plugins_test.go @@ -75,6 +75,11 @@ exec docker run --log-driver=none --rm -i {{.ImageName}}:{{.Version}} "$@" "buf.build/community/neoeinstein-prost-serde": {"no_include"}, "buf.build/community/neoeinstein-tonic": {"no_include"}, "buf.build/community/mercari-grpc-federation": {"paths=source_relative"}, + // connect-rust generates service stubs only and resolves message types + // via extern_path, which the BSR injects from the deps: chain at SDK + // build time. The standalone test harness has no dep chain, so provide + // a placeholder catch-all mapping. + "buf.build/anthropics/connect-rust": {"extern_path=.=crate"}, } // Some plugins do not generate any code for the test protos, so we allow an empty plugin.sum file for these // plugins. The format of the map is map[pluginName]map[image]bool, where the bool indicates whether an empty diff --git a/tests/testdata/buf.build/anthropics/buffa/v0.5.2/eliza/plugin.sum b/tests/testdata/buf.build/anthropics/buffa/v0.5.2/eliza/plugin.sum new file mode 100644 index 000000000..4449a369a --- /dev/null +++ b/tests/testdata/buf.build/anthropics/buffa/v0.5.2/eliza/plugin.sum @@ -0,0 +1 @@ +h1:ktcklOdY2UGmhTov4n3zaTVV0iCPTFbaog1tzH7DP/c= diff --git a/tests/testdata/buf.build/anthropics/buffa/v0.5.2/petapis/plugin.sum b/tests/testdata/buf.build/anthropics/buffa/v0.5.2/petapis/plugin.sum new file mode 100644 index 000000000..cee5c99ed --- /dev/null +++ b/tests/testdata/buf.build/anthropics/buffa/v0.5.2/petapis/plugin.sum @@ -0,0 +1 @@ +h1:kF+N9OmF6c28gEY8W515PuHMwC/Cf0aA5oCSzA1URIw= diff --git a/tests/testdata/buf.build/anthropics/connect-rust/v0.4.2/eliza/plugin.sum b/tests/testdata/buf.build/anthropics/connect-rust/v0.4.2/eliza/plugin.sum new file mode 100644 index 000000000..9e510e5f0 --- /dev/null +++ b/tests/testdata/buf.build/anthropics/connect-rust/v0.4.2/eliza/plugin.sum @@ -0,0 +1 @@ +h1:SRIzgpj/ikb2VPSKtC+vrgyo5GRTj/uXOIbVZZlP2W0= diff --git a/tests/testdata/buf.build/anthropics/connect-rust/v0.4.2/petapis/plugin.sum b/tests/testdata/buf.build/anthropics/connect-rust/v0.4.2/petapis/plugin.sum new file mode 100644 index 000000000..680e3eaef --- /dev/null +++ b/tests/testdata/buf.build/anthropics/connect-rust/v0.4.2/petapis/plugin.sum @@ -0,0 +1 @@ +h1:StGZ3okU/OTwEG8vTwI/Qgfmo1UZ665jvZD6YjRGR/w=