Skip to content

Commit ec0f0f9

Browse files
committed
add snippets
1 parent bba2ca7 commit ec0f0f9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

wasm_bindgen/private/wasm_bindgen.bzl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,16 @@ def rust_wasm_bindgen_action(ctx, toolchain, wasm_file, target_output, bindgen_f
5252

5353
bindgen_wasm_module = ctx.actions.declare_file(ctx.label.name + "_bg.wasm")
5454

55+
out_dir = ctx.label.name.split("/")
56+
out_name = out_dir.pop()
57+
out_dir_name = "/".join(out_dir)
58+
5559
js_out = [ctx.actions.declare_file(ctx.label.name + ".js")]
5660
ts_out = [ctx.actions.declare_file(ctx.label.name + ".d.ts")]
5761

62+
if target_output == "web" or target_output == "bundler":
63+
js_out.append(ctx.actions.declare_directory(out_dir_name + "/snippets"))
64+
5865
if target_output == "bundler":
5966
js_out.append(ctx.actions.declare_file(ctx.label.name + "_bg.js"))
6067
ts_out.append(ctx.actions.declare_file(ctx.label.name + "_bg.wasm.d.ts"))
@@ -64,7 +71,7 @@ def rust_wasm_bindgen_action(ctx, toolchain, wasm_file, target_output, bindgen_f
6471
args = ctx.actions.args()
6572
args.add("--target", target_output)
6673
args.add("--out-dir", bindgen_wasm_module.dirname)
67-
args.add("--out-name", ctx.label.name.split("/").pop())
74+
args.add("--out-name", out_name)
6875
args.add_all(bindgen_flags)
6976
args.add(input_file)
7077

@@ -75,6 +82,9 @@ def rust_wasm_bindgen_action(ctx, toolchain, wasm_file, target_output, bindgen_f
7582
mnemonic = "RustWasmBindgen",
7683
progress_message = "Generating WebAssembly bindings for {}...".format(progress_message_label),
7784
arguments = [args],
85+
env = {
86+
"RUST_LOG": "debug",
87+
},
7888
)
7989

8090
return RustWasmBindgenInfo(

0 commit comments

Comments
 (0)