From 50dcea80fa00fba1ef4828e257824bb104f37ff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Z=C3=BCnd?= Date: Tue, 22 Nov 2022 07:28:50 +0100 Subject: [PATCH] [l10n] Use generated en-US.json/en-XL.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This CL switches out the in-tree versions of en-US.json/en-XL.json in favor of the versions generated at build time. They are identical. The implementation is straight-forward. On the minification step, we exclude the in-tree en-US.json/en-XL.json and instead add the outputs of the "collect_strings" action (aka the generated en-US.json/ en-XL.json). R=kimanh@chromium.org Bug: 1185727 Change-Id: I923fba50033305a7df6bedccf65c657ecc8e5235 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4043247 Reviewed-by: Kim-Anh Tran Commit-Queue: Simon Zünd --- front_end/core/i18n/BUILD.gn | 1 - front_end/core/i18n/locales/BUILD.gn | 13 ++++++++++++- scripts/build/ninja/minify_json.gni | 6 +++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/front_end/core/i18n/BUILD.gn b/front_end/core/i18n/BUILD.gn index e7ec5dd2e8..36b5ace0b9 100644 --- a/front_end/core/i18n/BUILD.gn +++ b/front_end/core/i18n/BUILD.gn @@ -26,7 +26,6 @@ devtools_module("i18n") { ] public_deps = [ - "./locales:collect_strings", "./locales:i18n_bundled_locales", "./locales:i18n_locales", ] diff --git a/front_end/core/i18n/locales/BUILD.gn b/front_end/core/i18n/locales/BUILD.gn index 5fd1c983a2..ff72a97d2a 100644 --- a/front_end/core/i18n/locales/BUILD.gn +++ b/front_end/core/i18n/locales/BUILD.gn @@ -26,11 +26,22 @@ node_action("collect_strings") { } } +generated_locales = [ "en-US" ] +if (include_en_xl) { + generated_locales += [ "en-XL" ] +} + minify_json("i18n_locales") { sources = [] - foreach(locale, remote_devtools_locales + bundled_devtools_locales) { + foreach( + locale, + remote_devtools_locales + bundled_devtools_locales - generated_locales) { sources += [ "$locale.json" ] } + + sources += get_target_outputs(":collect_strings") + + deps = [ ":collect_strings" ] } group("i18n_bundled_locales") { diff --git a/scripts/build/ninja/minify_json.gni b/scripts/build/ninja/minify_json.gni index 6f6f0bb360..13d168c93f 100644 --- a/scripts/build/ninja/minify_json.gni +++ b/scripts/build/ninja/minify_json.gni @@ -7,7 +7,11 @@ import("./vars.gni") template("minify_json") { node_action(target_name) { - forward_variables_from(invoker, [ "sources" ]) + forward_variables_from(invoker, + [ + "deps", + "sources", + ]) script = "scripts/build/ninja/minify-json-files.js"