Vendor protoc so the build needs no system protobuf compiler
Some checks failed
CI / check (push) Has been cancelled
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:
parent
2994cbbfea
commit
23fac5eb39
3 changed files with 72 additions and 0 deletions
6
build.rs
6
build.rs
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue