fix(build): copy assets also without --release (#179)

This commit is contained in:
Aram Drevekenin 2021-02-11 13:19:15 +01:00 committed by GitHub
parent 4d69c5c9b1
commit a5b30c52e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -90,6 +90,34 @@ fn main() {
});
}
}
} else {
// FIXME: Deduplicate this with the initial walk all .rs pattern
for entry in fs::read_dir(alt_target.join("wasm32-wasi/debug/")).unwrap() {
let entry = entry.unwrap().path();
let ext = entry.extension();
if ext.is_some() && ext.unwrap() == "wasm" {
dbg!(&entry);
Command::new("wasm-opt")
.arg("-O")
.arg(entry.as_os_str())
.arg("-o")
.arg(format!(
"assets/plugins/{}",
entry.file_name().unwrap().to_string_lossy()
))
.status()
.unwrap_or_else(|_| {
Command::new("cp")
.arg(entry.as_os_str())
.arg(format!(
"assets/plugins/{}",
entry.file_name().unwrap().to_string_lossy()
))
.status()
.unwrap()
});
}
}
}
// Generate Shell Completions