Bazel: Skylark rules for buffa_rust_library and connectrpc_rust_library
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Da chiarire
- Stato di attività
- Tranquilla
- Stack tecnologico
- rust
- Ambito
- build-system, tooling
Direzione di ricerca
Inizia esaminando PR #38 e l’implementazione di rules_rust_prost, quindi mappa le interfacce proposte buffa_rust_library e connectrpc_rust_library su ProtoInfo, sulle toolchain registrate e sui provider Rust. Risolvi prima dell’implementazione le questioni relative al repository, alla toolchain e alla generazione di buf; il lavoro è completato quando entrambe le regole possono essere composte con target rust_library e rust_test downstream.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Background
PR #38 (Add Bazel example for buffa+connectrpc protoc plugins) introduces a working Bazel integration for the codegen pipeline using a hand-rolled genrule. The genrule:
- lists every
.protofile as asrcsentry, - pre-declares each generated
.rsfilename inouts, - inlines the protoc invocation (or generates a
buf.gen.yaml) directly in thecmd, - requires the caller to know the output naming convention used by
protoc-gen-buffa/protoc-gen-buffa-packaging/protoc-gen-connect-rust.
This is fine as a demo but not what teams should be writing for every proto target in a real Bazel codebase. The natural next step is two custom Starlark rules — buffa_rust_library and connectrpc_rust_library — modeled on rules_rust_prosts rust_prost_library.
Proposed shape
load("@rules_buffa//:defs.bzl", "buffa_rust_library")
load("@rules_connectrpc//:defs.bzl", "connectrpc_rust_library")
proto_library(
name = "greet_proto",
srcs = ["greet.proto"],
strip_import_prefix = "/proto",
)
# Rust message types from buffa codegen.
buffa_rust_library(
name = "greet_buffa",
proto = ":greet_proto",
options = {"views": True, "json": True},
)
# Rust service stubs (server traits, client structs) from connectrpc codegen.
connectrpc_rust_library(
name = "greet_connect",
proto = ":greet_proto",
buffa_module = "crate::proto",
deps = [":greet_buffa"], # references buffa-generated message types
)
What the rules would do internally:
- Pull
ProtoInfofrom theproto = ...attribute to get the transitive descriptor set, source files, and import paths. - Resolve plugin binaries via a registered toolchain (
buffa_toolchain/connectrpc_toolchain) — modeled onrust_prost_toolchain. - Run
protoc(or invoke buf) as a Bazel action. - Predict output filenames from
.protofile paths (theproto_path_to_rust_moduleconvention is deterministic —foo/bar/v1.proto→foo.bar.v1.rs) so they can be declared at analysis time. - Compile the generated files into a
rust_libraryand return bothRustAnalyzerInfoandCrateInfoproviders, so downstreamrust_library/rust_testtargets compose naturally.
Open questions
- Do these live in this repo, or would Buf Inc host them in a
rules_buf_rustextension repo (mirroringrules_rust_prostunder bazelbuild/rules_rust)? Splitting into two rules (buffa_rust_libraryfor messages,connectrpc_rust_libraryfor services) lets buffa be used standalone, but means the connectrpc rule has a soft dependency on the buffa rules output. - Toolchain shape: should the buffa toolchain be parameterized over
views/json/text/utf8_validation/etc., or should those stay rule-attribute knobs? - How should we expose the buf-driven path? A
use_buf_generate = Trueattribute that swaps protoc for buf, or a separate rule? PR #38 demonstrates both wrappers in plain genrules — for the Skylark rule wed want to pick one default. - Does this overlap usefully with a hypothetical language-agnostic
buf_generaterule fromrules_buf(separate proposal being drafted for Buf Inc)? Ifbuf_generateexists, the buffa/connectrpc rules might layer on top of it instead of invoking protoc/buf directly.
Out of scope for this issue
A language-agnostic buf_generate rule that would serve as the foundation here is a separate proposal that should land upstream in bufbuild/rules_buf, not in this repo.
- Lingua principale
- Rust
- Stelle
- 542
- Fork
- 74
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di connectrpc/connect-rust
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
connectrpc/connect-rust#358 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 53/100
connectrpc/connect-rust#355 ·
-
Streaming request body errors are always reported as `internal`Forse già presa @AhmedElBanna80 l’ha presa 13 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
connectrpc/connect-rust#352 ·
-
Difficoltà 3/5 Mezza giornata Idoneità per principianti 48/100
connectrpc/connect-rust#349 ·
-
Client fails 12 cases of connectconformance v1.0.7 (gRPC-Web bidi metadata, gRPC truncated server-stream message)Forse già presa @excavador l’ha presa 29 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
connectrpc/connect-rust#346 · 1 commento ·
Tutte le issue di connectrpc/connect-rust
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
bug help wanted ui
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
userFRM/egui-charts#4550 ·
I maintainer di solito rispondono entro 1 giorno
-
Unable to installAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
runPowerShell description does not warn that a nested powershell -Command can report a false exit 1Apertaagent backend bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 92/100
fritzprix/libr-agent#3121 ·
I maintainer di solito rispondono entro 1 giorno
-
bug CLI subagent
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno