2019-05-23 00:28:42 +00:00
|
|
|
workspace(
|
|
|
|
|
name = "angular",
|
2022-01-13 23:43:39 +00:00
|
|
|
managed_directories = {
|
|
|
|
|
"@npm": ["node_modules"],
|
|
|
|
|
"@aio_npm": ["aio/node_modules"],
|
|
|
|
|
},
|
2019-05-23 00:28:42 +00:00
|
|
|
)
|
2017-09-25 19:40:22 +00:00
|
|
|
|
2018-12-05 20:16:14 +00:00
|
|
|
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
2022-07-06 23:16:50 +00:00
|
|
|
load("//:yarn.bzl", "YARN_LABEL")
|
2018-12-02 00:08:15 +00:00
|
|
|
|
2022-06-08 22:00:58 +00:00
|
|
|
# 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"],
|
|
|
|
|
)
|
|
|
|
|
|
2019-02-04 23:53:32 +00:00
|
|
|
http_archive(
|
|
|
|
|
name = "build_bazel_rules_nodejs",
|
2022-12-02 14:14:07 +00:00
|
|
|
patches = [
|
2022-12-09 16:45:55 +00:00
|
|
|
"//tools/esm-interop:patches/bazel/nodejs_binary_esm_support.patch",
|
2022-12-02 14:14:07 +00:00
|
|
|
],
|
2023-06-12 06:06:00 +00:00
|
|
|
sha256 = "5dd1e5dea1322174c57d3ca7b899da381d516220793d0adef3ba03b9d23baa8e",
|
|
|
|
|
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.3/rules_nodejs-5.8.3.tar.gz"],
|
2018-06-25 18:22:23 +00:00
|
|
|
)
|
|
|
|
|
|
2022-03-21 17:09:54 +00:00
|
|
|
load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies")
|
|
|
|
|
|
|
|
|
|
build_bazel_rules_nodejs_dependencies()
|
|
|
|
|
|
2021-09-21 09:19:25 +00:00
|
|
|
# The PKG rules are needed to build tar packages for integration tests. The builtin
|
|
|
|
|
# rule in `@bazel_tools` is not Windows compatible and outdated.
|
2023-04-18 18:07:20 +00:00
|
|
|
# NOTE: We cannot move past version 0.6.0 as pkg_tar no longer works on directories, which rules_nodejs
|
|
|
|
|
# relies on for node_modules setup.
|
2021-09-21 09:19:25 +00:00
|
|
|
http_archive(
|
|
|
|
|
name = "rules_pkg",
|
2022-01-27 00:09:43 +00:00
|
|
|
sha256 = "62eeb544ff1ef41d786e329e1536c1d541bb9bcad27ae984d57f18f314018e66",
|
2021-09-21 09:19:25 +00:00
|
|
|
urls = [
|
2022-01-27 00:09:43 +00:00
|
|
|
"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",
|
2021-09-21 09:19:25 +00:00
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2022-01-13 23:43:39 +00:00
|
|
|
# Fetch Aspect lib for utilities like write_source_files
|
2023-04-18 18:07:20 +00:00
|
|
|
# NOTE: We cannot move past version 1.23.2 of aspect_bazel_lib because it requires us to move to bazel 6.0.0 which
|
|
|
|
|
# breaks our usage of managed_directories
|
2022-01-13 23:43:39 +00:00
|
|
|
http_archive(
|
|
|
|
|
name = "aspect_bazel_lib",
|
2023-02-02 18:06:35 +00:00
|
|
|
sha256 = "4b2e774387bae6242879820086b7b738d49bf3d0659522ea5d9363be01a27582",
|
2023-01-17 06:05:52 +00:00
|
|
|
strip_prefix = "bazel-lib-1.23.2",
|
|
|
|
|
url = "https://github.com/aspect-build/bazel-lib/archive/refs/tags/v1.23.2.tar.gz",
|
2022-03-15 22:32:44 +00:00
|
|
|
)
|
|
|
|
|
|
2022-03-21 17:09:54 +00:00
|
|
|
# Setup the Node.js toolchain.
|
|
|
|
|
load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")
|
2018-09-24 20:58:23 +00:00
|
|
|
|
2022-03-21 17:09:54 +00:00
|
|
|
nodejs_register_toolchains(
|
|
|
|
|
name = "nodejs",
|
2024-02-12 22:57:13 +00:00
|
|
|
node_repositories = {
|
|
|
|
|
"18.18.2-darwin_arm64": ("node-v18.18.2-darwin-arm64.tar.gz", "node-v18.18.2-darwin-arm64", "9f982cc91b28778dd8638e4f94563b0c2a1da7aba62beb72bd427721035ab553"),
|
|
|
|
|
"18.18.2-darwin_amd64": ("node-v18.18.2-darwin-x64.tar.gz", "node-v18.18.2-darwin-x64", "5bb8da908ed590e256a69bf2862238c8a67bc4600119f2f7721ca18a7c810c0f"),
|
|
|
|
|
"18.18.2-linux_arm64": ("node-v18.18.2-linux-arm64.tar.xz", "node-v18.18.2-linux-arm64", "2e630e18548627f61eaf573233da7949dc0a1df5eef3f486fa9820c5f6c121aa"),
|
|
|
|
|
"18.18.2-linux_ppc64le": ("node-v18.18.2-linux-ppc64le.tar.xz", "node-v18.18.2-linux-ppc64le", "b0adff5cf5938266b711d6c724fb134d802e0dee40b3a3f73d162de1b3d11880"),
|
|
|
|
|
"18.18.2-linux_s390x": ("node-v18.18.2-linux-s390x.tar.xz", "node-v18.18.2-linux-s390x", "c70ec2074b5e2b42c55bb4b8105418b67bf8a61c500d9376a07430dfcc341fdb"),
|
|
|
|
|
"18.18.2-linux_amd64": ("node-v18.18.2-linux-x64.tar.xz", "node-v18.18.2-linux-x64", "75aba25ae76999309fc6c598efe56ce53fbfc221381a44a840864276264ab8ac"),
|
|
|
|
|
"18.18.2-windows_amd64": ("node-v18.18.2-win-x64.zip", "node-v18.18.2-win-x64", "3bb0e51e579a41a22b3bf6cb2f3e79c03801aa17acbe0ca00fc555d1282e7acd"),
|
|
|
|
|
},
|
|
|
|
|
# We need at least Node 18.17 due to some transitive dependencies.
|
|
|
|
|
node_version = "18.18.2",
|
2023-05-15 08:48:39 +00:00
|
|
|
)
|
|
|
|
|
|
2022-03-21 17:09:54 +00:00
|
|
|
# Download npm dependencies.
|
|
|
|
|
load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install")
|
2021-11-20 16:06:21 +00:00
|
|
|
load("//integration:npm_package_archives.bzl", "npm_package_archives")
|
2020-02-04 19:45:40 +00:00
|
|
|
|
2019-02-20 17:54:42 +00:00
|
|
|
yarn_install(
|
|
|
|
|
name = "npm",
|
2022-03-21 17:09:54 +00:00
|
|
|
# Note that we add the postinstall scripts here so that the dependencies are re-installed
|
2021-12-15 15:16:29 +00:00
|
|
|
# when the postinstall patches are modified.
|
2022-03-21 17:09:54 +00:00
|
|
|
data = [
|
2022-07-06 23:16:50 +00:00
|
|
|
YARN_LABEL,
|
2022-03-21 17:09:54 +00:00
|
|
|
"//:.yarnrc",
|
2023-09-19 11:28:53 +00:00
|
|
|
"//:tools/npm-patches/@bazel+jasmine+5.8.1.patch",
|
2022-03-21 17:09:54 +00:00
|
|
|
"//tools:postinstall-patches.js",
|
2023-11-02 21:57:21 +00:00
|
|
|
"//tools/esm-interop:patches/npm/@angular+build-tooling+0.0.0-e0ec7b60641d7f6369be45d8d02663fd50f320be.patch",
|
2023-02-17 10:25:38 +00:00
|
|
|
"//tools/esm-interop:patches/npm/@bazel+concatjs+5.8.1.patch",
|
2022-12-12 19:29:11 +00:00
|
|
|
"//tools/esm-interop:patches/npm/@bazel+esbuild+5.7.1.patch",
|
2022-12-14 19:43:46 +00:00
|
|
|
"//tools/esm-interop:patches/npm/@bazel+protractor+5.7.1.patch",
|
2022-12-09 16:35:09 +00:00
|
|
|
"//tools/esm-interop:patches/npm/rxjs+6.6.7.patch",
|
2022-03-21 17:09:54 +00:00
|
|
|
],
|
|
|
|
|
# Currently disabled due to:
|
|
|
|
|
# 1. Missing Windows support currently.
|
|
|
|
|
# 2. Incompatibilites with the `ts_library` rule.
|
|
|
|
|
exports_directories_only = False,
|
2020-02-04 19:45:40 +00:00
|
|
|
manual_build_file_contents = npm_package_archives(),
|
2019-02-20 17:54:42 +00:00
|
|
|
package_json = "//:package.json",
|
2022-03-21 17:09:54 +00:00
|
|
|
# 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,
|
2022-07-06 23:16:50 +00:00
|
|
|
yarn = YARN_LABEL,
|
2019-06-07 20:38:06 +00:00
|
|
|
yarn_lock = "//:yarn.lock",
|
2019-02-20 17:54:42 +00:00
|
|
|
)
|
2019-02-04 23:53:32 +00:00
|
|
|
|
2022-01-13 23:43:39 +00:00
|
|
|
yarn_install(
|
|
|
|
|
name = "aio_npm",
|
2022-03-21 17:09:54 +00:00
|
|
|
# Note that we add the postinstall scripts here so that the dependencies are re-installed
|
|
|
|
|
# when the postinstall patches are modified.
|
|
|
|
|
data = [
|
2022-07-06 23:16:50 +00:00
|
|
|
YARN_LABEL,
|
2022-03-21 17:09:54 +00:00
|
|
|
"//:.yarnrc",
|
2023-09-19 11:28:53 +00:00
|
|
|
"//:tools/npm-patches/@bazel+jasmine+5.8.1.patch",
|
2022-09-07 22:04:23 +00:00
|
|
|
"//aio:tools/cli-patches/bazel-architect-output.patch",
|
2022-03-21 17:09:54 +00:00
|
|
|
"//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,
|
2022-01-13 23:43:39 +00:00
|
|
|
manual_build_file_contents = npm_package_archives(),
|
|
|
|
|
package_json = "//aio:package.json",
|
2022-03-21 17:09:54 +00:00
|
|
|
# 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,
|
2022-07-06 23:16:50 +00:00
|
|
|
yarn = YARN_LABEL,
|
2022-05-05 22:51:35 +00:00
|
|
|
yarn_lock = "//aio:yarn.lock",
|
2022-01-13 23:43:39 +00:00
|
|
|
)
|
|
|
|
|
|
2022-08-11 19:01:31 +00:00
|
|
|
yarn_install(
|
|
|
|
|
name = "aio_example_deps",
|
2022-08-19 22:05:34 +00:00
|
|
|
# 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",
|
2022-08-11 19:01:31 +00:00
|
|
|
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(
|
2022-08-19 22:05:34 +00:00
|
|
|
name = "node_modules_files",
|
|
|
|
|
srcs = ["node_modules"],
|
2022-08-11 19:01:31 +00:00
|
|
|
)
|
|
|
|
|
""",
|
|
|
|
|
package_json = "//aio/tools/examples/shared:package.json",
|
|
|
|
|
yarn = YARN_LABEL,
|
|
|
|
|
yarn_lock = "//aio/tools/examples/shared:yarn.lock",
|
|
|
|
|
)
|
|
|
|
|
|
2022-01-13 23:43:39 +00:00
|
|
|
load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies")
|
|
|
|
|
|
|
|
|
|
aspect_bazel_lib_dependencies()
|
|
|
|
|
|
2019-07-24 15:52:26 +00:00
|
|
|
# Load protractor dependencies
|
2020-06-25 08:32:41 +00:00
|
|
|
load("@npm//@bazel/protractor:package.bzl", "npm_bazel_protractor_dependencies")
|
2019-07-24 15:52:26 +00:00
|
|
|
|
|
|
|
|
npm_bazel_protractor_dependencies()
|
|
|
|
|
|
2019-02-04 23:53:32 +00:00
|
|
|
# Setup the rules_webtesting toolchain
|
2019-02-13 17:33:48 +00:00
|
|
|
load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories")
|
2018-05-10 20:12:30 +00:00
|
|
|
|
|
|
|
|
web_test_repositories()
|
2018-09-24 20:58:23 +00:00
|
|
|
|
2022-07-27 08:03:49 +00:00
|
|
|
load("@npm//@angular/build-tooling/bazel/browsers:browser_repositories.bzl", "browser_repositories")
|
2019-02-13 17:33:48 +00:00
|
|
|
|
2019-11-01 18:17:10 +00:00
|
|
|
browser_repositories()
|
build: convert CLDR locale extraction from Gulp to Bazel tool (#42230)
Converts the CLDR locale extraction script to a Bazel tool.
This allows us to generate locale files within Bazel, so that
locales don't need to live as sources within the repo. Also
it allows us to get rid of the legacy Gulp tooling.
The migration of the Gulp script to a Bazel tool involved the
following things:
1. Basic conversion of the `extract.js` script to TypeScript.
This mostly was about adding explicit types. e.g. adding `locale:
string` or `localeData: CldrStatic`.
2. Split-up into separate files. Instead of keeping the large
`extract.js` file, the tool has been split into separate files.
The logic remains the same, just that code is more readable and
maintainable.
3. Introduction of a new `index.ts` file that is the entry-point
for the Bazel tool. Previously the Gulp tool just generated
all locale files, the default locale and base currency files
at once. The new entry-point accepts a mode to be passed as
first process argument. based on that argument, either locales
are generated into a specified directory, or the default locale,
base currencies or closure file is generated.
This allows us to generate files with a Bazel genrule where
we simply run the tool and specify the outputs. Note: It's
necessary to have multiple modes because files live in separate
locations. e.g. the default locale in `@angular/core`, but the
rest in `@angular/common`.
4. Removal of the `cldr-data-downloader` and custom CLDR resolution
logic. Within Bazel we cannot run a downloader using network.
We switch this to something more Bazel idiomatic with better
caching. For this a new repository rule is introduced that
downloads the CLDR JSON repository and extracts it. Within
that rule we determine the supported locales so that they
can be used to pre-declare outputs (for the locales) within
Bazel analysis phase. This allows us to add the generated locale
files to a `ts_library` (which we want to have for better testing,
and consistent JS transpilation).
Note that the removal of `cldr-data-downloader` also requires us to
add logic for detecting locales without data. The CLDR data
downloader overwrote the `availableLocales.json` file with a file
that only lists locales that CLDR provides data for. We use the
official `availableLocales` file CLDR provides, but filter out
locales for which no data is available. This is needed until we
update to CLDR 39 where data is available for all such locales
listed in `availableLocales.json`.
PR Close #42230
2021-05-21 20:57:42 +00:00
|
|
|
|
2021-09-28 16:31:05 +00:00
|
|
|
load("@build_bazel_rules_nodejs//toolchains/esbuild:esbuild_repositories.bzl", "esbuild_repositories")
|
|
|
|
|
|
2022-03-21 17:09:54 +00:00
|
|
|
esbuild_repositories(
|
|
|
|
|
npm_repository = "npm",
|
|
|
|
|
)
|
2021-09-28 16:31:05 +00:00
|
|
|
|
2021-09-21 09:19:25 +00:00
|
|
|
load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
|
|
|
|
|
|
|
|
|
|
rules_pkg_dependencies()
|
|
|
|
|
|
build(common): specify CLDR version to use by `cldr` (#45714)
While generating locales, two sets of data (both derived from the
[CLDR project][1]) are used:
- JSON data with the [`cldrjs` package][2], which is used for most
operations.
- XML data with the [`cldr` package][3], which is used for generating
plural-related data.
The JSON data is brought in from the [unicode-org/cldr-json][4]
repository. Since we control the version of the repository that we use,
we can control the CLDR version that these correspond to.
Previously, however, we used the XML data that were bundled with the
[`cldr` package[3]. As a result, the two sets of data could correspond
to different CLDR versions, resulting in incorrect/inconsistent locales
files.
This commit addresses the problem by utilizing the `load()` method of
the [`cldr` package][3], which allows passing in a custom path to the
CLDR XML data (instead of using the bundled data. This way, we can
ensure that the data used for all operations correspond to the same CLDR
version.
Related discussion: #43301
[1]: https://github.com/unicode-org/cldr
[2]: https://www.npmjs.com/package/cldrjs
[3]: https://www.npmjs.com/package/cldr
[4]: https://github.com/unicode-org/cldr-json
PR Close #45714
2022-04-26 13:58:00 +00:00
|
|
|
load("//packages/common/locales/generate-locales-tool:cldr-data.bzl", "cldr_json_data_repository", "cldr_xml_data_repository")
|
build: convert CLDR locale extraction from Gulp to Bazel tool (#42230)
Converts the CLDR locale extraction script to a Bazel tool.
This allows us to generate locale files within Bazel, so that
locales don't need to live as sources within the repo. Also
it allows us to get rid of the legacy Gulp tooling.
The migration of the Gulp script to a Bazel tool involved the
following things:
1. Basic conversion of the `extract.js` script to TypeScript.
This mostly was about adding explicit types. e.g. adding `locale:
string` or `localeData: CldrStatic`.
2. Split-up into separate files. Instead of keeping the large
`extract.js` file, the tool has been split into separate files.
The logic remains the same, just that code is more readable and
maintainable.
3. Introduction of a new `index.ts` file that is the entry-point
for the Bazel tool. Previously the Gulp tool just generated
all locale files, the default locale and base currency files
at once. The new entry-point accepts a mode to be passed as
first process argument. based on that argument, either locales
are generated into a specified directory, or the default locale,
base currencies or closure file is generated.
This allows us to generate files with a Bazel genrule where
we simply run the tool and specify the outputs. Note: It's
necessary to have multiple modes because files live in separate
locations. e.g. the default locale in `@angular/core`, but the
rest in `@angular/common`.
4. Removal of the `cldr-data-downloader` and custom CLDR resolution
logic. Within Bazel we cannot run a downloader using network.
We switch this to something more Bazel idiomatic with better
caching. For this a new repository rule is introduced that
downloads the CLDR JSON repository and extracts it. Within
that rule we determine the supported locales so that they
can be used to pre-declare outputs (for the locales) within
Bazel analysis phase. This allows us to add the generated locale
files to a `ts_library` (which we want to have for better testing,
and consistent JS transpilation).
Note that the removal of `cldr-data-downloader` also requires us to
add logic for detecting locales without data. The CLDR data
downloader overwrote the `availableLocales.json` file with a file
that only lists locales that CLDR provides data for. We use the
official `availableLocales` file CLDR provides, but filter out
locales for which no data is available. This is needed until we
update to CLDR 39 where data is available for all such locales
listed in `availableLocales.json`.
PR Close #42230
2021-05-21 20:57:42 +00:00
|
|
|
|
2022-04-26 13:58:01 +00:00
|
|
|
cldr_major_version = "41"
|
build(common): specify CLDR version to use by `cldr` (#45714)
While generating locales, two sets of data (both derived from the
[CLDR project][1]) are used:
- JSON data with the [`cldrjs` package][2], which is used for most
operations.
- XML data with the [`cldr` package][3], which is used for generating
plural-related data.
The JSON data is brought in from the [unicode-org/cldr-json][4]
repository. Since we control the version of the repository that we use,
we can control the CLDR version that these correspond to.
Previously, however, we used the XML data that were bundled with the
[`cldr` package[3]. As a result, the two sets of data could correspond
to different CLDR versions, resulting in incorrect/inconsistent locales
files.
This commit addresses the problem by utilizing the `load()` method of
the [`cldr` package][3], which allows passing in a custom path to the
CLDR XML data (instead of using the bundled data. This way, we can
ensure that the data used for all operations correspond to the same CLDR
version.
Related discussion: #43301
[1]: https://github.com/unicode-org/cldr
[2]: https://www.npmjs.com/package/cldrjs
[3]: https://www.npmjs.com/package/cldr
[4]: https://github.com/unicode-org/cldr-json
PR Close #45714
2022-04-26 13:58:00 +00:00
|
|
|
|
|
|
|
|
cldr_json_data_repository(
|
|
|
|
|
name = "cldr_json_data",
|
|
|
|
|
urls = {
|
2022-04-26 13:58:01 +00:00
|
|
|
"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",
|
build(common): specify CLDR version to use by `cldr` (#45714)
While generating locales, two sets of data (both derived from the
[CLDR project][1]) are used:
- JSON data with the [`cldrjs` package][2], which is used for most
operations.
- XML data with the [`cldr` package][3], which is used for generating
plural-related data.
The JSON data is brought in from the [unicode-org/cldr-json][4]
repository. Since we control the version of the repository that we use,
we can control the CLDR version that these correspond to.
Previously, however, we used the XML data that were bundled with the
[`cldr` package[3]. As a result, the two sets of data could correspond
to different CLDR versions, resulting in incorrect/inconsistent locales
files.
This commit addresses the problem by utilizing the `load()` method of
the [`cldr` package][3], which allows passing in a custom path to the
CLDR XML data (instead of using the bundled data. This way, we can
ensure that the data used for all operations correspond to the same CLDR
version.
Related discussion: #43301
[1]: https://github.com/unicode-org/cldr
[2]: https://www.npmjs.com/package/cldrjs
[3]: https://www.npmjs.com/package/cldr
[4]: https://github.com/unicode-org/cldr-json
PR Close #45714
2022-04-26 13:58:00 +00:00
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
cldr_xml_data_repository(
|
|
|
|
|
name = "cldr_xml_data",
|
build: convert CLDR locale extraction from Gulp to Bazel tool (#42230)
Converts the CLDR locale extraction script to a Bazel tool.
This allows us to generate locale files within Bazel, so that
locales don't need to live as sources within the repo. Also
it allows us to get rid of the legacy Gulp tooling.
The migration of the Gulp script to a Bazel tool involved the
following things:
1. Basic conversion of the `extract.js` script to TypeScript.
This mostly was about adding explicit types. e.g. adding `locale:
string` or `localeData: CldrStatic`.
2. Split-up into separate files. Instead of keeping the large
`extract.js` file, the tool has been split into separate files.
The logic remains the same, just that code is more readable and
maintainable.
3. Introduction of a new `index.ts` file that is the entry-point
for the Bazel tool. Previously the Gulp tool just generated
all locale files, the default locale and base currency files
at once. The new entry-point accepts a mode to be passed as
first process argument. based on that argument, either locales
are generated into a specified directory, or the default locale,
base currencies or closure file is generated.
This allows us to generate files with a Bazel genrule where
we simply run the tool and specify the outputs. Note: It's
necessary to have multiple modes because files live in separate
locations. e.g. the default locale in `@angular/core`, but the
rest in `@angular/common`.
4. Removal of the `cldr-data-downloader` and custom CLDR resolution
logic. Within Bazel we cannot run a downloader using network.
We switch this to something more Bazel idiomatic with better
caching. For this a new repository rule is introduced that
downloads the CLDR JSON repository and extracts it. Within
that rule we determine the supported locales so that they
can be used to pre-declare outputs (for the locales) within
Bazel analysis phase. This allows us to add the generated locale
files to a `ts_library` (which we want to have for better testing,
and consistent JS transpilation).
Note that the removal of `cldr-data-downloader` also requires us to
add logic for detecting locales without data. The CLDR data
downloader overwrote the `availableLocales.json` file with a file
that only lists locales that CLDR provides data for. We use the
official `availableLocales` file CLDR provides, but filter out
locales for which no data is available. This is needed until we
update to CLDR 39 where data is available for all such locales
listed in `availableLocales.json`.
PR Close #42230
2021-05-21 20:57:42 +00:00
|
|
|
urls = {
|
2022-04-26 13:58:01 +00:00
|
|
|
"https://github.com/unicode-org/cldr/releases/download/release-%s/cldr-common-%s.0.zip" % (cldr_major_version, cldr_major_version): "823c6170c41e2de2c229574e8a436332d25f1c9723409867fe721e00bc92d853",
|
build: convert CLDR locale extraction from Gulp to Bazel tool (#42230)
Converts the CLDR locale extraction script to a Bazel tool.
This allows us to generate locale files within Bazel, so that
locales don't need to live as sources within the repo. Also
it allows us to get rid of the legacy Gulp tooling.
The migration of the Gulp script to a Bazel tool involved the
following things:
1. Basic conversion of the `extract.js` script to TypeScript.
This mostly was about adding explicit types. e.g. adding `locale:
string` or `localeData: CldrStatic`.
2. Split-up into separate files. Instead of keeping the large
`extract.js` file, the tool has been split into separate files.
The logic remains the same, just that code is more readable and
maintainable.
3. Introduction of a new `index.ts` file that is the entry-point
for the Bazel tool. Previously the Gulp tool just generated
all locale files, the default locale and base currency files
at once. The new entry-point accepts a mode to be passed as
first process argument. based on that argument, either locales
are generated into a specified directory, or the default locale,
base currencies or closure file is generated.
This allows us to generate files with a Bazel genrule where
we simply run the tool and specify the outputs. Note: It's
necessary to have multiple modes because files live in separate
locations. e.g. the default locale in `@angular/core`, but the
rest in `@angular/common`.
4. Removal of the `cldr-data-downloader` and custom CLDR resolution
logic. Within Bazel we cannot run a downloader using network.
We switch this to something more Bazel idiomatic with better
caching. For this a new repository rule is introduced that
downloads the CLDR JSON repository and extracts it. Within
that rule we determine the supported locales so that they
can be used to pre-declare outputs (for the locales) within
Bazel analysis phase. This allows us to add the generated locale
files to a `ts_library` (which we want to have for better testing,
and consistent JS transpilation).
Note that the removal of `cldr-data-downloader` also requires us to
add logic for detecting locales without data. The CLDR data
downloader overwrote the `availableLocales.json` file with a file
that only lists locales that CLDR provides data for. We use the
official `availableLocales` file CLDR provides, but filter out
locales for which no data is available. This is needed until we
update to CLDR 39 where data is available for all such locales
listed in `availableLocales.json`.
PR Close #42230
2021-05-21 20:57:42 +00:00
|
|
|
},
|
|
|
|
|
)
|
2021-11-24 03:09:07 +00:00
|
|
|
|
2021-12-16 07:00:43 +00:00
|
|
|
# sass rules
|
|
|
|
|
http_archive(
|
|
|
|
|
name = "io_bazel_rules_sass",
|
2024-03-15 17:05:26 +00:00
|
|
|
sha256 = "5633816e996a79c77f44306f6228b9ef18fc2ecb412d63b4e314a132225facba",
|
|
|
|
|
strip_prefix = "rules_sass-79bd239ce77c101ea1aed575678020bd2999f17d",
|
2021-12-16 07:00:43 +00:00
|
|
|
urls = [
|
2024-03-15 17:05:26 +00:00
|
|
|
"https://github.com/bazelbuild/rules_sass/archive/79bd239ce77c101ea1aed575678020bd2999f17d.zip",
|
2021-12-16 07:00:43 +00:00
|
|
|
],
|
2021-11-24 03:09:07 +00:00
|
|
|
)
|
2021-12-16 07:00:43 +00:00
|
|
|
|
|
|
|
|
# Setup the rules_sass toolchain
|
|
|
|
|
load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories")
|
|
|
|
|
|
2022-05-05 11:18:52 +00:00
|
|
|
sass_repositories(
|
2022-07-06 23:16:50 +00:00
|
|
|
yarn_script = YARN_LABEL,
|
2022-05-05 11:18:52 +00:00
|
|
|
)
|
2022-09-12 20:01:11 +00:00
|
|
|
|
|
|
|
|
# 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",
|
|
|
|
|
)
|
2023-02-20 20:37:34 +00:00
|
|
|
|
|
|
|
|
# Fetch sauce connect (tool to open Saucelabs tunnel for Saucelabs browser tests)
|
|
|
|
|
http_archive(
|
|
|
|
|
name = "sauce_connect_linux_amd64",
|
|
|
|
|
build_file_content = """exports_files(["bin/sc"], visibility = ["//visibility:public"])""",
|
|
|
|
|
sha256 = "26b9c3630f441b47854b6032f7eca6f1d88d3f62e50ee44c27015d71a5155c36",
|
|
|
|
|
strip_prefix = "sc-4.8.2-linux",
|
|
|
|
|
url = "https://saucelabs.com/downloads/sc-4.8.2-linux.tar.gz",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
http_archive(
|
|
|
|
|
name = "sauce_connect_mac",
|
|
|
|
|
build_file_content = """exports_files(["bin/sc"], visibility = ["//visibility:public"])""",
|
|
|
|
|
sha256 = "28277ce81ef9ab84f5b87b526258920a8ead44789a5034346e872629bbf38089",
|
|
|
|
|
strip_prefix = "sc-4.8.2-osx",
|
|
|
|
|
url = "https://saucelabs.com/downloads/sc-4.8.2-osx.zip",
|
|
|
|
|
)
|