Skip to content

Commit

Permalink
Check wasm optimized output file exists (use-ink#243)
Browse files Browse the repository at this point in the history
* Check wasm optimized output file exists

* Fmt

* Add expected optimized file to error

* Use display for path
  • Loading branch information
ascjones authored Mar 30, 2021
1 parent 5f0788e commit b5a1b0d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/cmd/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,13 @@ fn optimize_wasm(
optimization_passes,
)?;

if !dest_optimized.exists() {
return Err(anyhow::anyhow!(
"Optimization failed, optimized wasm output file `{}` not found.",
dest_optimized.display()
));
}

let original_size = metadata(&crate_metadata.dest_wasm)?.len() as f64 / 1000.0;
let optimized_size = metadata(&dest_optimized)?.len() as f64 / 1000.0;

Expand Down

0 comments on commit b5a1b0d

Please sign in to comment.