Vendor protoc so the build needs no system protobuf compiler
Some checks failed
CI / check (push) Has been cancelled

The gRPC build script required a system protoc, which a fresh clone and
the CI container lack (build failed with 'Could not find protoc'). Set
PROTOC from protoc-bin-vendored in build.rs (unless one is already set),
so cargo build works out of the box everywhere.
This commit is contained in:
Jean Chevronnet 2026-07-15 00:11:26 +00:00
parent 2994cbbfea
commit 23fac5eb39
No known key found for this signature in database
3 changed files with 72 additions and 0 deletions

View file

@ -1,4 +1,10 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Use a vendored protoc, so `cargo build` needs no system protobuf compiler
// (a fresh clone, CI, and the deploy box all build out of the box). Respect
// an explicit PROTOC if one is already set.
if std::env::var_os("PROTOC").is_none() {
std::env::set_var("PROTOC", protoc_bin_vendored::protoc_bin_path()?);
}
// Server only: the Rust side never needs to dial itself as a gRPC client.
// Django (or any other consumer) generates its own stub from proto/echo.proto.
tonic_build::configure()