refactor(dev-infra): move shared browser bazel setup into dedicated bazel folder (#42268)

This change moves the `dev-infra/browsers` folder into `dev-infra/bazel`.
The browser folder is providing custom configuration for Bazel, so it
should live within the `bazel` folder for a more well-structured
`dev-infra` folder.

PR Close #42268
This commit is contained in:
Paul Gschwendtner
2021-05-24 16:17:27 +02:00
committed by Jessica Janiuk
parent 49c3ce58bf
commit a16f82b851
16 changed files with 29 additions and 29 deletions
+1
View File
@@ -5,6 +5,7 @@ filegroup(
srcs = [
"BUILD.bazel",
"expand_template.bzl",
"//dev-infra/bazel/browsers:files",
"//dev-infra/bazel/remote-execution:files",
],
)
@@ -4,7 +4,7 @@ package(default_visibility = ["//visibility:public"])
filegroup(
name = "files",
srcs = glob(["*"]) + [
"//dev-infra/browsers/chromium:files",
"//dev-infra/browsers/firefox:files",
"//dev-infra/bazel/browsers/chromium:files",
"//dev-infra/bazel/browsers/firefox:files",
],
)
@@ -7,8 +7,8 @@ We manually keep the configuration of these two tools in sync to create a consis
## Bazel
Bazel `karma_web_test_suite` and `protractor_web_test_suite` targets will use Chromium or Firefox provisioned by `//dev-infra/browsers`.
The version of Chrome and Firefox are specified in the `chromium.bzl` and `firefox.bzl` files in `/dev-infra/browsers`.
Bazel `karma_web_test_suite` and `protractor_web_test_suite` targets will use Chromium or Firefox provisioned by `//dev-infra/bazel/browsers`.
The version of Chrome and Firefox are specified in the `chromium.bzl` and `firefox.bzl` files in `/dev-infra/bazel/browsers`.
The process of updating the Chrome or Firefox version is not straightforward, but below are dedicated sections for each browser.
@@ -34,7 +34,7 @@ The process of updating the Chrome or Firefox version is not straightforward, bu
Chromium 83.0.4103.0
```
3. Update the chrome & chrome driver build numbers in `dev-infra/browsers/chromium/chromium.bzl` and either run `bazel query @org_chromium_chromium_amd64//...` to prompt Bazel to calculate the new `sha256` for each platform binary or determine the new `sha256` values manually.
3. Update the chrome & chrome driver build numbers in `dev-infra/bazel/browsers/chromium/chromium.bzl` and either run `bazel query @org_chromium_chromium_amd64//...` to prompt Bazel to calculate the new `sha256` for each platform binary or determine the new `sha256` values manually.
Here is an example with `curl` & `shasum`:
``` bash
@@ -63,7 +63,7 @@ The process of updating the Chrome or Firefox version is not straightforward, bu
## Firefox
In order to update Firefox, open the `dev-infra/browsers/firefox/firefox.bzl` file and update the repository URLs to the desired version.
In order to update Firefox, open the `dev-infra/bazel/browsers/firefox/firefox.bzl` file and update the repository URLs to the desired version.
For example:
```bzl
@@ -15,12 +15,12 @@
"""Pinned browser versions.
This function is here to make browser repositories work with cross-platform RBE.
Unlike the rules_webtesting browser_repositories, this function defines
separate repositories for each platform
Unlike the `rules_webtesting` `browser_repositories`, this function defines
separate repositories for each platform.
"""
load("//dev-infra/browsers/chromium:chromium.bzl", "define_chromium_repositories")
load("//dev-infra/browsers/firefox:firefox.bzl", "define_firefox_repositories")
load("//dev-infra/bazel/browsers/chromium:chromium.bzl", "define_chromium_repositories")
load("//dev-infra/bazel/browsers/firefox:firefox.bzl", "define_firefox_repositories")
def browser_repositories():
"""Load pinned rules_webtesting browser versions."""
@@ -1,3 +1,5 @@
load("@io_bazel_rules_webtesting//web:web.bzl", "browser", "web_test_archive")
# Copyright Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,8 +18,6 @@
#
package(default_visibility = ["//visibility:public"])
load("@io_bazel_rules_webtesting//web:web.bzl", "browser", "web_test_archive")
# Override of chromium web_test_archive so that the archive is selected based on platform
web_test_archive(
name = "chromium_archive",
@@ -33,7 +33,7 @@ web_test_archive(
"@io_bazel_rules_webtesting//common/conditions:mac": {"CHROMIUM": "chrome-mac/Chromium.app/Contents/MacOS/chromium"},
"@io_bazel_rules_webtesting//common/conditions:windows": {"CHROMIUM": "chrome-win/chrome.exe"},
}),
visibility = ["//dev-infra/browsers:__subpackages__"],
visibility = ["//dev-infra/bazel/browsers:__subpackages__"],
)
# Override of chromedriver web_test_archive so that the archive is selected based on platform
@@ -57,7 +57,7 @@ web_test_archive(
"CHROMEDRIVER": "chromedriver_win32/chromedriver.exe",
},
}),
visibility = ["//dev-infra/browsers:__subpackages__"],
visibility = ["//dev-infra/bazel/browsers:__subpackages__"],
)
browser(
@@ -1,4 +1,4 @@
load("//dev-infra/browsers:platform_http_file.bzl", "platform_http_file")
load("//dev-infra/bazel/browsers:platform_http_file.bzl", "platform_http_file")
"""
Defines repositories for Chromium that can be used inside Karma unit tests
@@ -7,7 +7,7 @@ load("//dev-infra/browsers:platform_http_file.bzl", "platform_http_file")
def define_chromium_repositories():
# To update to a newer version of Chromium see instructions in
# https://github.com/angular/angular/blob/master/dev-infra/browsers/README.md.
# https://github.com/angular/angular/blob/master/dev-infra/bazel/browsers/README.md.
platform_http_file(
name = "org_chromium_chromium_amd64",
@@ -1,3 +1,5 @@
load("@io_bazel_rules_webtesting//web:web.bzl", "browser", "web_test_archive")
# Copyright Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,8 +18,6 @@
#
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",
@@ -31,7 +31,7 @@ web_test_archive(
"@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__"],
visibility = ["//dev-infra/bazel/browsers:__subpackages__"],
)
# Override of geckodriver web_test_archive so that the archive is selected based on platform.
@@ -44,7 +44,7 @@ web_test_archive(
}),
extract = "build",
named_files = {"GECKODRIVER": "geckodriver"},
visibility = ["//dev-infra/browsers:__subpackages__"],
visibility = ["//dev-infra/bazel/browsers:__subpackages__"],
)
browser(
@@ -1,4 +1,4 @@
load("//dev-infra/browsers:platform_http_file.bzl", "platform_http_file")
load("//dev-infra/bazel/browsers:platform_http_file.bzl", "platform_http_file")
"""
Defines repositories for Firefox that can be used inside Karma unit tests
-1
View File
@@ -5,7 +5,6 @@ filegroup(
name = "files",
srcs = glob(["*"]) + [
"//dev-infra/benchmark/brotli-cli:files",
"//dev-infra/browsers:files",
"//dev-infra/benchmark/component_benchmark:files",
"//dev-infra/benchmark/ng_rollup_bundle:files",
],
@@ -10,7 +10,7 @@ load("@npm//@bazel/protractor:index.bzl", "protractor_web_test_suite")
def benchmark_test(name, server, tags = [], **kwargs):
protractor_web_test_suite(
name = name,
browsers = ["//dev-infra/browsers/chromium:chromium"],
browsers = ["//dev-infra/bazel/browsers/chromium:chromium"],
configuration = "//dev-infra/benchmark/component_benchmark:protractor-perf.conf.js",
on_prepare = "//dev-infra/benchmark/component_benchmark:start-server.js",
server = server,