Skip to content

Commit

Permalink
[Build] Format build files
Browse files Browse the repository at this point in the history
  • Loading branch information
AutomatedTester committed Oct 2, 2020
1 parent eb38212 commit 4f4c14e
Show file tree
Hide file tree
Showing 15 changed files with 220 additions and 208 deletions.
35 changes: 17 additions & 18 deletions common/private/zip_file.bzl
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@

def _expand(files, ex):
expanded = []
for f in files:
more_f = ex.expand(f)
for mf in more_f:
if not mf.is_directory:
expanded.append("%s=%s" % (mf.short_path, mf.path))
more_f = ex.expand(f)
for mf in more_f:
if not mf.is_directory:
expanded.append("%s=%s" % (mf.short_path, mf.path))

return expanded

Expand All @@ -16,7 +15,7 @@ def _zip_file_impl(ctx):
args = ctx.actions.args()
args.add_all(["Cc", output])

args.add_all([ctx.files.srcs], map_each=_expand)
args.add_all([ctx.files.srcs], map_each = _expand)

ctx.actions.run(
executable = ctx.executable._zip,
Expand All @@ -32,17 +31,17 @@ def _zip_file_impl(ctx):
zip_file = rule(
_zip_file_impl,
attrs = {
"extension": attr.string(
default = "zip",
),
"srcs": attr.label_list(
allow_empty = True,
allow_files = True,
),
"_zip": attr.label(
default = "@bazel_tools//tools/zip:zipper",
executable = True,
cfg = "host",
),
"extension": attr.string(
default = "zip",
),
"srcs": attr.label_list(
allow_empty = True,
allow_files = True,
),
"_zip": attr.label(
default = "@bazel_tools//tools/zip:zipper",
executable = True,
cfg = "host",
),
},
)
2 changes: 1 addition & 1 deletion java/client/test/org/openqa/selenium/devtools/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ java_selenium_test_suite(
"//java/client/src/org/openqa/selenium/json",
"//java/client/src/org/openqa/selenium/remote",
"//java/client/src/org/openqa/selenium/support",
"//java/client/test/org/openqa/selenium/environment:environment",
"//java/client/test/org/openqa/selenium/environment",
"//java/client/test/org/openqa/selenium/testing:annotations",
"//java/client/test/org/openqa/selenium/testing:test-base",
artifact("com.google.guava:guava"),
Expand Down
4 changes: 2 additions & 2 deletions java/client/test/org/openqa/selenium/os/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ java_test_suite(
size = "small",
srcs = glob(["*Test.java"]),
data = [
":echo"
":echo",
],
deps = [
"//java/client/src/org/openqa/selenium:core",
Expand All @@ -20,8 +20,8 @@ java_test_suite(

java_binary(
name = "echo",
main_class = "org.openqa.selenium.os.Echo",
srcs = [
"Echo.java",
],
main_class = "org.openqa.selenium.os.Echo",
)
20 changes: 10 additions & 10 deletions java/private/test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,16 @@ def java_test_suite(
)

if name in srcs:
native.test_suite(
name = "%s-suite" % name,
tests = tests,
tags = ["manual"] + tags,
visibility = visibility,
)
native.test_suite(
name = "%s-suite" % name,
tests = tests,
tags = ["manual"] + tags,
visibility = visibility,
)
else:
native.test_suite(
name = name,
tests = tests,
tags = ["manual"] + tags,
visibility = visibility,
name = name,
tests = tests,
tags = ["manual"] + tags,
visibility = visibility,
)
8 changes: 4 additions & 4 deletions java/server/src/org/openqa/selenium/grid/security/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
java_library(
name = "security",
srcs = glob(["*.java"]),
visibility = [
"//java/server/src/org/openqa/selenium/grid:__subpackages__",
"//java/server/test/org/openqa/selenium/grid:__subpackages__",
],
deps = [
"//java/client/src/org/openqa/selenium:core",
"//java/client/src/org/openqa/selenium/json",
"//java/client/src/org/openqa/selenium/remote/http",
],
visibility = [
"//java/server/src/org/openqa/selenium/grid:__subpackages__",
"//java/server/test/org/openqa/selenium/grid:__subpackages__",
]
)
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ java_library(
"//java/client/src/org/openqa/selenium/json",
"//java/client/src/org/openqa/selenium/remote",
"//java/client/src/org/openqa/selenium/remote/http",
"//java/server/src/org/openqa/selenium/grid/data",
"//java/server/src/org/openqa/selenium/status",
"//java/server/src/org/openqa/selenium/events",
"//java/server/src/org/openqa/selenium/grid/data",
"//java/server/src/org/openqa/selenium/grid/log",
"//java/server/src/org/openqa/selenium/status",
artifact("com.google.guava:guava"),
],
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ java_library(
"//java/server/src/org/openqa/selenium/grid/config",
"//java/server/src/org/openqa/selenium/grid/server",
"//java/server/src/org/openqa/selenium/grid/sessionqueue",
"//java/server/src/org/openqa/selenium/grid/sessionqueue/local",
"//java/server/src/org/openqa/selenium/grid/sessionqueue/config",
"//java/server/src/org/openqa/selenium/grid/sessionqueue/local",
"//java/server/src/org/openqa/selenium/netty/server",
artifact("com.beust:jcommander"),
artifact("com.google.guava:guava"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
load("@rules_jvm_external//:defs.bzl", "artifact")

java_library(
name = "local",
srcs = glob(["*.java"]),
visibility = [
"//java/server/src/org/openqa/selenium/grid/commands:__pkg__",
"//java/server/src/org/openqa/selenium/grid:__subpackages__",
"//java/server/src/org/openqa/selenium/grid/commands:__pkg__",
"//java/server/test/org/openqa/selenium/grid:__subpackages__",
],
deps = [
Expand All @@ -16,6 +17,6 @@ java_library(
"//java/server/src/org/openqa/selenium/grid/server",
"//java/server/src/org/openqa/selenium/grid/sessionqueue",
"//java/server/src/org/openqa/selenium/grid/sessionqueue/config",
artifact("com.google.guava:guava"),
artifact("com.google.guava:guava"),
],
)
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
load("@rules_jvm_external//:defs.bzl", "artifact")

java_library(
name = "remote",
srcs = glob(["*.java"]),
visibility = [
"//java/server/src/org/openqa/selenium/grid:__subpackages__",
"//java/server/test/org/openqa/selenium/grid/sessionqueue:__pkg__",
"//java/server/test/org/openqa/selenium/grid/router:__pkg__",
"//java/server/test/org/openqa/selenium/grid/sessionqueue:__pkg__",
],
deps = [
"//java/client/src/org/openqa/selenium/remote",
"//java/server/src/org/openqa/selenium/grid/config",
"//java/server/src/org/openqa/selenium/grid/data",
"//java/server/src/org/openqa/selenium/grid/log",
"//java/server/src/org/openqa/selenium/grid/server",
"//java/server/src/org/openqa/selenium/grid/sessionqueue",
"//java/server/src/org/openqa/selenium/grid/sessionqueue/config",
"//java/server/src/org/openqa/selenium/grid/web",
artifact("com.google.guava:guava"),
"//java/client/src/org/openqa/selenium/remote",
"//java/server/src/org/openqa/selenium/grid/config",
"//java/server/src/org/openqa/selenium/grid/data",
"//java/server/src/org/openqa/selenium/grid/log",
"//java/server/src/org/openqa/selenium/grid/server",
"//java/server/src/org/openqa/selenium/grid/sessionqueue",
"//java/server/src/org/openqa/selenium/grid/sessionqueue/config",
"//java/server/src/org/openqa/selenium/grid/web",
artifact("com.google.guava:guava"),
],
)

2 changes: 1 addition & 1 deletion java/server/test/org/openqa/selenium/events/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ java_test_suite(
artifact("junit:junit"),
artifact("org.assertj:assertj-core"),
artifact("org.zeromq:jeromq"),
]
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ java_test_suite(
size = "small",
srcs = glob(["*Test.java"]),
deps = [
"//java/client/src/org/openqa/selenium/json",
"//java/client/src/org/openqa/selenium/remote",
"//java/client/src/org/openqa/selenium/support",
"//java/client/test/org/openqa/selenium/remote/tracing:tracing-support",
Expand All @@ -16,7 +17,6 @@ java_test_suite(
"//java/server/src/org/openqa/selenium/grid/sessionqueue/local",
"//java/server/src/org/openqa/selenium/grid/sessionqueue/remote",
"//java/server/test/org/openqa/selenium/grid/testing",
"//java/client/src/org/openqa/selenium/json",
artifact("junit:junit"),
artifact("io.opentelemetry:opentelemetry-api"),
artifact("org.assertj:assertj-core"),
Expand Down
6 changes: 3 additions & 3 deletions java/server/test/org/openqa/selenium/grid/web/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ java_test_suite(
name = "SmallTests",
size = "small",
srcs = glob(["*Test.java"]),
tags = [
"no-sandbox",
],
resources = [
"packaged-file.txt",
],
tags = [
"no-sandbox",
],
deps = [
"//java/client/src/org/openqa/selenium/json",
"//java/client/src/org/openqa/selenium/remote",
Expand Down
4 changes: 2 additions & 2 deletions javascript/grid-ui/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ react_scripts(

zip_file(
name = "react_jar",
extension = "jar",
srcs = [
":build",
],
extension = "jar",
visibility = [
"//java/server/src/org/openqa/selenium/grid:__pkg__",
]
],
)
55 changes: 32 additions & 23 deletions javascript/node/selenium-webdriver/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary", "pkg_npm")
load("@npm//@bazel/jasmine:index.bzl", "jasmine_node_test")
load("//common:defs.bzl", "copy_file")

BROWSER_VERSIONS = ['v84', 'v85', 'v86']
BROWSER_VERSIONS = [
"v84",
"v85",
"v86",
]

SRC_FILES = [
"CHANGES.md",
"README.md",
Expand Down Expand Up @@ -96,33 +101,37 @@ genrule(
[copy_file(
name = "browser_protocol_" + n,
src = "//common/devtools/chromium/" + n + ":browser_protocol.json",
out = "devtools/generator/" + n + "/browser_protocol.json") for n in BROWSER_VERSIONS ]
out = "devtools/generator/" + n + "/browser_protocol.json",
) for n in BROWSER_VERSIONS]

[copy_file(
name = "js_protocol_" + n,
src = "//common/devtools/chromium/" + n + ":js_protocol.json",
out = "devtools/generator/" + n + "/js_protocol.json") for n in BROWSER_VERSIONS ]
out = "devtools/generator/" + n + "/js_protocol.json",
) for n in BROWSER_VERSIONS]

[nodejs_binary(
name = "cdp-srcs-generator-" + n,
data = [
":browser_protocol_" + n,
":js_protocol_" + n,
],
entry_point = "devtools/generator/protocol-dts-generator.js") for n in BROWSER_VERSIONS ]
name = "cdp-srcs-generator-" + n,
data = [
":browser_protocol_" + n,
":js_protocol_" + n,
],
entry_point = "devtools/generator/protocol-dts-generator.js",
) for n in BROWSER_VERSIONS]

[genrule(
name = "create-cdp-srcs-" + n,
srcs = [
":browser_protocol_" + n,
":js_protocol_" + n,
],
outs = [
"devtools/generator/" + n + "/protocol.d.js",
"devtools/generator/" + n + "/protocol-mapping.d.js",
"devtools/generator/" + n + "/protocol-proxy-api.d.js",
],
cmd = "$(location :cdp-srcs-generator-" + n + ") $(location :browser_protocol_" + n + ") $(location :js_protocol_"+ n + ") $(OUTS)",
tools = [
":cdp-srcs-generator-" + n,
]) for n in BROWSER_VERSIONS ]
name = "create-cdp-srcs-" + n,
srcs = [
":browser_protocol_" + n,
":js_protocol_" + n,
],
outs = [
"devtools/generator/" + n + "/protocol.d.js",
"devtools/generator/" + n + "/protocol-mapping.d.js",
"devtools/generator/" + n + "/protocol-proxy-api.d.js",
],
cmd = "$(location :cdp-srcs-generator-" + n + ") $(location :browser_protocol_" + n + ") $(location :js_protocol_" + n + ") $(OUTS)",
tools = [
":cdp-srcs-generator-" + n,
],
) for n in BROWSER_VERSIONS]
Loading

0 comments on commit 4f4c14e

Please sign in to comment.