From 2382ae09e2514b218c0797fe82d4218d05383225 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Thu, 27 Jul 2023 04:30:11 +0900 Subject: [PATCH] gen-protos: make old protoc accept optional fields The version installed by ubuntu "latest" doesn't seem to support optional fields yet. This is copied from the prost documentation. https://docs.rs/prost-build/latest/prost_build/struct.Config.html#method.protoc_arg --- lib/gen-protos/src/main.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/gen-protos/src/main.rs b/lib/gen-protos/src/main.rs index d9c6b9632..c9b8d4f01 100644 --- a/lib/gen-protos/src/main.rs +++ b/lib/gen-protos/src/main.rs @@ -29,6 +29,8 @@ fn main() -> Result<()> { prost_build::Config::new() .out_dir(&protos_dir) .include_file("mod.rs") + // For old protoc versions. 3.12.4 needs this, but 3.21.12 doesn't. + .protoc_arg("--experimental_allow_proto3_optional") .compile_protos( &input .into_iter()