2023-12-23 01:59:00 +01:00
|
|
|
use std::process::Command;
|
|
|
|
|
2023-11-27 01:07:07 +01:00
|
|
|
use vergen::EmitBuilder;
|
2023-11-20 00:05:47 +01:00
|
|
|
fn main() {
|
2023-12-23 01:59:00 +01:00
|
|
|
println!("cargo:rerun-if-changed=./src/src_webpack");
|
2024-01-07 14:33:02 +01:00
|
|
|
Command::new("rm")
|
|
|
|
.arg("./src/webserver/bundle.js")
|
|
|
|
.output()
|
2024-02-17 18:40:11 +01:00
|
|
|
.unwrap();
|
2024-01-07 14:33:02 +01:00
|
|
|
|
2024-02-17 18:40:11 +01:00
|
|
|
match Command::new("cmd").spawn() {
|
|
|
|
Ok(_) => {
|
|
|
|
println!("Assuming build on windows");
|
|
|
|
let output = Command::new("cmd")
|
2024-02-21 15:36:26 +01:00
|
|
|
.arg("/K")
|
|
|
|
.arg("npx")
|
|
|
|
.arg("webpack")
|
|
|
|
.current_dir("./src_webpack")
|
|
|
|
.output()
|
|
|
|
.unwrap();
|
2024-02-17 18:40:11 +01:00
|
|
|
println!("status: {}", output.status);
|
|
|
|
println!("stdout: {}", String::from_utf8_lossy(&output.stdout));
|
|
|
|
println!("stderr: {}", String::from_utf8_lossy(&output.stderr));
|
|
|
|
assert!(output.status.success());
|
2024-02-21 15:36:26 +01:00
|
|
|
}
|
2024-02-17 18:40:11 +01:00
|
|
|
Err(_) => {
|
|
|
|
println!("Assuming build on linux");
|
2024-02-21 22:30:03 +01:00
|
|
|
let output = Command::new("npx")
|
2024-02-21 15:36:26 +01:00
|
|
|
.arg("webpack")
|
|
|
|
.current_dir("./src_webpack")
|
|
|
|
.output()
|
|
|
|
.unwrap();
|
2024-02-17 18:40:11 +01:00
|
|
|
println!("status: {}", output.status);
|
|
|
|
println!("stdout: {}", String::from_utf8_lossy(&output.stdout));
|
|
|
|
println!("stderr: {}", String::from_utf8_lossy(&output.stderr));
|
|
|
|
assert!(output.status.success());
|
2024-02-21 15:36:26 +01:00
|
|
|
}
|
2024-02-17 18:40:11 +01:00
|
|
|
}
|
2024-01-07 14:33:02 +01:00
|
|
|
|
2023-11-20 00:05:47 +01:00
|
|
|
embuild::espidf::sysenv::output();
|
2024-02-21 15:36:26 +01:00
|
|
|
let _ = EmitBuilder::builder().all_git().all_build().emit();
|
2024-01-07 14:33:02 +01:00
|
|
|
}
|