Skip to content

Commit

Permalink
Merge pull request #766 from EverlastingBugstopper/avery/dont-require…
Browse files Browse the repository at this point in the history
…-wasm-opt

Add docs and actionable error message for failed wasm-opt executions
  • Loading branch information
ashleygwilliams authored Jan 15, 2020
2 parents a05c9ea + e8f27f2 commit b4a4585
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
14 changes: 8 additions & 6 deletions docs/src/cargo-toml-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ The available configuration options and their default values are shown below:
# the Rust compiler has finished? Using `wasm-opt` can often further decrease
# binary size or do clever tricks that haven't made their way into LLVM yet.
#
# Configuration can be set to `false` if you want to disable it (as is the
# default for the dev profile), or it can be an array of strings which are
# explicit arguments to pass to `wasm-opt`. For example `['-Os']` would optimize
# for size while `['-O4']` would execute very expensive optimizations passes
wasm-opt = false
# Configuration is set to `false` by default for the dev profile, but it can
# be set to an array of strings which are explicit arguments to pass to
# `wasm-opt`. For example `['-Os']` would optimize for size while `['-O4']`
# would execute very expensive optimizations passes
wasm-opt = ['-O']

[package.metadata.wasm-pack.profile.dev.wasm-bindgen]
# Should we enable wasm-bindgen's debug assertions in its generated JS glue?
Expand All @@ -36,8 +36,10 @@ debug-js-glue = false
demangle-name-section = true
dwarf-debug-info = false

# `wasm-opt` is on by default in for the release profile, but it can be
# disabled by setting it to `false`
[package.metadata.wasm-pack.profile.release]
wasm-opt = ['-O']
wasm-opt = false

[package.metadata.wasm-pack.profile.release.wasm-bindgen]
debug-js-glue = false
Expand Down
7 changes: 5 additions & 2 deletions src/command/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,10 @@ impl Build {
&self.out_dir,
&args,
self.mode.install_permitted(),
)?;
Ok(())
).map_err(|e| {
format_err!(
"{}\nTo disable `wasm-opt`, add `wasm-opt = false` to your package metadata in your `Cargo.toml`.", e
)
})
}
}

0 comments on commit b4a4585

Please sign in to comment.