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 <eliza@buoyant.io>
This commit is contained in:
Eliza Weisman 2018-01-17 09:23:27 -08:00 committed by GitHub
parent 612bd0f7a0
commit 2b20a8bb10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -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);
}
}