Skip to content

Commit

Permalink
[bazel] Migrate to Bazel 8
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed Feb 4, 2025
1 parent 2357514 commit 7f8c243
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 19 deletions.
10 changes: 4 additions & 6 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ try-import %workspace%/.bazelrc.windows.local
# https://github.com/bazelbuild/bazel/issues/21491

common --lockfile_mode=off

# Prepare for Bazel 8. These become the default in 8.0.0
common --incompatible_disallow_empty_glob
common --incompatible_use_plus_in_repo_names
# We need this for rust and closure targets
common --enable_workspace
common --noincompatible_disallow_struct_provider_syntax

# Ensure Windows support is accurate.

Expand All @@ -30,7 +29,6 @@ build --tool_java_language_version=17
build --tool_java_runtime_version=remotejdk_17

# We target java 11 by default

build --javacopt="--release 11"

# Require java dependencies to be used and first-order
Expand All @@ -44,7 +42,7 @@ build --javacopt="-Xep:ImpossibleNullComparison:OFF"
build --nobuild_runfile_links

# More JS magic
build --experimental_allow_unresolved_symlinks
build --allow_unresolved_symlinks
# Avoid a warning about directory tracking being unsound
startup --host_jvm_args=-DBAZEL_TRACK_SOURCE_DIRECTORIES=1

Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.4.1
8.0.1
1 change: 1 addition & 0 deletions py/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ BROWSER_VERSIONS = [
]

TEST_DEPS = [
"@rules_python//python/runfiles",
requirement("attrs"),
requirement("debugpy"),
requirement("filetype"),
Expand Down
3 changes: 3 additions & 0 deletions py/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ def get_service(driver_class, executable):
if not executable:
return None

# Make sure the executable is an absolute path
executable = os.path.abspath(executable)

module = getattr(webdriver, driver_class.lower())
service = module.service.Service(executable_path=executable)

Expand Down
24 changes: 12 additions & 12 deletions py/private/browsers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,40 @@ headless_args = select({

chrome_args = select({
"@selenium//common:use_pinned_linux_chrome": [
"--driver-binary=$(location @linux_chromedriver//:chromedriver)",
"--browser-binary=$(location @linux_chrome//:chrome-linux64/chrome)",
"--driver-binary=$(rootpath @linux_chromedriver//:chromedriver)",
"--browser-binary=$(rootpath @linux_chrome//:chrome-linux64/chrome)",
"--browser-args=--disable-dev-shm-usage",
"--browser-args=--no-sandbox",
],
"@selenium//common:use_pinned_macos_chrome": [
"--driver-binary=$(location @mac_chromedriver//:chromedriver)",
"--browser-binary=$(location @mac_chrome//:Chrome.app)/Contents/MacOS/Chrome",
"--driver-binary=$(rootpath @mac_chromedriver//:chromedriver)",
"--browser-binary=$(rootpath @mac_chrome//:Chrome.app)/Contents/MacOS/Chrome",
],
"//conditions:default": [],
}) + headless_args

edge_args = select({
"@selenium//common:use_pinned_linux_edge": [
"--driver-binary=$(location @linux_edgedriver//:msedgedriver)",
"--browser-binary=$(location @linux_edge//:opt/microsoft/msedge/microsoft-edge)",
"--driver-binary=$(rootpath @linux_edgedriver//:msedgedriver)",
"--browser-binary=$(rootpath @linux_edge//:opt/microsoft/msedge/microsoft-edge)",
"--browser-args=--disable-dev-shm-usage",
"--browser-args=--no-sandbox",
],
"@selenium//common:use_pinned_macos_edge": [
"--driver-binary=$(location @mac_edgedriver//:msedgedriver)",
"--browser-binary='$(location @mac_edge//:Edge.app)/Contents/MacOS/Microsoft Edge'",
"--driver-binary=$(rootpath @mac_edgedriver//:msedgedriver)",
"--browser-binary='$(rootpath @mac_edge//:Edge.app)/Contents/MacOS/Microsoft Edge'",
],
"//conditions:default": [],
}) + headless_args

firefox_args = select({
"@selenium//common:use_pinned_linux_firefox": [
"--driver-binary=$(location @linux_geckodriver//:geckodriver)",
"--browser-binary=$(location @linux_firefox//:firefox/firefox)",
"--driver-binary=$(rootpath @linux_geckodriver//:geckodriver)",
"--browser-binary=$(rootpath @linux_firefox//:firefox/firefox)",
],
"@selenium//common:use_pinned_macos_firefox": [
"--driver-binary=$(location @mac_geckodriver//:geckodriver)",
"--browser-binary=$(location @mac_firefox//:Firefox.app)/Contents/MacOS/firefox",
"--driver-binary=$(rootpath @mac_geckodriver//:geckodriver)",
"--browser-binary=$(rootpath @mac_firefox//:Firefox.app)/Contents/MacOS/firefox",
],
"//conditions:default": [],
}) + headless_args
Expand Down
1 change: 1 addition & 0 deletions py/selenium/webdriver/common/driver_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.
import logging
import os
from pathlib import Path

from selenium.common.exceptions import NoSuchDriverException
Expand Down

0 comments on commit 7f8c243

Please sign in to comment.