Skip to content

Commit c8bcaa8

Browse files
committed
Add cargo:rerun-if-changed to README
Generally you would want to `cargo:rerun-if-changed` on all your protos to avoid unnecessary re-runs of the build.rs script. I added it to the example.
1 parent 0ad48c3 commit c8bcaa8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,16 @@ Add a `build.rs` file to your project to compile the protos and generate Rust co
3636

3737
```rust
3838
fn main() {
39+
let proto_source_files = ["./service.proto"];
40+
41+
// Tell Cargo to rerun this build script if any of the proto files change
42+
for entry in &proto_source_files {
43+
println!("cargo:rerun-if-changed={}", entry);
44+
}
45+
3946
prost_build::Config::new()
4047
.service_generator(twirp_build::service_generator())
41-
.compile_protos(&["./service.proto"], &["./"])
48+
.compile_protos(&proto_source_files, &["./"])
4249
.expect("error compiling protos");
4350
}
4451
```

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy