-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.rs
More file actions
42 lines (35 loc) · 1.02 KB
/
Copy pathbuild.rs
File metadata and controls
42 lines (35 loc) · 1.02 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use std::env;
use std::path::PathBuf;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let _proto_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()).join("proto");
println!("cargo:rerun-if-changed=proto/");
// Compile common.proto first
tonic_build::configure()
.build_server(true)
.build_client(false)
.compile(&["proto/common.proto"], &["proto/"])?;
// Compile each service separately
let services = [
"projects",
"collections",
"tasks",
"search",
"tags",
"media",
"system",
"plugins",
"samples",
"scanning",
"watcher",
"config"
];
for service in &services {
let proto_file = format!("proto/services/{}.proto", service);
println!("cargo:rerun-if-changed={}", proto_file);
tonic_build::configure()
.build_server(true)
.build_client(false)
.compile(&[&proto_file], &["proto/"])?;
}
Ok(())
}