-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setting up bazel build rules for javascript stuff.
I've covered most of the major stuff (excluding selenium-core). The closure bazel build rules are really strict and our code has hundreds of errors, so I've configured everything to suppress warnings; we can clean up later. There's one exception in selenium-atoms/text.js, where the build caught a reference to a variable that doesn't exist anymore - since I happened to notice that warning in particular, I went ahead and fixed it. With this change, I can `bazel build //javascript/...` using: $ bazel version Starting local Bazel server and connecting to it... Build label: 0.24.1 Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar Build time: Tue Apr 2 16:29:26 2019 (1554222566) Build timestamp: 1554222566 Build timestamp as int: 1554222566
- Loading branch information
Showing
13 changed files
with
730 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,16 @@ | ||
workspace(name = "selenium") | ||
|
||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
http_archive( | ||
name = "io_bazel_rules_closure", | ||
sha256 = "b29a8bc2cb10513c864cb1084d6f38613ef14a143797cea0af0f91cd385f5e8c", | ||
strip_prefix = "rules_closure-0.8.0", | ||
sha256 = "bc7b6edd8684953b851300ef7fa122f4e6e9ed52f509a13724e49ffddb9a14eb", | ||
strip_prefix = "rules_closure-d1110778a2e94bcdac5d5d00044dcb6cd07f1d51", | ||
urls = [ | ||
"https://mirror.bazel.build/github.com/bazelbuild/rules_closure/archive/0.8.0.tar.gz", | ||
"https://github.com/bazelbuild/rules_closure/archive/0.8.0.tar.gz", | ||
"https://github.com/bazelbuild/rules_closure/archive/d1110778a2e94bcdac5d5d00044dcb6cd07f1d51.tar.gz", | ||
], | ||
) | ||
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_repositories") | ||
closure_repositories() | ||
|
||
git_repository( | ||
name = "windows_cc_config_init", | ||
remote = "https://github.com/excitoon/bazel-win32-toolchain", | ||
commit = "40000006ca052634bed4a870e89cecf957ea3344" | ||
) | ||
|
||
load("@windows_cc_config_init//:windows_toolchain.bzl", "windows_toolchain") | ||
windows_toolchain( | ||
name = "windows_cc_config" | ||
) | ||
|
||
git_repository( | ||
name = "io_bazel_rules_dotnet", | ||
remote = "https://github.com/bazelbuild/rules_dotnet", | ||
commit = "bdfc24001b2463dbdb483b1fd9cd6420002adc7d" | ||
) | ||
|
||
load("@io_bazel_rules_dotnet//dotnet:defs.bzl", "dotnet_register_toolchains", "dotnet_repositories", "dotnet_nuget_new") | ||
|
||
dotnet_repositories() | ||
dotnet_register_toolchains(net_version="4.5") | ||
|
||
dotnet_nuget_new( | ||
name = "json.net", | ||
package = "newtonsoft.json", | ||
version = "11.0.2", | ||
build_file_content = """ | ||
package(default_visibility = [ "//visibility:public" ]) | ||
load("@io_bazel_rules_dotnet//dotnet:defs.bzl", "net_import_library", "core_import_library") | ||
net_import_library( | ||
name = "net35", | ||
src = "lib/net35/Newtonsoft.Json.dll" | ||
) | ||
net_import_library( | ||
name = "net40", | ||
src = "lib/net40/Newtonsoft.Json.dll" | ||
) | ||
net_import_library( | ||
name = "net45", | ||
src = "lib/net45/Newtonsoft.Json.dll" | ||
) | ||
core_import_library( | ||
name = "netcore", | ||
src = "lib/netstandard2.0/Newtonsoft.Json.dll" | ||
) | ||
""" | ||
) | ||
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_repositories") | ||
|
||
closure_repositories() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# BUILD file required (even if empty) so bazel can load .bzl extensions in this directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,227 @@ | ||
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library") | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
closure_js_library( | ||
name = "action", | ||
srcs = ["action.js"], | ||
suppress = [ | ||
"JSC_IMPLICITLY_NULLABLE_JSDOC", | ||
"JSC_STRICT_INEXISTENT_PROPERTY", | ||
"JSC_UNKNOWN_EXPR_TYPE", | ||
], | ||
deps = [ | ||
":bot", | ||
":devices", | ||
":dom", | ||
":errors", | ||
":events", | ||
"@io_bazel_rules_closure//closure/library", | ||
], | ||
) | ||
|
||
closure_js_library( | ||
name = "bot", | ||
srcs = ["bot.js"], | ||
) | ||
|
||
closure_js_library( | ||
name = "color", | ||
srcs = ["color.js"], | ||
deps = [ | ||
"@io_bazel_rules_closure//closure/library", | ||
], | ||
) | ||
|
||
closure_js_library( | ||
name = "devices", | ||
srcs = [ | ||
"device.js", | ||
"keyboard.js", | ||
"mouse.js", | ||
"touchscreen.js", | ||
], | ||
suppress = [ | ||
"JSC_IMPLICITLY_NULLABLE_JSDOC", | ||
"JSC_MISSING_CONST_PROPERTY", | ||
"JSC_NULLABLE_RETURN_WITH_NAME", | ||
"JSC_STRICT_INEXISTENT_PROPERTY", | ||
"JSC_UNKNOWN_EXPR_TYPE", | ||
], | ||
deps = [ | ||
":bot", | ||
":dom", | ||
":errors", | ||
":events", | ||
":locators", | ||
":useragent", | ||
"@io_bazel_rules_closure//closure/library", | ||
], | ||
) | ||
|
||
closure_js_library( | ||
name = "domcore", | ||
srcs = ["domcore.js"], | ||
suppress = [ | ||
"JSC_IMPLICITLY_NULLABLE_JSDOC", | ||
"JSC_STRICT_INEXISTENT_PROPERTY", | ||
"JSC_UNKNOWN_EXPR_TYPE", | ||
], | ||
deps = [ | ||
":errors", | ||
":useragent", | ||
"@io_bazel_rules_closure//closure/library", | ||
], | ||
) | ||
|
||
closure_js_library( | ||
name = "dom", | ||
srcs = ["dom.js"], | ||
suppress = [ | ||
"JSC_IMPLICITLY_NULLABLE_JSDOC", | ||
"JSC_STRICT_INEXISTENT_PROPERTY", | ||
"JSC_UNKNOWN_EXPR_TYPE", | ||
], | ||
deps = [ | ||
":bot", | ||
":color", | ||
":domcore", | ||
":json", | ||
":useragent", | ||
":xpath", | ||
"@io_bazel_rules_closure//closure/library", | ||
], | ||
) | ||
|
||
closure_js_library( | ||
name = "errors", | ||
srcs = [ | ||
"error.js", | ||
"response.js", | ||
], | ||
suppress = [ | ||
"JSC_IMPLICITLY_NULLABLE_JSDOC", | ||
"JSC_MISSING_CONST_PROPERTY", | ||
"JSC_STRICT_INEXISTENT_PROPERTY", | ||
"JSC_UNKNOWN_EXPR_TYPE", | ||
], | ||
) | ||
|
||
closure_js_library( | ||
name = "events", | ||
srcs = ["events.js"], | ||
suppress = [ | ||
"JSC_IMPLICITLY_NULLABLE_JSDOC", | ||
"JSC_MISSING_CONST_PROPERTY", | ||
"JSC_STRICT_INEXISTENT_PROPERTY", | ||
"JSC_UNKNOWN_EXPR_TYPE", | ||
], | ||
deps = [ | ||
":bot", | ||
":dom", | ||
":errors", | ||
":json", | ||
":useragent", | ||
"@io_bazel_rules_closure//closure/library", | ||
], | ||
) | ||
|
||
closure_js_library( | ||
name = "html5", | ||
srcs = glob(["html5/*.js"]), | ||
deps = [ | ||
":bot", | ||
":errors", | ||
":json", | ||
":useragent", | ||
"@io_bazel_rules_closure//closure/library/useragent:all_js", | ||
], | ||
) | ||
|
||
closure_js_library( | ||
name = "inject", | ||
srcs = ["inject.js"], | ||
suppress = [ | ||
"JSC_IMPLICITLY_NULLABLE_JSDOC", | ||
"JSC_STRICT_INEXISTENT_PROPERTY", | ||
"JSC_UNKNOWN_EXPR_TYPE", | ||
], | ||
deps = [ | ||
":bot", | ||
":errors", | ||
":json", | ||
"@io_bazel_rules_closure//closure/library", | ||
], | ||
) | ||
|
||
closure_js_library( | ||
name = "json", | ||
srcs = ["json.js"], | ||
deps = [ | ||
":useragent", | ||
"@io_bazel_rules_closure//closure/library", | ||
], | ||
) | ||
|
||
closure_js_library( | ||
name = "locators", | ||
srcs = glob( | ||
["locators/*.js"], | ||
exclude = ["locators/xpath.js"], | ||
), | ||
suppress = [ | ||
"JSC_IMPLICITLY_NULLABLE_JSDOC", | ||
"JSC_NULLABLE_RETURN_WITH_NAME", | ||
"JSC_UNKNOWN_EXPR_TYPE", | ||
], | ||
deps = [ | ||
":bot", | ||
":dom", | ||
":errors", | ||
":json", | ||
":useragent", | ||
":xpath", | ||
"@io_bazel_rules_closure//closure/library", | ||
], | ||
) | ||
|
||
closure_js_library( | ||
name = "useragent", | ||
srcs = ["userAgent.js"], | ||
suppress = [ | ||
"JSC_STRICT_INEXISTENT_PROPERTY", | ||
"JSC_UNKNOWN_EXPR_TYPE", | ||
], | ||
deps = ["@io_bazel_rules_closure//closure/library"], | ||
) | ||
|
||
closure_js_library( | ||
name = "window", | ||
srcs = [ | ||
"frame.js", | ||
"window.js", | ||
], | ||
deps = [ | ||
":bot", | ||
":errors", | ||
":events", | ||
":json", | ||
":locators", | ||
], | ||
) | ||
|
||
closure_js_library( | ||
name = "xpath", | ||
srcs = ["locators/xpath.js"], | ||
suppress = [ | ||
"JSC_IMPLICITLY_NULLABLE_JSDOC", | ||
"JSC_STRICT_INEXISTENT_PROPERTY", | ||
"JSC_UNKNOWN_EXPR_TYPE", | ||
], | ||
deps = [ | ||
":bot", | ||
":errors", | ||
"//third_party/js/wgxpath", | ||
"@io_bazel_rules_closure//closure/library", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
load("//javascript:fragment.bzl", "closure_fragment") | ||
|
||
closure_fragment( | ||
name = "clear", | ||
function = "bot.action.clear", | ||
module = "bot.action", | ||
deps = [ | ||
"//javascript/atoms:action", | ||
], | ||
) | ||
|
||
closure_fragment( | ||
name = "execute_script", | ||
function = "bot.inject.executeScript", | ||
module = "bot.inject", | ||
deps = [ | ||
"//javascript/atoms:inject", | ||
], | ||
) | ||
|
||
closure_fragment( | ||
name = "is-displayed", | ||
function = "bot.dom.isShown", | ||
module = "bot.dom", | ||
deps = [ | ||
"//javascript/atoms:dom", | ||
], | ||
) | ||
|
||
closure_fragment( | ||
name = "find-element", | ||
function = "bot.locators.findElement", | ||
module = "bot.locators", | ||
deps = [ | ||
"//javascript/atoms:locators", | ||
], | ||
) |
Oops, something went wrong.