mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
This commit does three things that all related and required to get rid of `webdriver-manager`: * Our puppeteer protractor setup in AIO relies on webdriver-manager because we install a corresponding chromedriver based on the puppeteer chromium version. We would like to get rid of this brittle setup. * We don't use `puppeteer` in many places because we manage chromium and the driver through Bazel. This commit removes the remaining puppeteer usage and replaces it with the Bazel-managed canonical browser * We need to migrate the AIO production URL tests to Bazel. These weren't part of Aspect's migration. This is needed so that we can drop puppeteer and use the Bazel browser setup. * Migrates some at-runtime TS `ts-node` test setup to proper idiomatic Bazel code. Needed because it depends on code that also had to be migrated to Bazel given the production e2e test Bazel migration (above points). Note: The xregexp dependency had to be added to the root project because `ts_library` does not support compilation deps from `@aio_npm`. This is something we will fix anyway when we have a more modern toolchain! PR Close #49025
215 lines
7.9 KiB
Text
215 lines
7.9 KiB
Text
workspace(
|
|
name = "angular",
|
|
managed_directories = {
|
|
"@npm": ["node_modules"],
|
|
"@aio_npm": ["aio/node_modules"],
|
|
},
|
|
)
|
|
|
|
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
|
load("//:yarn.bzl", "YARN_LABEL")
|
|
|
|
# Add a patch fix for rules_webtesting v0.3.5 required for enabling runfiles on Windows.
|
|
# TODO: Remove the http_archive for this transitive dependency when a release is cut
|
|
# for https://github.com/bazelbuild/rules_webtesting/commit/581b1557e382f93419da6a03b91a45c2ac9a9ec8
|
|
# and the version is updated in rules_nodejs.
|
|
http_archive(
|
|
name = "io_bazel_rules_webtesting",
|
|
patch_args = ["-p1"],
|
|
patches = [
|
|
"//:tools/bazel-repo-patches/rules_webtesting__windows_runfiles_fix.patch",
|
|
],
|
|
sha256 = "e9abb7658b6a129740c0b3ef6f5a2370864e102a5ba5ffca2cea565829ed825a",
|
|
urls = ["https://github.com/bazelbuild/rules_webtesting/releases/download/0.3.5/rules_webtesting.tar.gz"],
|
|
)
|
|
|
|
http_archive(
|
|
name = "build_bazel_rules_nodejs",
|
|
patches = [
|
|
# TODO(devversion): remove when https://github.com/bazelbuild/rules_nodejs/pull/3605 is available.
|
|
"//tools:bazel-repo-patches/rules_nodejs__#3605.patch",
|
|
"//tools/esm-interop:patches/bazel/nodejs_binary_esm_support.patch",
|
|
],
|
|
sha256 = "c29944ba9b0b430aadcaf3bf2570fece6fc5ebfb76df145c6cdad40d65c20811",
|
|
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.7.0/rules_nodejs-5.7.0.tar.gz"],
|
|
)
|
|
|
|
load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies")
|
|
|
|
build_bazel_rules_nodejs_dependencies()
|
|
|
|
# The PKG rules are needed to build tar packages for integration tests. The builtin
|
|
# rule in `@bazel_tools` is not Windows compatible and outdated.
|
|
http_archive(
|
|
name = "rules_pkg",
|
|
sha256 = "62eeb544ff1ef41d786e329e1536c1d541bb9bcad27ae984d57f18f314018e66",
|
|
urls = [
|
|
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.6.0/rules_pkg-0.6.0.tar.gz",
|
|
"https://github.com/bazelbuild/rules_pkg/releases/download/0.6.0/rules_pkg-0.6.0.tar.gz",
|
|
],
|
|
)
|
|
|
|
# Fetch Aspect lib for utilities like write_source_files
|
|
http_archive(
|
|
name = "aspect_bazel_lib",
|
|
sha256 = "4b2e774387bae6242879820086b7b738d49bf3d0659522ea5d9363be01a27582",
|
|
strip_prefix = "bazel-lib-1.23.2",
|
|
url = "https://github.com/aspect-build/bazel-lib/archive/refs/tags/v1.23.2.tar.gz",
|
|
)
|
|
|
|
# Setup the Node.js toolchain.
|
|
load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")
|
|
|
|
nodejs_register_toolchains(
|
|
name = "nodejs",
|
|
node_version = "16.13.0",
|
|
)
|
|
|
|
# Download npm dependencies.
|
|
load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install")
|
|
load("//integration:npm_package_archives.bzl", "npm_package_archives")
|
|
|
|
yarn_install(
|
|
name = "npm",
|
|
# Note that we add the postinstall scripts here so that the dependencies are re-installed
|
|
# when the postinstall patches are modified.
|
|
data = [
|
|
YARN_LABEL,
|
|
"//:.yarnrc",
|
|
"//tools:postinstall-patches.js",
|
|
"//tools/esm-interop:patches/npm/@angular+build-tooling+0.0.0-246cebbf2a78566ff1fe9b88fdde2459606568dc.patch",
|
|
"//tools/esm-interop:patches/npm/@bazel+concatjs+5.7.1.patch",
|
|
"//tools/esm-interop:patches/npm/@bazel+esbuild+5.7.1.patch",
|
|
"//tools/esm-interop:patches/npm/@bazel+protractor+5.7.1.patch",
|
|
"//tools/esm-interop:patches/npm/rxjs+6.6.7.patch",
|
|
],
|
|
# Currently disabled due to:
|
|
# 1. Missing Windows support currently.
|
|
# 2. Incompatibilites with the `ts_library` rule.
|
|
exports_directories_only = False,
|
|
manual_build_file_contents = npm_package_archives(),
|
|
package_json = "//:package.json",
|
|
# We prefer to symlink the `node_modules` to only maintain a single install.
|
|
# See https://github.com/angular/dev-infra/pull/446#issuecomment-1059820287 for details.
|
|
symlink_node_modules = True,
|
|
yarn = YARN_LABEL,
|
|
yarn_lock = "//:yarn.lock",
|
|
)
|
|
|
|
yarn_install(
|
|
name = "aio_npm",
|
|
# Note that we add the postinstall scripts here so that the dependencies are re-installed
|
|
# when the postinstall patches are modified.
|
|
data = [
|
|
YARN_LABEL,
|
|
"//:.yarnrc",
|
|
"//aio:tools/cli-patches/bazel-architect-output.patch",
|
|
"//aio:tools/cli-patches/patch.js",
|
|
],
|
|
# Currently disabled due to:
|
|
# 1. Missing Windows support currently.
|
|
# 2. Incompatibilites with the `ts_library` rule.
|
|
exports_directories_only = False,
|
|
manual_build_file_contents = npm_package_archives(),
|
|
package_json = "//aio:package.json",
|
|
# We prefer to symlink the `node_modules` to only maintain a single install.
|
|
# See https://github.com/angular/dev-infra/pull/446#issuecomment-1059820287 for details.
|
|
symlink_node_modules = True,
|
|
yarn = YARN_LABEL,
|
|
yarn_lock = "//aio:yarn.lock",
|
|
)
|
|
|
|
yarn_install(
|
|
name = "aio_example_deps",
|
|
# Rename the default js_library target from "node_modules" as this obscures the
|
|
# the source directory stamped as a filegroup in the manual BUILD contents below.
|
|
all_node_modules_target_name = "node_modules_all",
|
|
data = [
|
|
YARN_LABEL,
|
|
"//:.yarnrc",
|
|
],
|
|
# Disabled because, when False, yarn_install preserves the node_modules folder
|
|
# with bin symlinks in the external repository. This is needed to link the shared
|
|
# set of deps for example e2es.
|
|
exports_directories_only = False,
|
|
manual_build_file_contents = """\
|
|
filegroup(
|
|
name = "node_modules_files",
|
|
srcs = ["node_modules"],
|
|
)
|
|
""",
|
|
package_json = "//aio/tools/examples/shared:package.json",
|
|
yarn = YARN_LABEL,
|
|
yarn_lock = "//aio/tools/examples/shared:yarn.lock",
|
|
)
|
|
|
|
load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies")
|
|
|
|
aspect_bazel_lib_dependencies()
|
|
|
|
# Load protractor dependencies
|
|
load("@npm//@bazel/protractor:package.bzl", "npm_bazel_protractor_dependencies")
|
|
|
|
npm_bazel_protractor_dependencies()
|
|
|
|
# Setup the rules_webtesting toolchain
|
|
load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories")
|
|
|
|
web_test_repositories()
|
|
|
|
load("@npm//@angular/build-tooling/bazel/browsers:browser_repositories.bzl", "browser_repositories")
|
|
|
|
browser_repositories()
|
|
|
|
load("@build_bazel_rules_nodejs//toolchains/esbuild:esbuild_repositories.bzl", "esbuild_repositories")
|
|
|
|
esbuild_repositories(
|
|
npm_repository = "npm",
|
|
)
|
|
|
|
load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
|
|
|
|
rules_pkg_dependencies()
|
|
|
|
load("//packages/common/locales/generate-locales-tool:cldr-data.bzl", "cldr_json_data_repository", "cldr_xml_data_repository")
|
|
|
|
cldr_major_version = "41"
|
|
|
|
cldr_json_data_repository(
|
|
name = "cldr_json_data",
|
|
urls = {
|
|
"https://github.com/unicode-org/cldr-json/releases/download/%s.0.0/cldr-%s.0.0-json-full.zip" % (cldr_major_version, cldr_major_version): "649b76647269e32b1b0a5f7b6eed52e9e63a1581f1afdcf4f6771e49c9713614",
|
|
},
|
|
)
|
|
|
|
cldr_xml_data_repository(
|
|
name = "cldr_xml_data",
|
|
urls = {
|
|
"https://github.com/unicode-org/cldr/releases/download/release-%s/cldr-common-%s.0.zip" % (cldr_major_version, cldr_major_version): "823c6170c41e2de2c229574e8a436332d25f1c9723409867fe721e00bc92d853",
|
|
},
|
|
)
|
|
|
|
# sass rules
|
|
http_archive(
|
|
name = "io_bazel_rules_sass",
|
|
sha256 = "425d93db6667060db581aaaace7b77b3d7e114b41f36a0c5b86e5e9497832174",
|
|
strip_prefix = "rules_sass-901d22c63864aa781b902b14c55c423117469286",
|
|
urls = [
|
|
"https://github.com/bazelbuild/rules_sass/archive/901d22c63864aa781b902b14c55c423117469286.zip",
|
|
],
|
|
)
|
|
|
|
# Setup the rules_sass toolchain
|
|
load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories")
|
|
|
|
sass_repositories(
|
|
yarn_script = YARN_LABEL,
|
|
)
|
|
|
|
# Register git toolchains
|
|
register_toolchains(
|
|
"@npm//@angular/build-tooling/bazel/git-toolchain:git_linux_toolchain",
|
|
"@npm//@angular/build-tooling/bazel/git-toolchain:git_macos_x86_toolchain",
|
|
"@npm//@angular/build-tooling/bazel/git-toolchain:git_macos_arm64_toolchain",
|
|
"@npm//@angular/build-tooling/bazel/git-toolchain:git_windows_toolchain",
|
|
)
|