Skip to content

Commit 74c4d27

Browse files
committed
Add firefox linux binaries for rust_wasm_bindgen_test
1 parent 4301846 commit 74c4d27

File tree

8 files changed

+88
-29
lines changed

8 files changed

+88
-29
lines changed

.bazelci/presubmit.yml

+5-10
Original file line numberDiff line numberDiff line change
@@ -1072,9 +1072,8 @@ tasks:
10721072
test_flags: *aspects_flags
10731073
build_targets:
10741074
- "//..."
1075-
# TODO: Chromedriver cannot launch chrome on linux
1076-
# test_targets:
1077-
# - "//..."
1075+
test_targets:
1076+
- "//..."
10781077
extensions_wasm_bindgen_linux_rbe:
10791078
platform: rbe_ubuntu2004
10801079
name: Extensions wasm-bindgen
@@ -1086,13 +1085,9 @@ tasks:
10861085
test_flags: *aspects_flags
10871086
build_targets:
10881087
- "//..."
1089-
# TODO: Chromedriver cannot launch chrome on linux
1090-
# test_targets:
1091-
# - "--"
1092-
# - "//..."
1093-
# # TODO: https://github.com/bazelbuild/rules_rust/issues/3039
1094-
# - "-//rules_js/test:hello_world_wasm_lib_test"
1095-
# - "-//rules_js/test:hello_world_wasm_direct_test"
1088+
test_targets:
1089+
- "--"
1090+
- "//..."
10961091
extensions_wasm_bindgen_macos:
10971092
platform: macos_arm64
10981093
name: Extensions wasm-bindgen

extensions/wasm_bindgen/.bazelrc

+9
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ common --experimental_cc_shared_library
2929
## Unique configuration groups
3030
###############################################################################
3131

32+
# Explicitly use firefox for browser tests.
33+
build:firefox --//:test_browser=firefox
34+
35+
# Explicitly use chrome for browser tests
36+
build:chrome --//:test_browser=chrome
37+
38+
# Default linux to run firefox
39+
build:linux --config=firefox
40+
3241
# Enable use of the nightly toolchains.
3342
build:nightly --@rules_rust//rust/toolchain/channel=nightly
3443

extensions/wasm_bindgen/MODULE.bazel

+3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ use_repo(
3434
"chromedriver_win32",
3535
"chromedriver_win64",
3636
"firefox",
37+
"firefox_linux_aarch64",
38+
"firefox_linux_x86_64",
39+
"firefox_local",
3740
"geckodriver",
3841
"geckodriver_linux64",
3942
"geckodriver_linux_aarch64",

extensions/wasm_bindgen/private/webdrivers/BUILD.chrome.bazel

+2-5
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ alias(
99

1010
alias(
1111
name = "chrome_linux",
12-
actual = select({
13-
"@platforms//cpu:aarch64": "@chrome_linux_aarch64",
14-
"//conditions:default": "@chrome_linux64",
15-
}),
12+
actual = "@chrome_linux64",
1613
target_compatible_with = ["@platforms//os:linux"],
1714
)
1815

@@ -28,7 +25,7 @@ alias(
2825
alias(
2926
name = "chrome",
3027
actual = select({
31-
"@platforms//os:linux": "@chrome_linux64",
28+
"@platforms//os:linux": ":chrome_linux",
3229
"@platforms//os:macos": ":chrome_macos",
3330
"@platforms//os:windows": ":chrome_windows",
3431
}),

extensions/wasm_bindgen/private/webdrivers/BUILD.chrome_headless_shell.bazel

+2-5
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ alias(
99

1010
alias(
1111
name = "chrome_headless_shell_linux",
12-
actual = select({
13-
"@platforms//cpu:aarch64": "@chrome_headless_shell_linux_aarch64",
14-
"//conditions:default": "@chrome_headless_shell_linux64",
15-
}),
12+
actual = "@chrome_headless_shell_linux64",
1613
target_compatible_with = ["@platforms//os:linux"],
1714
)
1815

@@ -28,7 +25,7 @@ alias(
2825
alias(
2926
name = "chrome_headless_shell",
3027
actual = select({
31-
"@platforms//os:linux": "@chrome_headless_shell_linux64",
28+
"@platforms//os:linux": ":chrome_headless_shell_linux",
3229
"@platforms//os:macos": ":chrome_headless_shell_macos",
3330
"@platforms//os:windows": ":chrome_headless_shell_windows",
3431
}),

extensions/wasm_bindgen/private/webdrivers/BUILD.chromedriver.bazel

+2-5
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ alias(
99

1010
alias(
1111
name = "chromedriver_linux",
12-
actual = select({
13-
"@platforms//cpu:aarch64": "@chromedriver_linux_aarch64",
14-
"//conditions:default": "@chromedriver_linux64",
15-
}),
12+
actual = "@chromedriver_linux64",
1613
target_compatible_with = ["@platforms//os:linux"],
1714
)
1815

@@ -28,7 +25,7 @@ alias(
2825
alias(
2926
name = "chromedriver",
3027
actual = select({
31-
"@platforms//os:linux": "@chromedriver_linux64",
28+
"@platforms//os:linux": ":chromedriver_linux",
3229
"@platforms//os:macos": ":chromedriver_macos",
3330
"@platforms//os:windows": ":chromedriver_windows",
3431
}),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
alias(
2+
name = "firefox_macos",
3+
actual = "@firefox_local//:firefox",
4+
target_compatible_with = ["@platforms//os:macos"],
5+
)
6+
7+
alias(
8+
name = "firefox_linux",
9+
actual = select({
10+
"@platforms//cpu:aarch64": "@firefox_linux_aarch64",
11+
"//conditions:default": "@firefox_linux_x86_64",
12+
}),
13+
target_compatible_with = ["@platforms//os:linux"],
14+
)
15+
16+
alias(
17+
name = "firefox_windows",
18+
actual = "@firefox_local//:firefox",
19+
target_compatible_with = ["@platforms//os:windows"],
20+
)
21+
22+
alias(
23+
name = "firefox",
24+
actual = select({
25+
"@platforms//os:linux": ":firefox_linux",
26+
"@platforms//os:macos": ":firefox_macos",
27+
"@platforms//os:windows": ":firefox_windows",
28+
}),
29+
visibility = ["//visibility:public"],
30+
)

extensions/wasm_bindgen/private/webdrivers/webdriver_repositories.bzl

+35-4
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ alias(
139139
)
140140
"""
141141

142-
def _local_firefox_repository_impl(repository_ctx):
142+
def _firefox_local_repository_impl(repository_ctx):
143143
repository_ctx.file("WORKSPACE.bazel", """workspace(name = "{}")""".format(
144144
repository_ctx.name,
145145
))
@@ -168,7 +168,7 @@ def _local_firefox_repository_impl(repository_ctx):
168168

169169
repository_ctx.file("BUILD.bazel", _FIREFOX_BUILD_CONTENT_WINDOWS if is_windows else _FIREFOX_BUILD_CONTENT_UNIX)
170170

171-
local_firefox_repository = repository_rule(
171+
firefox_local_repository = repository_rule(
172172
doc = """\
173173
A repository rule for wrapping the path to a host installed firefox binary
174174
@@ -177,7 +177,7 @@ Note that firefox binaries can be found here: https://ftp.mozilla.org/pub/firefo
177177
However, for platforms like MacOS and Windows, the storage formats are not something that can be extracted
178178
in a repository rule.
179179
""",
180-
implementation = _local_firefox_repository_impl,
180+
implementation = _firefox_local_repository_impl,
181181
environ = ["FIREFOX_BINARY"],
182182
)
183183

@@ -226,10 +226,41 @@ def firefox_deps():
226226
build_file = Label("//private/webdrivers:BUILD.geckodriver.bazel"),
227227
)
228228

229+
firefox_version = "136.0"
230+
231+
for platform, integrity in {
232+
"linux-aarch64": "sha256-vveh8MLGr9pl8cHtvj4T/dk1wzaxYkMMfTUTkidAgAo=",
233+
"linux-x86_64": "sha256-UiL1HKrPzK8PDPeVEX8K03Qi/p1BPvGPLBceFiK5RVo=",
234+
}.items():
235+
archive = "tar.xz"
236+
tool = "firefox"
237+
name = "firefox_{}".format(platform.replace("-", "_"))
238+
direct_deps.append(struct(repo = name))
239+
maybe(
240+
webdriver_repository,
241+
name = name,
242+
original_name = name,
243+
urls = ["https://ftp.mozilla.org/pub/firefox/releases/{version}/{platform}/en-US/firefox-{version}.{archive}".format(
244+
version = firefox_version,
245+
platform = platform,
246+
archive = archive,
247+
)],
248+
strip_prefix = "firefox",
249+
integrity = integrity,
250+
tool = tool,
251+
)
252+
253+
direct_deps.append(struct(repo = "firefox_local"))
254+
maybe(
255+
firefox_local_repository,
256+
name = "firefox_local",
257+
)
258+
229259
direct_deps.append(struct(repo = "firefox"))
230260
maybe(
231-
local_firefox_repository,
261+
build_file_repository,
232262
name = "firefox",
263+
build_file = Label("//private/webdrivers:BUILD.firefox.bazel"),
233264
)
234265

235266
return direct_deps

0 commit comments

Comments
 (0)