blob: e6f33622299fd80229324f632a4d7506b3256781 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
use std::env;
use std::path::PathBuf;
use glob::glob;
fn main() {
println!("cargo:rerun-if-changed=migrations");
let proto_files: Vec<PathBuf> = glob("proto/**/*.proto")
.unwrap()
.filter_map(Result::ok)
.collect();
// Tell cargo to recompile if any of these proto files are changed
for proto_file in &proto_files {
println!("cargo:rerun-if-changed={}", proto_file.display());
}
let descriptor_path = PathBuf::from(env::var("OUT_DIR").unwrap()).join("proto_descriptor.bin");
tonic_build::configure()
.server_mod_attribute("attrs", "#[cfg(feature = \"server\")]")
.client_mod_attribute("attrs", "#[cfg(feature = \"client\")]")
.file_descriptor_set_path(descriptor_path)
.compile(&proto_files, &["proto"])
.unwrap();
}
|