2019-05-22 20:28:42 -04:00
|
|
|
workspace(
|
|
|
|
name = "angular",
|
|
|
|
managed_directories = {"@npm": ["node_modules"]},
|
|
|
|
)
|
2017-09-25 15:40:22 -04:00
|
|
|
|
2018-12-05 15:16:14 -05:00
|
|
|
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
2018-12-01 19:08:15 -05:00
|
|
|
|
2019-02-04 18:53:32 -05:00
|
|
|
# Fetch rules_nodejs so we can install our npm dependencies
|
|
|
|
http_archive(
|
|
|
|
name = "build_bazel_rules_nodejs",
|
2021-07-06 09:45:55 -04:00
|
|
|
sha256 = "5c40083120eadec50a3497084f99bc75a85400ea727e82e0b2f422720573130f",
|
|
|
|
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/4.0.0-beta.0/rules_nodejs-4.0.0-beta.0.tar.gz"],
|
2018-06-25 14:22:23 -04:00
|
|
|
)
|
|
|
|
|
2020-02-04 19:14:21 -05:00
|
|
|
# Check the rules_nodejs version and download npm dependencies
|
|
|
|
# Note: bazel (version 2 and after) will check the .bazelversion file so we don't need to
|
|
|
|
# assert on that.
|
|
|
|
load("@build_bazel_rules_nodejs//:index.bzl", "check_rules_nodejs_version", "node_repositories", "yarn_install")
|
2018-09-24 16:58:23 -04:00
|
|
|
|
2020-06-25 04:32:41 -04:00
|
|
|
check_rules_nodejs_version(minimum_version_string = "2.2.0")
|
2019-02-20 12:54:42 -05:00
|
|
|
|
2019-02-04 18:53:32 -05:00
|
|
|
# Setup the Node.js toolchain
|
2018-05-11 02:35:21 -04:00
|
|
|
node_repositories(
|
2021-04-12 15:01:58 -04:00
|
|
|
node_version = "14.16.1",
|
2018-09-11 21:11:32 -04:00
|
|
|
package_json = ["//:package.json"],
|
2018-05-11 02:35:21 -04:00
|
|
|
)
|
2018-05-10 16:12:30 -04:00
|
|
|
|
2020-02-04 14:45:40 -05:00
|
|
|
load("//integration:angular_integration_test.bzl", "npm_package_archives")
|
|
|
|
|
2019-02-20 12:54:42 -05:00
|
|
|
yarn_install(
|
|
|
|
name = "npm",
|
2020-02-04 14:45:40 -05:00
|
|
|
manual_build_file_contents = npm_package_archives(),
|
2019-02-20 12:54:42 -05:00
|
|
|
package_json = "//:package.json",
|
2019-06-07 16:38:06 -04:00
|
|
|
yarn_lock = "//:yarn.lock",
|
2019-02-20 12:54:42 -05:00
|
|
|
)
|
2019-02-04 18:53:32 -05:00
|
|
|
|
2019-07-24 11:52:26 -04:00
|
|
|
# Load protractor dependencies
|
2020-06-25 04:32:41 -04:00
|
|
|
load("@npm//@bazel/protractor:package.bzl", "npm_bazel_protractor_dependencies")
|
2019-07-24 11:52:26 -04:00
|
|
|
|
|
|
|
npm_bazel_protractor_dependencies()
|
|
|
|
|
2019-02-04 18:53:32 -05:00
|
|
|
# Setup the rules_webtesting toolchain
|
2019-02-13 12:33:48 -05:00
|
|
|
load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories")
|
2018-05-10 16:12:30 -04:00
|
|
|
|
|
|
|
web_test_repositories()
|
2018-09-24 16:58:23 -04:00
|
|
|
|
2021-05-24 10:17:27 -04:00
|
|
|
load("//dev-infra/bazel/browsers:browser_repositories.bzl", "browser_repositories")
|
2019-02-13 12:33:48 -05:00
|
|
|
|
2019-11-01 14:17:10 -04: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 16:57:42 -04:00
|
|
|
|
|
|
|
load("//packages/common/locales/generate-locales-tool:cldr-data.bzl", "cldr_data_repository")
|
|
|
|
|
|
|
|
cldr_data_repository(
|
|
|
|
name = "cldr_data",
|
|
|
|
# Since we use the Github archives for CLDR 37, we need to specify a path
|
|
|
|
# to the available locales. This wouldn't be needed with CLDR 39 as that
|
|
|
|
# comes with an official JSON archive not containing a version suffix.
|
|
|
|
available_locales_path = "cldr-core-37.0.0/availableLocales.json",
|
|
|
|
urls = {
|
|
|
|
"https://github.com/unicode-cldr/cldr-core/archive/37.0.0.zip": "32b5c49c3874aa342b90412c207b42e7aefb2435295891fb714c34ce58b3c706",
|
|
|
|
"https://github.com/unicode-cldr/cldr-dates-full/archive/37.0.0.zip": "e1c410dd8ad7d75df4a5393efaf5d28f0d56c0fa126c5d66e171a3f21a988a1e",
|
|
|
|
"https://github.com/unicode-cldr/cldr-numbers-full/archive/37.0.0.zip": "a921b90cf7f436e63fbdd55880f96e39a203acd9e174b0ceafa20a02c242a12e",
|
|
|
|
},
|
|
|
|
)
|