Skip to content

Commit 12344fe

Browse files
authored
[bazel] Bump to 7.1.0 without bzlmod (#13713)
1 parent d431dc8 commit 12344fe

File tree

10 files changed

+35
-22
lines changed

10 files changed

+35
-22
lines changed

.bazelrc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
try-import .bazelrc.local
22
try-import .bazelrc.windows.local
33

4+
# Disable bzlmod until we're ready to use it
5+
common --noenable_bzlmod
6+
47
# Ensure Windows support is accurate.
58

69
startup --windows_enable_symlinks
@@ -147,8 +150,8 @@ build:remote --//common:pin_browsers
147150
# The remote build machines are pretty small, and 50 threads may leave them
148151
# thrashing, but our dev machines are a lot larger. Scale the workload so we
149152
# make reasonable usage of everything, everywhere, all at once.
150-
build:remote --local_cpu_resources='HOST_CPUS*10'
151-
build:remote --local_ram_resources='HOST_RAM*4.0'
153+
build:remote --local_resources=cpu='HOST_CPUS*10'
154+
build:remote --local_resources=memory='HOST_RAM*4.0'
152155

153156
# A small hint that we're running our tests remotely
154157
test:remote --test_env=REMOTE_BUILD=1

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.5.0
1+
7.1.0

MODULE.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module(name = "selenium")

WORKSPACE

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ http_archive(
156156
patches = [
157157
"//java:rules_jvm_external_javadoc.patch",
158158
],
159-
sha256 = "f86fd42a809e1871ca0aabe89db0d440451219c3ce46c58da240c7dcdc00125f",
160-
strip_prefix = "rules_jvm_external-5.2",
161-
url = "https://github.com/bazelbuild/rules_jvm_external/releases/download/5.2/rules_jvm_external-5.2.tar.gz",
159+
sha256 = "85fd6bad58ac76cc3a27c8e051e4255ff9ccd8c92ba879670d195622e7c0a9b7",
160+
strip_prefix = "rules_jvm_external-6.0",
161+
url = "https://github.com/bazelbuild/rules_jvm_external/releases/download/6.0/rules_jvm_external-6.0.tar.gz",
162162
)
163163

164164
load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps")

WORKSPACE.bzlmod

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

java/private/export.bzl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,11 @@ def java_export(
9090
name = "%s.publish" % name,
9191
coordinates = maven_coordinates,
9292
pom = "%s-pom" % name,
93-
javadocs = "%s-docs" % name,
94-
artifact_jar = ":%s-maven-module" % name,
95-
source_jar = ":%s-maven-source" % name,
93+
artifact = ":%s-maven-module" % name,
94+
classifier_artifacts = {
95+
":%s-docs" % name: "javadoc",
96+
":%s-maven-source" % name: "sources",
97+
},
9698
visibility = visibility,
9799
)
98100

java/private/module.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,4 +242,5 @@ java_module = rule(
242242
cfg = "exec",
243243
),
244244
},
245+
toolchains = ["@bazel_tools//tools/jdk:toolchain_type"],
245246
)

java/private/selenium_test.bzl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ def selenium_test(name, test_class, size = "medium", browsers = DEFAULT_BROWSERS
122122
size = size,
123123
jvm_flags = BROWSERS[browser]["jvm_flags"] + jvm_flags + [
124124
"-Dselenium.browser.remote=true",
125-
"-Dselenium.browser.remote.path=$(location @selenium//java/src/org/openqa/selenium/grid:selenium_server)",
126125
],
127126
# No need to lint remote tests as the code for non-remote is the same and they get linted
128127
tags = BROWSERS[browser]["tags"] + tags + ["remote-browser", "no-lint"],

java/test/org/openqa/selenium/testing/drivers/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,6 @@ java_library(
5555
"//java/test/org/openqa/selenium/build",
5656
artifact("com.google.guava:guava"),
5757
artifact("org.junit.jupiter:junit-jupiter-api"),
58+
"@bazel_tools//tools/java/runfiles",
5859
] + JUNIT5_DEPS,
5960
)

java/test/org/openqa/selenium/testing/drivers/OutOfProcessSeleniumServer.java

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,21 @@
1919

2020
import static java.util.concurrent.TimeUnit.SECONDS;
2121

22+
import com.google.devtools.build.runfiles.Runfiles;
2223
import java.io.File;
24+
import java.io.IOException;
2325
import java.net.MalformedURLException;
2426
import java.net.URL;
27+
import java.nio.file.Files;
2528
import java.nio.file.Path;
29+
import java.nio.file.Paths;
2630
import java.util.ArrayList;
2731
import java.util.List;
2832
import java.util.Objects;
2933
import java.util.logging.Logger;
3034
import java.util.stream.Collectors;
3135
import java.util.stream.Stream;
3236
import org.openqa.selenium.Platform;
33-
import org.openqa.selenium.build.BazelBuild;
34-
import org.openqa.selenium.build.DevMode;
35-
import org.openqa.selenium.build.InProject;
3637
import org.openqa.selenium.chrome.ChromeDriverService;
3738
import org.openqa.selenium.edge.EdgeDriverService;
3839
import org.openqa.selenium.firefox.GeckoDriverService;
@@ -165,16 +166,19 @@ public void stop() {
165166
}
166167

167168
private String buildServerAndClasspath() {
168-
if (DevMode.isInDevMode()) {
169-
Path serverJar =
170-
InProject.locate("bazel-bin/java/src/org/openqa/selenium/grid/selenium_server");
171-
if (serverJar == null) {
172-
new BazelBuild().build("grid");
173-
serverJar = InProject.locate("bazel-bin/java/src/org/openqa/selenium/grid/selenium_server");
174-
}
175-
if (serverJar != null) {
176-
return serverJar.toAbsolutePath().toString();
169+
try {
170+
Runfiles.Preloaded runfiles = Runfiles.preload();
171+
String location =
172+
runfiles
173+
.unmapped()
174+
.rlocation("selenium/java/src/org/openqa/selenium/grid/selenium_server");
175+
System.err.println("Location found is: " + location);
176+
Path path = Paths.get(location);
177+
if (Files.exists(path)) {
178+
return location;
177179
}
180+
} catch (IOException e) {
181+
// Fall through
178182
}
179183

180184
if (System.getProperty("selenium.browser.remote.path") != null) {

0 commit comments

Comments
 (0)