allow build to run on windows as well

This commit is contained in:
Empire 2024-02-17 18:40:11 +01:00
parent 9d1a807805
commit 556e64740a
3 changed files with 33 additions and 13 deletions

View File

@ -4,8 +4,8 @@ target = "xtensa-esp32-espidf"
[target.xtensa-esp32-espidf] [target.xtensa-esp32-espidf]
linker = "ldproxy" linker = "ldproxy"
#runner = "espflash flash --monitor --partition-table partitions.csv" # Select this runner for espflash v2.x.x #runner = "espflash flash --monitor --partition-table partitions.csv" # Select this runner for espflash v2.x.x
runner = "espflash flash --monitor --baud 921600 --partition-table partitions.csv" # Select this runner for espflash v2.x.x #runner = "espflash flash --monitor --baud 921600 --partition-table partitions.csv" # Select this runner for espflash v2.x.x
#runner = "cargo runner" runner = "cargo runner"
rustflags = [ "--cfg", "espidf_time64"] # Extending time_t for ESP IDF 5: https://github.com/esp-rs/rust/issues/110 rustflags = [ "--cfg", "espidf_time64"] # Extending time_t for ESP IDF 5: https://github.com/esp-rs/rust/issues/110
[unstable] [unstable]

View File

@ -6,19 +6,39 @@ fn main() {
Command::new("rm") Command::new("rm")
.arg("./src/webserver/bundle.js") .arg("./src/webserver/bundle.js")
.output() .output()
.expect("failed to execute process"); .unwrap();
let output = Command::new("npx") match Command::new("cmd").spawn() {
.arg("webpack") Ok(_) => {
.current_dir("./src_webpack") println!("Assuming build on windows");
.output() let output = Command::new("cmd")
.expect("failed to execute process"); .arg("/K")
.arg("npx")
.arg("webpack")
.current_dir("./src_webpack")
.output()
.unwrap();
println!("status: {}", output.status);
println!("stdout: {}", String::from_utf8_lossy(&output.stdout));
println!("stderr: {}", String::from_utf8_lossy(&output.stderr));
assert!(output.status.success());
},
Err(_) => {
println!("Assuming build on linux");
let output = Command::new("bash")
.arg("webpack")
.current_dir("./src_webpack")
.output()
.unwrap();
println!("status: {}", output.status);
println!("stdout: {}", String::from_utf8_lossy(&output.stdout));
println!("stderr: {}", String::from_utf8_lossy(&output.stderr));
assert!(output.status.success());
},
}
println!("status: {}", output.status);
println!("stdout: {}", String::from_utf8_lossy(&output.stdout));
println!("stderr: {}", String::from_utf8_lossy(&output.stderr));
assert!(output.status.success());
embuild::espidf::sysenv::output(); embuild::espidf::sysenv::output();
let _ = EmitBuilder::builder().all_git().emit(); let _ = EmitBuilder::builder().all_git().emit();

View File

@ -1,3 +1,3 @@
[toolchain] [toolchain]
channel = "nightly" channel = "nightly"
toolchain = "esp"