Files
angular__angular/packages/common/locales/BUILD.bazel
Paul Gschwendtner 90c2088679 build: make devmode a noop and ensure it never runs (#48521)
This is basically a pre-step for combining devmode and prodmode into a
single compilation. We are already achieving this now, and can claim
with confidence that we reduced possible actions by half. This is
especially important now that prodmode is used more often, but rules
potentially still using the devmode ESM sources. We can avoid double
compilations (which existed before the whole ESM migration too!).

We will measure this more when we have more concrete documentation
of the changes & a better planning document.

Changes:

  * ts_library will no longer generate devmode `d.ts`. Definitions are
    generated as part of prodmode. That way only prodmode can be exposed
    via providers.
  * applied the same to `ng_module`.
  * updates migrations to bundle because *everything* using `ts_library`
    is now ESM. This is actually also useful in the future if
    schematics rely on e.g. the compiler.
  * updates schematics for localize to also bundle. similar reason as
    above.

PR Close #48521
2022-12-19 19:50:45 +00:00

48 lines
1.6 KiB
Python

load("@build_bazel_rules_nodejs//:index.bzl", "generated_file_test")
load("//packages/common/locales:index.bzl", "LOCALES", "generate_all_locale_files", "generate_closure_locale_file")
load("//tools:defaults.bzl", "pkg_npm", "ts_library")
package(default_visibility = ["//visibility:public"])
# This generates the `closure-locale.ts` file through the `generate-locales` tool. Since
# the `closure-locale.ts` file is checked-in for Google3, we add a `generated_file_test` to
# ensure the checked-in file is up-to-date. To disambiguate from the test, we use a more
# precise target name here.
generate_closure_locale_file(
name = "closure_locale_file_generated",
output_file = "closure_locale_generated.ts",
)
generated_file_test(
name = "closure_locale_file",
src = "closure-locale.ts",
generated = ":closure_locale_file_generated",
)
generate_all_locale_files(
name = "locale_files",
)
ts_library(
name = "locales",
# TODO(devversion): Remove glob for checked-in legacy locale files that haven't been
# removed in the past (when CLDR has been updated). These can be removed in a major.
srcs = [file for l in LOCALES for file in [
"%s.ts" % l,
"extra/%s.ts" % l,
]] + glob(
[
"*.ts",
"extra/*.ts",
],
exclude = ["closure-locale.ts"],
),
)
pkg_npm(
name = "package",
# TODO(devversion): Remove glob for checked-in legacy locale files that haven't been
# removed in the past (when CLDR has been updated). These can be removed in a major.
deps = ["global/%s.js" % l for l in LOCALES] + [":locales"] + glob(["global/*.js"]),
)