Skip to content

Commit 04c9b32

Browse files
authored
Merge pull request #1764 from fitzgen/multi-value-xform
Use multi-value with interface types
2 parents a1dfa4b + b2d1165 commit 04c9b32

File tree

19 files changed

+787
-143
lines changed

19 files changed

+787
-143
lines changed

azure-pipelines.yml

+42-20
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ jobs:
1414
toolchain: nightly
1515
- template: ci/azure-install-node.yml
1616
- template: ci/azure-install-geckodriver.yml
17-
- template: ci/azure-install-sccache.yml
17+
# Temporarily disable sccache because it is failing on CI.
18+
# - template: ci/azure-install-sccache.yml
1819
- script: cargo test
1920
displayName: "Builds on native"
2021
- script: cargo test --target wasm32-unknown-unknown
@@ -31,6 +32,8 @@ jobs:
3132
displayName: "Futures test suite on native"
3233
- script: cargo test -p wasm-bindgen-futures --target wasm32-unknown-unknown
3334
displayName: "Futures test suite on wasm"
35+
- script: cargo test -p wasm-bindgen-multi-value-xform
36+
displayName: "multi-value xform tests on native"
3437
- script: |
3538
set -e
3639
curl https://nodejs.org/download/nightly/v13.0.0-nightly2019081215b2d13310/node-v13.0.0-nightly2019081215b2d13310-linux-x64.tar.xz | tar xJf -
@@ -56,7 +59,8 @@ jobs:
5659
toolchain: nightly
5760
- template: ci/azure-install-node.yml
5861
- template: ci/azure-install-geckodriver.yml
59-
- template: ci/azure-install-sccache.yml
62+
# Temporarily disable sccache because it is failing on CI.
63+
# - template: ci/azure-install-sccache.yml
6064
- script: cargo test --target wasm32-unknown-unknown
6165
displayName: "wasm-bindgen test suite"
6266
env:
@@ -78,14 +82,16 @@ jobs:
7882
parameters:
7983
toolchain: nightly
8084
- template: ci/azure-install-node.yml
81-
- template: ci/azure-install-sccache.yml
85+
# Temporarily disable sccache because it is failing on CI.
86+
# - template: ci/azure-install-sccache.yml
8287
- script: cargo test --target wasm32-unknown-unknown --features nightly --test wasm
8388

8489
- job: test_cli
8590
displayName: "Run wasm-bindgen-cli crate tests"
8691
steps:
8792
- template: ci/azure-install-rust.yml
88-
- template: ci/azure-install-sccache.yml
93+
# Temporarily disable sccache because it is failing on CI.
94+
# - template: ci/azure-install-sccache.yml
8995
- script: rustup target add wasm32-unknown-unknown
9096
displayName: "install wasm target"
9197
- script: cargo test -p wasm-bindgen-cli-support
@@ -102,7 +108,8 @@ jobs:
102108
toolchain: nightly
103109
- template: ci/azure-install-node.yml
104110
- template: ci/azure-install-geckodriver.yml
105-
- template: ci/azure-install-sccache.yml
111+
# Temporarily disable sccache because it is failing on CI.
112+
# - template: ci/azure-install-sccache.yml
106113
- script: cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown
107114
- script: cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features Node
108115
- script: cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features Element
@@ -118,7 +125,8 @@ jobs:
118125
toolchain: nightly
119126
- template: ci/azure-install-node.yml
120127
- template: ci/azure-install-geckodriver.yml
121-
- template: ci/azure-install-sccache.yml
128+
# Temporarily disable sccache because it is failing on CI.
129+
# - template: ci/azure-install-sccache.yml
122130
- script: cargo test -p js-sys --target wasm32-unknown-unknown
123131

124132
- job: test_webidl
@@ -129,7 +137,8 @@ jobs:
129137
parameters:
130138
toolchain: nightly
131139
- template: ci/azure-install-node.yml
132-
#- template: ci/azure-install-sccache.yml
140+
# Temporarily disable sccache because it is failing on CI.
141+
# - template: ci/azure-install-sccache.yml
133142
- script: cargo test -p wasm-bindgen-webidl
134143
- script: cargo test -p webidl-tests --target wasm32-unknown-unknown
135144
env:
@@ -143,19 +152,23 @@ jobs:
143152
parameters:
144153
toolchain: nightly
145154
- template: ci/azure-install-node.yml
146-
- template: ci/azure-install-sccache.yml
155+
# Temporarily disable sccache because it is failing on CI.
156+
# - template: ci/azure-install-sccache.yml
147157
- script: cargo test -p wasm-bindgen-macro
148158

149159
- job: test_wasm_interpreter
150160
displayName: "Run wasm-bindgen-wasm-interpreter tests"
151161
steps:
152162
- template: ci/azure-install-rust.yml
153-
- template: ci/azure-install-sccache.yml
163+
# Temporarily disable sccache because it is failing on CI.
164+
# - template: ci/azure-install-sccache.yml
154165
- script: |
155166
git clone https://github.com/WebAssembly/wabt
156167
mkdir -p wabt/build
157168
cd wabt/build
158-
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=off -DCMAKE_CXX_COMPILER_LAUNCHER=$RUSTC_WRAPPER
169+
# Temporarily disable sccache because it is failing on CI.
170+
# cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=off -DCMAKE_CXX_COMPILER_LAUNCHER=$RUSTC_WRAPPER
171+
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=off
159172
cmake --build . -- -j$(nproc)
160173
echo "##vso[task.prependpath]$PWD"
161174
- script: cargo test -p wasm-bindgen-wasm-interpreter
@@ -164,7 +177,8 @@ jobs:
164177
displayName: "Test TypeScript output of wasm-bindgen"
165178
steps:
166179
- template: ci/azure-install-rust.yml
167-
- template: ci/azure-install-sccache.yml
180+
# Temporarily disable sccache because it is failing on CI.
181+
# - template: ci/azure-install-sccache.yml
168182
- template: ci/azure-install-node.yml
169183
- script: cd crates/typescript-tests && ./run.sh
170184

@@ -175,7 +189,8 @@ jobs:
175189
# TODO: switch this back to `stable` when async/await is stable
176190
parameters:
177191
toolchain: nightly
178-
- template: ci/azure-install-sccache.yml
192+
# Temporarily disable sccache because it is failing on CI.
193+
# - template: ci/azure-install-sccache.yml
179194
- template: ci/azure-install-wasm-pack.yml
180195
- script: mv _package.json package.json && npm install && rm package.json
181196
displayName: "run npm install"
@@ -197,7 +212,8 @@ jobs:
197212
- template: ci/azure-install-rust.yml
198213
parameters:
199214
toolchain: nightly-2019-08-27
200-
- template: ci/azure-install-sccache.yml
215+
# Temporarily disable sccache because it is failing on CI.
216+
# - template: ci/azure-install-sccache.yml
201217
- script: rustup component add rust-src
202218
displayName: "install rust-src"
203219
- script: cargo install xargo
@@ -220,7 +236,8 @@ jobs:
220236
# TODO: switch this back to `stable` when async/await is stable
221237
parameters:
222238
toolchain: nightly
223-
- template: ci/azure-install-sccache.yml
239+
# Temporarily disable sccache because it is failing on CI.
240+
# - template: ci/azure-install-sccache.yml
224241
- template: ci/azure-install-wasm-pack.yml
225242
- script: wasm-pack build --target web benchmarks
226243
displayName: "build benchmarks"
@@ -235,7 +252,8 @@ jobs:
235252
displayName: "Dist Linux binary"
236253
steps:
237254
- template: ci/azure-install-rust.yml
238-
- template: ci/azure-install-sccache.yml
255+
# Temporarily disable sccache because it is failing on CI.
256+
# - template: ci/azure-install-sccache.yml
239257
- script: rustup target add x86_64-unknown-linux-musl
240258
- script: |
241259
sudo apt update -y
@@ -258,7 +276,8 @@ jobs:
258276
vmImage: macOS-10.13
259277
steps:
260278
- template: ci/azure-install-rust.yml
261-
- template: ci/azure-install-sccache.yml
279+
# Temporarily disable sccache because it is failing on CI.
280+
# - template: ci/azure-install-sccache.yml
262281
- script: cargo build --manifest-path crates/cli/Cargo.toml --release
263282
env:
264283
MACOSX_DEPLOYMENT_TARGET: 10.7
@@ -272,15 +291,17 @@ jobs:
272291
vmImage: vs2017-win2016
273292
steps:
274293
- template: ci/azure-install-rust.yml
275-
- template: ci/azure-install-sccache.yml
294+
# Temporarily disable sccache because it is failing on CI.
295+
# - template: ci/azure-install-sccache.yml
276296
- script: cargo build --manifest-path crates/cli/Cargo.toml --release
277297
env:
278298
RUSTFLAGS: -Ctarget-feature=+crt-static
279299
- template: ci/azure-create-tarball.yml
280300
parameters:
281301
name: dist_windows
282-
- script: "%RUSTC_WRAPPER% -s"
283-
- script: cat sccache.log
302+
# Temporarily disable sccache because it is failing on CI.
303+
# - script: "%RUSTC_WRAPPER% -s"
304+
# - script: cat sccache.log
284305

285306
- job: doc_book
286307
displayName: "Doc - build the book"
@@ -306,7 +327,8 @@ jobs:
306327
# Install rustfmt so we can format the web-sys bindings
307328
- script: rustup component add rustfmt
308329
displayName: "Install rustfmt"
309-
- template: ci/azure-install-sccache.yml
330+
# Temporarily disable sccache because it is failing on CI.
331+
# - template: ci/azure-install-sccache.yml
310332
- script: cargo doc --no-deps --features 'nightly serde-serialize'
311333
displayName: "Document wasm-bindgen"
312334
- script: cargo doc --no-deps --manifest-path crates/js-sys/Cargo.toml

crates/anyref-xform/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ edition = '2018'
1313

1414
[dependencies]
1515
failure = "0.1"
16-
walrus = "0.11.0"
16+
walrus = "0.12.0"

crates/cli-support/Cargo.toml

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ log = "0.4"
1818
rustc-demangle = "0.1.13"
1919
serde_json = "1.0"
2020
tempfile = "3.0"
21-
walrus = "0.11.0"
21+
walrus = "0.12.0"
2222
wasm-bindgen-anyref-xform = { path = '../anyref-xform', version = '=0.2.50' }
2323
wasm-bindgen-shared = { path = "../shared", version = '=0.2.50' }
24+
wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.50' }
2425
wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.50' }
26+
wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.50' }
2527
wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.50' }
26-
wasm-webidl-bindings = "0.4.0"
28+
wasm-webidl-bindings = "0.5.0"

crates/cli-support/src/js/mod.rs

+17-12
Original file line numberDiff line numberDiff line change
@@ -465,12 +465,10 @@ impl<'a> Context<'a> {
465465
};
466466

467467
let default_module_path = match self.config.mode {
468-
OutputMode::Web => {
469-
"\
468+
OutputMode::Web => "\
470469
if (typeof module === 'undefined') {
471470
module = import.meta.url.replace(/\\.js$/, '_bg.wasm');
472-
}"
473-
}
471+
}",
474472
_ => "",
475473
};
476474

@@ -872,21 +870,30 @@ impl<'a> Context<'a> {
872870

873871
match self.config.encode_into {
874872
EncodeInto::Always if !shared => {
875-
self.global(&format!("
873+
self.global(&format!(
874+
"
876875
const encodeString = {};
877-
", encode_into));
876+
",
877+
encode_into
878+
));
878879
}
879880
EncodeInto::Test if !shared => {
880-
self.global(&format!("
881+
self.global(&format!(
882+
"
881883
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
882884
? {}
883885
: {});
884-
", encode_into, encode));
886+
",
887+
encode_into, encode
888+
));
885889
}
886890
_ => {
887-
self.global(&format!("
891+
self.global(&format!(
892+
"
888893
const encodeString = {};
889-
", encode));
894+
",
895+
encode
896+
));
890897
}
891898
}
892899

@@ -1080,7 +1087,6 @@ impl<'a> Context<'a> {
10801087
fields: Vec::new(),
10811088
})?;
10821089
self.global(&format!("let cached{} = new {}{};", s, name, args));
1083-
10841090
} else if !self.config.mode.always_run_in_browser() {
10851091
self.global(&format!(
10861092
"
@@ -1090,7 +1096,6 @@ impl<'a> Context<'a> {
10901096
s
10911097
));
10921098
self.global(&format!("let cached{0} = new l{0}{1};", s, args));
1093-
10941099
} else {
10951100
self.global(&format!("let cached{0} = new {0}{1};", s, args));
10961101
}

0 commit comments

Comments
 (0)