Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3558695
D5154.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D5154.id.diff
View Options
diff --git a/services/commtest/build.rs b/services/commtest/build.rs
--- a/services/commtest/build.rs
+++ b/services/commtest/build.rs
@@ -1,26 +1,21 @@
use std::fs;
-use std::io::{Error, ErrorKind};
+use std::io::Error;
+
+const PROTO_DIR: &'static str = "../../shared/protos";
fn main() -> Result<(), Error> {
- const PROTO_FILES_PATH: &str = "../../shared/protos";
- let proto_files = fs::read_dir(PROTO_FILES_PATH)?;
+ let proto_files = fs::read_dir(PROTO_DIR)?;
for path in proto_files {
- let path_str = path?
- .path()
- .file_name()
- .ok_or(Error::new(
- ErrorKind::Other,
- "failed to obtain the file name",
- ))?
- .to_string_lossy()
- .into_owned();
- println!("{}", path_str.as_str());
- // skip CMakeLists.txt and _generated directory
- if path_str.contains("CMakeLists.txt") || path_str.eq("_generated") {
+ let filename: String = path?.file_name().to_string_lossy().to_string();
+
+ // Avoid passing non protobuf files to tonic
+ if !filename.ends_with(".proto") {
continue;
}
- assert!(path_str.contains(".proto"));
- tonic_build::compile_protos(format!("{}/{}", PROTO_FILES_PATH, path_str))?;
+
+ println!("Compiling protobuf file: {}", filename);
+ println!("cargo:rerun-if-changed={}/{}", PROTO_DIR, filename);
+ tonic_build::compile_protos(format!("{}/{}", PROTO_DIR, filename))?;
}
Ok(())
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 28, 5:04 AM (43 m, 41 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2723725
Default Alt Text
D5154.id.diff (1 KB)
Attached To
Mode
D5154: [Services] Cleanup commtest/build.rs
Attached
Detach File
Event Timeline
Log In to Comment