-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.rs
30 lines (27 loc) · 948 Bytes
/
build.rs
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
use calypso_cangen::validate::*;
use std::process;
/* Prebuild script */
fn main() {
println!("cargo:rerun-if-changed=Embedded-Base");
protobuf_codegen::Codegen::new()
.pure()
// All inputs and imports from the inputs must reside in `includes` directories.
.includes(["src/proto"])
// Inputs must reside in some of include paths.
.input("src/proto/command_data.proto")
.input("src/proto/serverdata.proto")
// Specify output directory relative to Cargo output directory.
.out_dir("src")
.run_from_script();
// Validate CAN spec
match validate_all_spec() {
Ok(()) => {}
Err(errors) => {
for error in errors {
// The \x1b[...m is an ANSI escape sequence for colored terminal output
println!("\x1b[31;1mCAN spec error:\x1b[0m {}", error);
}
process::exit(1);
}
}
}