Fix non-release builds
This commit is contained in:
parent
4f199d5d35
commit
d28b66a2a7
1 changed files with 27 additions and 16 deletions
43
build.rs
43
build.rs
|
|
@ -60,22 +60,33 @@ fn main() {
|
||||||
}
|
}
|
||||||
set_current_dir(&starting_dir);
|
set_current_dir(&starting_dir);
|
||||||
|
|
||||||
// FIXME: Deduplicate this with the initial walk all .rs pattern
|
if var("PROFILE").unwrap() == "release" {
|
||||||
for entry in fs::read_dir(alt_target.join("wasm32-wasi/release/")).unwrap() {
|
// FIXME: Deduplicate this with the initial walk all .rs pattern
|
||||||
let entry = entry.unwrap().path();
|
for entry in fs::read_dir(alt_target.join("wasm32-wasi/release/")).unwrap() {
|
||||||
let ext = entry.extension();
|
let entry = entry.unwrap().path();
|
||||||
if ext.is_some() && ext.unwrap() == "wasm" {
|
let ext = entry.extension();
|
||||||
dbg!(&entry);
|
if ext.is_some() && ext.unwrap() == "wasm" {
|
||||||
Command::new("wasm-opt")
|
dbg!(&entry);
|
||||||
.arg("-O")
|
Command::new("wasm-opt")
|
||||||
.arg(entry.as_os_str())
|
.arg("-O")
|
||||||
.arg("-o")
|
.arg(entry.as_os_str())
|
||||||
.arg(format!(
|
.arg("-o")
|
||||||
"assets/plugins/{}",
|
.arg(format!(
|
||||||
entry.file_name().unwrap().to_string_lossy()
|
"assets/plugins/{}",
|
||||||
))
|
entry.file_name().unwrap().to_string_lossy()
|
||||||
.status()
|
))
|
||||||
.unwrap();
|
.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()
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue