From 9333a850dd331aded6c5d73febf8f2413b4442ef Mon Sep 17 00:00:00 2001 From: Raphael Taylor-Davies <1781103+tustvold@users.noreply.github.com> Date: Fri, 8 Jul 2022 12:00:13 -0400 Subject: [PATCH] Don't generate empty google.protobuf.rs (#2005) * Don't generate empty google.protobuf.rs * Verify file is empty --- arrow-flight/build.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arrow-flight/build.rs b/arrow-flight/build.rs index 2054f8e7118..25f034ac191 100644 --- a/arrow-flight/build.rs +++ b/arrow-flight/build.rs @@ -88,6 +88,13 @@ fn main() -> Result<(), Box> { file.write_all(buffer.as_bytes())?; } + // Prost currently generates an empty file, this was fixed but then reverted + // https://github.com/tokio-rs/prost/pull/639 + let google_protobuf_rs = Path::new("src/sql/google.protobuf.rs"); + if google_protobuf_rs.exists() && google_protobuf_rs.metadata().unwrap().len() == 0 { + std::fs::remove_file(google_protobuf_rs).unwrap(); + } + // As the proto file is checked in, the build should not fail if the file is not found Ok(()) }