Skip to content

Commit 70bb02a

Browse files
committed
[bazel] Move prebuilt selenium-manager to MODULE
1 parent 2749ec7 commit 70bb02a

File tree

5 files changed

+85
-62
lines changed

5 files changed

+85
-62
lines changed

MODULE.bazel

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,4 +325,5 @@ crate.from_cargo(
325325
)
326326
use_repo(crate, "crates")
327327

328-
register_toolchains("@rust_toolchains//:all")
328+
selenium_manager_artifacts = use_extension("//common:selenium_manager.bzl", "selenium_manager_artifacts")
329+
use_repo(selenium_manager_artifacts, "download_sm_linux", "download_sm_macos", "download_sm_windows")

MODULE.bazel.lock

Lines changed: 66 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

WORKSPACE.bzlmod

Lines changed: 2 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,8 @@
1-
workspace(
2-
name = "selenium",
3-
)
1+
workspace(name = "selenium")
42

53
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
64

7-
http_archive(
8-
name = "bazel_skylib",
9-
sha256 = "66ffd9315665bfaafc96b52278f57c7e2dd09f5ede279ea6d39b2be471e7e3aa",
10-
urls = [
11-
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.2/bazel-skylib-1.4.2.tar.gz",
12-
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.2/bazel-skylib-1.4.2.tar.gz",
13-
],
14-
)
15-
16-
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
17-
18-
bazel_skylib_workspace()
19-
20-
http_archive(
21-
name = "aspect_bazel_lib",
22-
sha256 = "f75d03783588e054899eb0729a97fb5b8973c1a26f30373fafd485c90bf207d1",
23-
strip_prefix = "bazel-lib-2.4.2",
24-
url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.4.2/bazel-lib-v2.4.2.tar.gz",
25-
)
26-
27-
load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies", "aspect_bazel_lib_register_toolchains")
28-
29-
aspect_bazel_lib_dependencies()
30-
31-
aspect_bazel_lib_register_toolchains()
32-
33-
# The go rules are often a dependency of _something_, so loading the version
34-
# we want early
35-
http_archive(
36-
name = "io_bazel_rules_go",
37-
sha256 = "6b65cb7917b4d1709f9410ffe00ecf3e160edf674b78c54a894471320862184f",
38-
urls = [
39-
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.39.0/rules_go-v0.39.0.zip",
40-
"https://github.com/bazelbuild/rules_go/releases/download/v0.39.0/rules_go-v0.39.0.zip",
41-
],
42-
)
43-
44-
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
45-
46-
go_rules_dependencies()
47-
48-
go_register_toolchains(version = "1.19.3")
49-
50-
# Stop `aspect_rules_js` and `rules_dotnet` from fighting over `aspect_bazel_lib`
51-
http_archive(
52-
name = "aspect_bazel_lib",
53-
sha256 = "4d6010ca5e3bb4d7045b071205afa8db06ec11eb24de3f023d74d77cca765f66",
54-
strip_prefix = "bazel-lib-1.39.0",
55-
url = "https://github.com/aspect-build/bazel-lib/releases/download/v1.39.0/bazel-lib-v1.39.0.tar.gz",
56-
)
5+
# rules_closure are not published to BCR.
576

587
http_archive(
598
name = "io_bazel_rules_closure",
@@ -76,10 +25,6 @@ rules_closure_dependencies()
7625

7726
rules_closure_toolchains()
7827

79-
load("//common:selenium_manager.bzl", "selenium_manager")
80-
81-
selenium_manager()
82-
8328
load("//common:repositories.bzl", "pin_browsers")
8429

8530
pin_browsers()

common/selenium_manager.bzl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,10 @@ def selenium_manager():
2323
sha256 = "13bd63fa51a75bbf1b98beb221edceed3f33bacf2e3b25cd39ef4e6ac84371eb",
2424
url = "https://github.com/SeleniumHQ/selenium_manager_artifacts/releases/download/selenium-manager-6a15586/selenium-manager-windows.exe",
2525
)
26+
27+
def _selenium_manager_artifacts_impl(_ctx):
28+
selenium_manager()
29+
30+
selenium_manager_artifacts = module_extension(
31+
implementation = _selenium_manager_artifacts_impl,
32+
)

scripts/selenium_manager.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ def selenium_manager():
7474
content = content + print_linux(base_url, sha_dict['linux'])
7575
content = content + print_macos(base_url, sha_dict['macos'])
7676
content = content + print_windows(base_url, sha_dict['windows'])
77+
content += """
78+
def _selenium_manager_artifacts_impl(_ctx):
79+
selenium_manager()
80+
81+
selenium_manager_artifacts = module_extension(
82+
implementation = _selenium_manager_artifacts_impl,
83+
)
84+
"""
7785

7886
current_script_dir = Path(os.path.realpath(__file__)).parent
7987
target_file_path = current_script_dir.parent / "common/selenium_manager.bzl"

0 commit comments

Comments
 (0)