Closed wagenet closed 2 years ago
I'm running into this too. It looks like the panic is in trying to write to the file for google.protobuf
. Specifically, within the add_serde
call, there is this, which panics because the rust_path
does not exist for the file `.
pub fn add_serde(out: PathBuf, descriptor: FileDescriptorSet) {
for fd in &descriptor.file {
let package_name = match fd.package {
Some(ref pkg) => pkg,
None => continue,
};
let rust_path = out.join(format!("{}.rs", package_name));
let mut rust_file = OpenOptions::new().append(true).open(rust_path).unwrap();
...
}
}
I added the following to my build.rs
to see what the descriptor contained and compared to the contents of my output directory. It showed that the descriptor had:
for fd in &descriptor.file {
let package_name = match fd.package {
Some(ref pkg) => pkg,
None => continue,
};
let messages: Vec<_> = fd.message_type.iter().map(|m| m.name()).collect();
println!("Rust Path: {:?}: {:?}", package_name, messages);
}
prost_wkt_build::add_serde(out_dir, descriptor);
It showed the decscriptor contained these entries for google.protobuf
, but there is no google.protobuf.rs
:
Rust Path: "google.protobuf": ["Empty"]
Rust Path: "google.protobuf": ["Timestamp"]
Rust Path: "google.protobuf": ["DoubleValue", "FloatValue", "Int64Value", "UInt64Value", "Int32Value", "UInt32Value", "BoolValue", "StringValue", "BytesValue"]
Also, FWIW confirmed that upgrading the Cargo.toml
in this crate and the example to prost 0.10 causes the same failures.
Where things worked with Prost 0.9, they now fail with 0.10.
build.rs: