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
This commit is contained in:
Yuya Nishihara 2023-07-27 04:30:11 +09:00
parent 4348d0b487
commit 2382ae09e2

View file

@ -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()