Skip to content

Commit ecd6ef3

Browse files
committed
Added rust_wasm_bindgen_test rule
1 parent ceb2199 commit ecd6ef3

35 files changed

+2310
-34
lines changed

.bazelci/presubmit.yml

+12-8
Original file line numberDiff line numberDiff line change
@@ -1073,12 +1073,15 @@ tasks:
10731073
platform: ubuntu2004
10741074
name: Extensions wasm-bindgen
10751075
working_directory: extensions/wasm_bindgen
1076+
shell_commands:
1077+
- "sudo apt -y update && sudo apt -y install libxcb1 libatk1.0-0 libatk-bridge2.0-0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 libgbm1 libpango-1.0-0 libxkbcommon-x11-0 libcairo2"
10761078
build_flags: *aspects_flags
10771079
test_flags: *aspects_flags
10781080
build_targets:
10791081
- "//..."
1080-
test_targets:
1081-
- "//..."
1082+
# TODO: Chromedriver cannot launch chrome on linux
1083+
# test_targets:
1084+
# - "//..."
10821085
extensions_wasm_bindgen_linux_rbe:
10831086
platform: rbe_ubuntu2004
10841087
name: Extensions wasm-bindgen
@@ -1090,12 +1093,13 @@ tasks:
10901093
test_flags: *aspects_flags
10911094
build_targets:
10921095
- "//..."
1093-
test_targets:
1094-
- "--"
1095-
- "//..."
1096-
# TODO: https://github.com/bazelbuild/rules_rust/issues/3039
1097-
- "-//rules_js/test:hello_world_wasm_lib_test"
1098-
- "-//rules_js/test:hello_world_wasm_direct_test"
1096+
# TODO: Chromedriver cannot launch chrome on linux
1097+
# test_targets:
1098+
# - "--"
1099+
# - "//..."
1100+
# # TODO: https://github.com/bazelbuild/rules_rust/issues/3039
1101+
# - "-//rules_js/test:hello_world_wasm_lib_test"
1102+
# - "-//rules_js/test:hello_world_wasm_direct_test"
10991103
extensions_wasm_bindgen_macos:
11001104
platform: macos_arm64
11011105
name: Extensions wasm-bindgen

extensions/wasm_bindgen/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
/bazel-*
55
user.bazelrc
66

7+
# Test Browsers
8+
browsers/
9+
710
# rust-analyzer
811
rust-project.json
912

extensions/wasm_bindgen/3rdparty/BUILD.bazel

+16
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ crates_vendor(
3333
"wasm-bindgen": crate.spec(
3434
version = WASM_BINDGEN_VERSION,
3535
),
36+
"wasm-bindgen-test": crate.spec(
37+
version = "0.3.37",
38+
),
3639
},
3740
# Shorten the repository name to avoid MAX_PATH issues on Windows
3841
# `rules_rust_wasm_bindgen_deps` == `rrwbd`
@@ -47,12 +50,25 @@ alias(
4750
visibility = ["//visibility:public"],
4851
)
4952

53+
alias(
54+
name = "wasm_bindgen_test_runner",
55+
actual = "@rules_rust_wasm_bindgen_cli//:test_runner",
56+
tags = ["manual"],
57+
visibility = ["//visibility:public"],
58+
)
59+
5060
alias(
5161
name = "wasm_bindgen",
5262
actual = "//3rdparty/crates:wasm-bindgen",
5363
visibility = ["//visibility:public"],
5464
)
5565

66+
alias(
67+
name = "wasm_bindgen_test",
68+
actual = "//3rdparty/crates:wasm-bindgen-test",
69+
visibility = ["//visibility:public"],
70+
)
71+
5672
bzl_library(
5773
name = "bzl_lib",
5874
srcs = [

extensions/wasm_bindgen/3rdparty/BUILD.wasm-bindgen-cli.bazel

+34-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ exports_files([
1212
# TODO: Comment on bootstrapping
1313
rust_binary(
1414
name = "wasm-bindgen-cli",
15-
srcs = glob(["**/*.rs"]),
15+
srcs = glob(
16+
include = ["**/*.rs"],
17+
exclude = ["src/bin/wasm-bindgen-test-runner/**"],
18+
),
1619
aliases = aliases(),
1720
crate_features = [
1821
],
@@ -33,3 +36,33 @@ alias(
3336
actual = ":wasm-bindgen-cli",
3437
tags = ["manual"],
3538
)
39+
40+
rust_binary(
41+
name = "wasm-bindgen-test-runner",
42+
srcs = glob(
43+
include = ["**/*.rs"],
44+
exclude = ["src/bin/wasm-bindgen.rs"],
45+
),
46+
aliases = aliases(),
47+
compile_data = glob([
48+
"**/*.html",
49+
]),
50+
crate_features = [
51+
],
52+
crate_root = "src/bin/wasm-bindgen-test-runner/main.rs",
53+
data = [],
54+
edition = "2018",
55+
proc_macro_deps = all_crate_deps(proc_macro = True),
56+
rustc_flags = [
57+
# Don't produce warnings for this crate
58+
"--cap-lints=allow",
59+
],
60+
version = WASM_BINDGEN_VERSION,
61+
deps = all_crate_deps(),
62+
)
63+
64+
alias(
65+
name = "test_runner",
66+
actual = ":wasm-bindgen-test-runner",
67+
tags = ["manual"],
68+
)

extensions/wasm_bindgen/3rdparty/Cargo.Bazel.lock

+78
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extensions/wasm_bindgen/3rdparty/crates/BUILD.bazel

+24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extensions/wasm_bindgen/3rdparty/crates/BUILD.js-sys-0.3.77.bazel

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)