mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-09-20 13:30:46 +02:00
pass --experimental_allow_proto3_optional to protoc in the Rust build filer.proto now carries a proto3 optional field, which the protoc 3.12 shipped in ubuntu-22.04 apt rejects unless this flag is set. Newer protoc versions still accept the flag, so it is safe everywhere.
21 lines
800 B
Rust
21 lines
800 B
Rust
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
let out_dir = std::path::PathBuf::from(std::env::var("OUT_DIR")?);
|
|
tonic_build::configure()
|
|
.build_server(true)
|
|
.build_client(true)
|
|
// filer.proto uses proto3 optional; older protoc (e.g. 3.12 from ubuntu-22.04 apt)
|
|
// rejects it without this flag, and newer protoc still accepts the flag
|
|
.protoc_arg("--experimental_allow_proto3_optional")
|
|
.file_descriptor_set_path(out_dir.join("seaweed_descriptor.bin"))
|
|
.compile_protos(
|
|
&[
|
|
"proto/volume_server.proto",
|
|
"proto/master.proto",
|
|
"proto/remote.proto",
|
|
"../weed/pb/filer.proto",
|
|
],
|
|
&["proto/", "../weed/pb/"],
|
|
)?;
|
|
Ok(())
|
|
}
|