diff --git a/bazel/browsers/browser_toolchain_alias.bzl b/bazel/browsers/browser_toolchain_alias.bzl index d02ccf49d..94bdf03cd 100644 --- a/bazel/browsers/browser_toolchain_alias.bzl +++ b/bazel/browsers/browser_toolchain_alias.bzl @@ -1,12 +1,14 @@ load("//bazel/browsers:browser_configure.bzl", "NamedFilesInfo") def _browser_toolchain_alias_impl(ctx): - base_path = ctx.attr.metadata.label.workspace_name - named_files = ctx.attr.metadata[NamedFilesInfo].value template_variables = {} - for key, value in named_files.items(): - template_variables[key] = "external/%s/%s" % (base_path, value) + for dep in ctx.attr.deps: + base_path = dep.label.workspace_name + named_files = dep[NamedFilesInfo].value + + for key, value in named_files.items(): + template_variables[key] = "external/%s/%s" % (base_path, value) return [ platform_common.TemplateVariableInfo(template_variables), @@ -15,13 +17,13 @@ def _browser_toolchain_alias_impl(ctx): browser_toolchain_alias = rule( doc = """ Exposes a toolchain alias exposing the template variables for all named files - included in the browser metadata. These variables can then be consumed within Bazel - make variable expansion. + included in the browser metadata dependencies. These variables can then be consumed + within Bazel make variable expansion. """, implementation = _browser_toolchain_alias_impl, attrs = { - "metadata": attr.label( - doc = """Metadata target that provides the browser named files.""", + "deps": attr.label_list( + doc = """Metadata targets that provides the browser named files.""", mandatory = True, providers = [NamedFilesInfo, DefaultInfo], ), diff --git a/bazel/browsers/chromium/BUILD.bazel b/bazel/browsers/chromium/BUILD.bazel index 85c4533e0..c7d49c4f9 100644 --- a/bazel/browsers/chromium/BUILD.bazel +++ b/bazel/browsers/chromium/BUILD.bazel @@ -3,39 +3,36 @@ load("//bazel/browsers:browser_toolchain_alias.bzl", "browser_toolchain_alias") package(default_visibility = ["//visibility:public"]) +PLATFORM_METADATA = select({ + "//bazel/constraints:linux_x64": [ + "@org_chromium_chromedriver_linux_x64//:metadata", + "@org_chromium_chromium_linux_x64//:metadata", + ], + "//bazel/constraints:macos_x64": [ + "@org_chromium_chromedriver_macos_x64//:metadata", + "@org_chromium_chromium_macos_x64//:metadata", + ], + "//bazel/constraints:macos_arm64": [ + "@org_chromium_chromedriver_macos_arm64//:metadata", + "@org_chromium_chromium_macos_arm64//:metadata", + ], + "//bazel/constraints:windows_x64": [ + "@org_chromium_chromedriver_windows//:metadata", + "@org_chromium_chromium_windows//:metadata", + ], +}) + browser( name = "chromium", metadata = "chromium.json", - deps = [ + deps = PLATFORM_METADATA + [ "@io_bazel_rules_webtesting//go/wsl", - ] + select({ - "//bazel/constraints:linux_x64": [ - "@org_chromium_chromedriver_linux_x64//:metadata", - "@org_chromium_chromium_linux_x64//:metadata", - ], - "//bazel/constraints:macos_x64": [ - "@org_chromium_chromedriver_macos_x64//:metadata", - "@org_chromium_chromium_macos_x64//:metadata", - ], - "//bazel/constraints:macos_arm64": [ - "@org_chromium_chromedriver_macos_arm64//:metadata", - "@org_chromium_chromium_macos_arm64//:metadata", - ], - "//bazel/constraints:windows_x64": [ - "@org_chromium_chromedriver_windows//:metadata", - "@org_chromium_chromium_windows//:metadata", - ], - }), + ], ) browser_toolchain_alias( name = "toolchain_alias", - metadata = select({ - "//bazel/constraints:linux_x64": "@org_chromium_chromium_linux_x64//:metadata", - "//bazel/constraints:macos_x64": "@org_chromium_chromium_macos_x64//:metadata", - "//bazel/constraints:macos_arm64": "@org_chromium_chromium_macos_arm64//:metadata", - "//bazel/constraints:windows_x64": "@org_chromium_chromium_windows//:metadata", - }), + deps = PLATFORM_METADATA, ) # Make source files available for distribution via pkg_npm diff --git a/bazel/browsers/firefox/BUILD.bazel b/bazel/browsers/firefox/BUILD.bazel index 9ce2e6885..cea514a41 100644 --- a/bazel/browsers/firefox/BUILD.bazel +++ b/bazel/browsers/firefox/BUILD.bazel @@ -3,6 +3,24 @@ load("//bazel/browsers:browser_toolchain_alias.bzl", "browser_toolchain_alias") package(default_visibility = ["//visibility:public"]) +PLATFORM_METADATA = select({ + "//bazel/constraints:linux_x64": [ + "@org_mozilla_firefox_linux_x64//:metadata", + "@org_mozilla_geckodriver_linux_x64//:metadata", + ], + "//bazel/constraints:macos_x64": [ + # Firefox has a launcher that conditionally starts x64/arm64 + "@org_mozilla_firefox_macos//:metadata", + "@org_mozilla_geckodriver_macos_x64//:metadata", + ], + "//bazel/constraints:macos_arm64": [ + # Firefox has a launcher that conditionally starts x64/arm64 + "@org_mozilla_firefox_macos//:metadata", + "@org_mozilla_geckodriver_macos_arm64//:metadata", + ], + "//conditions:default": [], +}) + browser( name = "firefox", disabled = select({ @@ -14,35 +32,14 @@ browser( "//conditions:default": None, }), metadata = "firefox.json", - deps = [ + deps = PLATFORM_METADATA + [ "@io_bazel_rules_webtesting//go/wsl", - ] + select({ - "//bazel/constraints:linux_x64": [ - "@org_mozilla_firefox_linux_x64//:metadata", - "@org_mozilla_geckodriver_linux_x64//:metadata", - ], - "//bazel/constraints:macos_x64": [ - # Firefox has a launcher that conditionally starts x64/arm64 - "@org_mozilla_firefox_macos//:metadata", - "@org_mozilla_geckodriver_macos_x64//:metadata", - ], - "//bazel/constraints:macos_arm64": [ - # Firefox has a launcher that conditionally starts x64/arm64 - "@org_mozilla_firefox_macos//:metadata", - "@org_mozilla_geckodriver_macos_arm64//:metadata", - ], - "//conditions:default": [], - }), + ], ) browser_toolchain_alias( name = "toolchain_alias", - metadata = select({ - "//bazel/constraints:linux_x64": "@org_mozilla_firefox_linux_x64//:metadata", - # Firefox has a launcher that conditionally starts x64/arm64 - "//bazel/constraints:macos_x64": "@org_mozilla_firefox_macos//:metadata", - "//bazel/constraints:macos_arm64": "@org_mozilla_firefox_macos//:metadata", - }), + deps = PLATFORM_METADATA, ) # Make source files available for distribution via pkg_npm diff --git a/bazel/integration/tests/angular-cli/BUILD.bazel b/bazel/integration/tests/angular-cli/BUILD.bazel index 9238d4c48..7fc927c88 100644 --- a/bazel/integration/tests/angular-cli/BUILD.bazel +++ b/bazel/integration/tests/angular-cli/BUILD.bazel @@ -7,6 +7,7 @@ integration_test( "yarn", "yarn ng build", "yarn ng test --no-watch", + "yarn ng e2e", ], data = [ # The Yarn files also need to be part of the integration test as runfiles @@ -16,6 +17,8 @@ integration_test( "//bazel/browsers/chromium", ], environment = { + "CHROMEDRIVER_SKIP_DOWNLOAD": "true", + "CHROMEDRIVER_PATH": "$(CHROMEDRIVER)", "CHROME_BIN": "$(CHROMIUM)", }, tags = [