bytecodealliance / cargo-wasi

A lightweight Cargo subcommand to build Rust code for the `wasm32-wasi` target
https://bytecodealliance.github.io/cargo-wasi/
Apache License 2.0
444 stars 29 forks source link

Refactor to support downloading multiple files #118

Closed jeffcharles closed 2 years ago

jeffcharles commented 2 years ago

Context

Continuing along with work to support Apple Silicon, we need to be able to extract multiple files that are in subdirectories when downloading wasm-opt. This is because wasm-opt needs to load ../lib/libbinaryen.dylib.

What this PR does

It changes download to accept a parent directory and a collection of subpaths that may contain subdirectories. This will enable things like specifying a parent directory of wasm-opt and subpaths bin/wasm-opt and lib/libbinaryen.dylib when downloading wasm-opt.

Why this change

I wanted to isolate the parts of the stack being changed as opposed to propagating subpaths all the way through from get_wasm_opt and get_wasm_bindgen to make the PR easier to review. I'm open to adjusting callers up the stack such that they create the collection of subpaths if that would be preferred.

alexcrichton commented 2 years ago

👍