angular-cn/dev-infra/browsers/firefox/BUILD.bazel

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(["*"]),
)