Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wasm-opt --version parsing #248

Merged
merged 5 commits into from Apr 6, 2021
Merged

Conversation

cmichi
Copy link
Collaborator

@cmichi cmichi commented Apr 6, 2021

Closes #247.

The issue was that binaryen includes more extensive version information in the --version output only if built from source. If installed via a package manager the version output can be more compact.

I've also escalated this into the ticket https://github.com/paritytech/ci_cd/issues/121, to install binaryen from a package manager in our CI.

@cmichi cmichi requested a review from ascjones April 6, 2021 03:10
src/cmd/build.rs Outdated
@@ -493,30 +493,37 @@ fn check_wasm_opt_version_compatibility(wasm_opt_path: &Path) -> Result<()> {
let version_stdout = str::from_utf8(&cmd.stdout)
.expect("Cannot convert stdout output of wasm-opt to string")
.trim();
let re = Regex::new(r"wasm-opt version (\d+)\s+").unwrap();
let re = Regex::new(r"wasm-opt version (\d+)").unwrap();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't spot it in the original PR but this should be an expect("invalid regex") or such.

Copy link
Collaborator Author

@cmichi cmichi Apr 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Argh! Maybe we should consider adding a clippy rule for unwrap() outside tests.

src/cmd/build.rs Outdated Show resolved Hide resolved
@ascjones
Copy link
Collaborator

ascjones commented Apr 6, 2021

This might need a 0.11.1 release

@cmichi cmichi merged commit ceb24bf into master Apr 6, 2021
@cmichi cmichi deleted the cmichi-fix-wasm-opt-version-parsing branch April 6, 2021 09:14
@cmichi cmichi mentioned this pull request Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wasm-opt version error on contract build
2 participants