core/build.rs

16 lines
384 B
Rust
Raw Normal View History

2024-04-22 01:41:41 +00:00
use std::process::{exit, Command};
2023-11-22 19:06:20 +00:00
fn main() {
2024-04-30 08:38:01 +00:00
println!("cargo:rerun-if-changed=./api.v1.yaml");
2024-04-22 01:41:41 +00:00
let output = Command::new("sh")
.arg("-c")
2024-04-30 08:38:01 +00:00
.arg("yq . < ./api.v1.yaml > $OUT_DIR/api.v1.json")
2024-04-22 01:41:41 +00:00
.output()
.expect("Failed to convert api documentation to json");
if !output.status.success() {
eprintln!("Error: {}", String::from_utf8_lossy(&output.stderr));
exit(1);
}
2023-11-22 19:06:20 +00:00
}