From 35a1973a466d7d0e3d4b91157bdc62c1cf1ac813 Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Tue, 14 Feb 2023 22:18:00 +0200 Subject: [PATCH] fix: allow older versions of protobuf-compiler to work Add --experimental_allow_proto3_optional protoc arg in build configs fixes https://github.com/scsibug/nostr-rs-relay/issues/77 --- build.rs | 8 +++++++- nauthz_server_example/build.rs | 10 ++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/build.rs b/build.rs index 0a1101c..7845f76 100644 --- a/build.rs +++ b/build.rs @@ -1,4 +1,10 @@ fn main() -> Result<(), Box> { - tonic_build::compile_protos("proto/nauthz.proto")?; + tonic_build::configure() + .build_server(false) + .protoc_arg("--experimental_allow_proto3_optional") + .compile( + &["proto/nauthz.proto"], + &["proto"], + )?; Ok(()) } diff --git a/nauthz_server_example/build.rs b/nauthz_server_example/build.rs index b5b1f01..ef72247 100644 --- a/nauthz_server_example/build.rs +++ b/nauthz_server_example/build.rs @@ -1,4 +1,10 @@ fn main() -> Result<(), Box> { - tonic_build::compile_protos("../proto/nauthz.proto")?; + tonic_build::configure() + .build_server(false) + .protoc_arg("--experimental_allow_proto3_optional") + .compile( + &["../proto/nauthz.proto"], + &["../proto"], + )?; Ok(()) -} +} \ No newline at end of file