-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.rs
More file actions
31 lines (25 loc) · 918 Bytes
/
build.rs
File metadata and controls
31 lines (25 loc) · 918 Bytes
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
use std::process::Command;
use std::env;
fn main() {
// Only run this if we are building for Python (maturin)
// or if we want protos generated during development.
println!("cargo:rerun-if-changed=api/");
println!("cargo:rerun-if-changed=utils/");
let python = env::var("PYTHON").unwrap_or_else(|_| "python3".to_string());
println!("cargo:warning=Generating protobuf files...");
let status = Command::new(&python)
.arg("utils/create_proto.py")
.status()
.expect("failed to execute create_proto.py");
if !status.success() {
panic!("Protobuf generation failed");
}
println!("cargo:warning=Fixing protobuf imports...");
let status = Command::new(&python)
.arg("utils/import_fixer.py")
.status()
.expect("failed to execute import_fixer.py");
if !status.success() {
panic!("Import fixer failed");
}
}