From 3bbeac09d21f69154991131bf8a304c1ef71ab86 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Wed, 17 Jan 2018 09:23:27 -0800 Subject: [PATCH] Use cargo:rerun-if-changed to avoid recompiling protos (#160) As @seanmonstar noticed, the build script will currently re-compile all the protobufs regardless of whether or not they have changed, making the build much slower. This PR modifies it to emit `cargo:rerun-if-changed=` for all the protobuf files, so they will only be regenerated if one of them changes. Signed-off-by: Eliza Weisman --- proxy/build.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/proxy/build.rs b/proxy/build.rs index c17687940..a25b13406 100644 --- a/proxy/build.rs +++ b/proxy/build.rs @@ -24,4 +24,9 @@ fn build_control() { .enable_server(true) .build(server_files, dirs) .unwrap(); + + // recompile protobufs only if any of the proto files changes. + for file in client_files.iter().chain(server_files) { + println!("cargo:rerun-if-changed={}", file); + } }