Skip to content

Commit

Permalink
Merge pull request #6 from github/look/rerun-if
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickt authored Jan 24, 2024
2 parents 0ad48c3 + c8bcaa8 commit e67dc5f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,16 @@ Add a `build.rs` file to your project to compile the protos and generate Rust co

```rust
fn main() {
let proto_source_files = ["./service.proto"];

// Tell Cargo to rerun this build script if any of the proto files change
for entry in &proto_source_files {
println!("cargo:rerun-if-changed={}", entry);
}

prost_build::Config::new()
.service_generator(twirp_build::service_generator())
.compile_protos(&["./service.proto"], &["./"])
.compile_protos(&proto_source_files, &["./"])
.expect("error compiling protos");
}
```
Expand Down

0 comments on commit e67dc5f

Please sign in to comment.