Normalize - to _ in resulting Wasm file names (#9644)

This PR updates the extension builder to normalize `-` to `_` in the
Rust package names when computing the resulting `.wasm` file name.

The `wasm32-wasi` target does this normalization internally already, so
we need to do the same to ensure we're looking for the resulting `.wasm`
file in the right spot.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-03-21 11:48:08 -04:00 committed by GitHub
parent 3831088251
commit 1f21088591
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -138,7 +138,11 @@ impl ExtensionBuilder {
"target", "target",
RUST_TARGET, RUST_TARGET,
if options.release { "release" } else { "debug" }, if options.release { "release" } else { "debug" },
cargo_toml.package.name.as_str(), &cargo_toml
.package
.name
// The wasm32-wasi target normalizes `-` in package names to `_` in the resulting `.wasm` file.
.replace('-', "_"),
]); ]);
wasm_path.set_extension("wasm"); wasm_path.set_extension("wasm");