Commit 227ac4d9 authored by Sam Pointon's avatar Sam Pointon Committed by Alyssa Ross
Browse files

buildRustCrate: fix wasm bins with hyphenated names

These are currently broken because buildRustCrate will try to mv from
an underscored name to a hyphenated name, but will only try to move an
unsuffixed name; rustc generates wasm binaries with a .wasm suffix.
parent 947f328b
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -60,8 +60,12 @@ build_bin() {
    --color ${colors} \

  if [ "$crate_name_" != "$crate_name" ]; then
    if [ -f "target/bin/$crate_name_.wasm" ]; then
      mv target/bin/$crate_name_.wasm target/bin/$crate_name.wasm
    else
      mv target/bin/$crate_name_ target/bin/$crate_name
    fi
  fi
}

build_lib_test() {
+13 −0
Original line number Diff line number Diff line
@@ -838,6 +838,19 @@ rec {
        ];
      };

      crateWasm32BinHyphens = assertOutputs {
        name = "wasm32-crate-bin-hyphens";
        mkCrate = mkCrate pkgsCross.wasm32-unknown-none.buildRustCrate;
        crateArgs = {
          crateName = "wasm32-crate-bin-hyphens";
          crateBin = [ { name = "wasm32-crate-bin-hyphens"; } ];
          src = mkBin "src/main.rs";
        };
        expectedFiles = [
          "./bin/wasm32-crate-bin-hyphens.wasm"
        ];
      };

      brotliTest =
        let
          pkg = brotliCrates.brotli_2_5_0 { };