Paul Gschwendtner 545f1dbac9 feat(dev-infra): add bazel firefox browser with RBE compatibility (#38029)
Adds Firefox as browser to `dev-infra/browsers` with RBE
compatibility. The default Firefox browser is not compatible similar to
the default Chromium version exposed by `rules_webtesting`.

The Angular Components repository will use this browser target as
it enables RBE support. Also it gives us more flexibility about
the Firefox version we test against. The version provided by
`rules_webtesting` is very old and most likely not frequently
updated (based on past experience).

PR Close #38029
2020-07-15 12:34:05 -07:00

75 lines
2.8 KiB
Python

# Copyright Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################
#
package(default_visibility = ["//visibility:public"])
load("@io_bazel_rules_webtesting//web:web.bzl", "browser", "web_test_archive")
# Override of firefox web_test_archive so that the archive is selected based on platform.
web_test_archive(
name = "firefox_archive",
testonly = True,
archive = select({
"@io_bazel_rules_webtesting//common/conditions:linux": "@org_mozilla_firefox_amd64//file",
"@io_bazel_rules_webtesting//common/conditions:mac": "@org_mozilla_firefox_macos//file",
}),
extract = "build",
named_files = select({
"@io_bazel_rules_webtesting//common/conditions:linux": {"FIREFOX": "firefox/firefox"},
"@io_bazel_rules_webtesting//common/conditions:mac": {"FIREFOX": "Firefox.app/Contents/MacOS/firefox"},
}),
visibility = ["//dev-infra/browsers:__subpackages__"],
)
# Override of geckodriver web_test_archive so that the archive is selected based on platform.
web_test_archive(
name = "geckodriver_archive",
testonly = True,
archive = select({
"@io_bazel_rules_webtesting//common/conditions:linux": "@org_mozilla_geckodriver_amd64//file",
"@io_bazel_rules_webtesting//common/conditions:mac": "@org_mozilla_geckodriver_macos//file",
}),
extract = "build",
named_files = {"GECKODRIVER": "geckodriver"},
visibility = ["//dev-infra/browsers:__subpackages__"],
)
browser(
name = "firefox",
disabled = select({
# TODO: Consider adding support for Windows. Requires a portable version of
# Firefox. Official distribution only ships with installers.
"@io_bazel_rules_webtesting//common/conditions:windows": "Firefox is not supported on Windows",
"//conditions:default": None,
}),
metadata = "firefox.json",
visibility = ["//visibility:public"],
deps = select({
"@io_bazel_rules_webtesting//common/conditions:windows": [],
"//conditions:default": [
"@io_bazel_rules_webtesting//go/wsl",
":firefox_archive",
":geckodriver_archive",
],
}),
)
# Make source files available for distribution via pkg_npm
filegroup(
name = "files",
srcs = glob(["*"]),
)