Commit 57b86546 authored by dpapad's avatar dpapad Committed by Commit Bot

WebUI: Auto-generate grd entries for ui/webui/resources/js, part 4

Moving most IDR_WEBUI_JS_* resources from webui_resources.grd to
the auto-generated webui_generated_resources.grd.

Bug: 1132403
Change-Id: I775b52c668f1d067e74a7e15c982f2d38f25c472
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2518725
Commit-Queue: dpapad <dpapad@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarEsmael Elmoslimany <aee@chromium.org>
Reviewed-by: default avatarRichard Coles <torne@chromium.org>
Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826226}
parent d36322b0
......@@ -739,12 +739,14 @@ repack("repack_pack") {
"$target_gen_dir/aw_resources.pak",
"$target_gen_dir/components_resources.pak",
"$target_gen_dir/mojo_bindings_resources.pak",
"$target_gen_dir/webui_generated_resources.pak",
"$target_gen_dir/webui_resources.pak",
]
deps = [
":generate_aw_resources",
":generate_components_resources",
":generate_mojo_resources",
":generate_webui_generated_resources",
":generate_webui_resources",
"//content:content_resources",
"//net:net_resources",
......@@ -916,6 +918,34 @@ grit("generate_webui_resources") {
]
}
grit("generate_webui_generated_resources") {
enable_input_discovery_for_gn_analyze = false
defines =
[ "SHARED_INTERMEDIATE_DIR=" + rebase_path(root_gen_dir, root_build_dir) ]
source = "$root_gen_dir/ui/webui/resources/webui_generated_resources.grd"
deps = [ "//ui/webui/resources:build_grd" ]
outputs = [
"grit/webui_generated_resources.h",
"grit/webui_generated_resources_map.cc",
"grit/webui_generated_resources_map.h",
"webui_generated_resources.pak",
]
# webui/resources has way too many resources. The allowlist is trim this down
# to a reasonable size
_allowlist = "ui/grit_resources_allowlist.txt"
inputs = [ _allowlist ]
grit_flags = [
"-w",
rebase_path(_allowlist, root_build_dir),
"-E",
"root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
"-E",
"root_src_dir=" + rebase_path("//", root_build_dir),
]
}
grit("generate_mojo_resources") {
source = "../mojo/public/js/mojo_bindings_resources.grd"
......
......@@ -76,6 +76,7 @@
#include "ui/base/template_expressions.h"
#include "ui/base/webui/web_ui_util.h"
#include "ui/resources/grit/ui_resources.h"
#include "ui/resources/grit/webui_generated_resources.h"
#include "ui/resources/grit/webui_resources.h"
#include "url/gurl.h"
......
......@@ -15,7 +15,7 @@
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/resources/grit/webui_resources.h"
#include "ui/resources/grit/webui_generated_resources.h"
#include "url/gurl.h"
namespace {
......
......@@ -21,6 +21,7 @@
#include "content/public/browser/web_ui_data_source.h"
#include "net/base/url_util.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/resources/grit/webui_generated_resources.h"
#include "ui/resources/grit/webui_resources.h"
#include "ui/strings/grit/ui_strings.h"
#include "ui/web_dialogs/web_dialog_delegate.h"
......
......@@ -29,6 +29,7 @@
#include "ui/base/text/bytes_formatting.h"
#include "ui/base/webui/web_ui_util.h"
#include "ui/chromeos/devicetype_utils.h"
#include "ui/resources/grit/webui_generated_resources.h"
#include "ui/resources/grit/webui_resources.h"
#include "ui/strings/grit/ui_strings.h"
#include "ui/web_dialogs/web_dialog_ui.h"
......
......@@ -26,6 +26,7 @@
#include "ui/base/text/bytes_formatting.h"
#include "ui/base/webui/web_ui_util.h"
#include "ui/chromeos/devicetype_utils.h"
#include "ui/resources/grit/webui_generated_resources.h"
#include "ui/resources/grit/webui_resources.h"
#include "ui/strings/grit/ui_strings.h"
#include "ui/web_dialogs/web_dialog_ui.h"
......
......@@ -35,6 +35,7 @@
#include "content/public/browser/web_ui_message_handler.h"
#include "services/network/public/mojom/content_security_policy.mojom.h"
#include "ui/base/webui/web_ui_util.h"
#include "ui/resources/grit/webui_generated_resources.h"
#include "ui/resources/grit/webui_resources.h"
namespace chromeos {
......
......@@ -15,6 +15,7 @@
#include "services/network/public/mojom/content_security_policy.mojom.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/webui/web_ui_util.h"
#include "ui/resources/grit/webui_generated_resources.h"
#include "ui/resources/grit/webui_resources.h"
DiceWebSigninInterceptUI::DiceWebSigninInterceptUI(content::WebUI* web_ui)
......
......@@ -21,6 +21,7 @@
#include "content/public/browser/web_ui_data_source.h"
#include "services/network/public/mojom/content_security_policy.mojom.h"
#include "ui/base/webui/web_ui_util.h"
#include "ui/resources/grit/webui_generated_resources.h"
#include "ui/resources/grit/webui_resources.h"
ProfileCustomizationUI::ProfileCustomizationUI(content::WebUI* web_ui)
......
......@@ -30,6 +30,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/webui/web_ui_util.h"
#include "ui/gfx/image/image.h"
#include "ui/resources/grit/webui_generated_resources.h"
#include "ui/resources/grit/webui_resources.h"
namespace {
......
......@@ -25,6 +25,7 @@
#include "services/network/public/mojom/content_security_policy.mojom.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/webui/web_ui_util.h"
#include "ui/resources/grit/webui_generated_resources.h"
#include "ui/resources/grit/webui_resources.h"
SyncConfirmationUI::SyncConfirmationUI(content::WebUI* web_ui)
......
......@@ -8,6 +8,7 @@
#include "content/public/browser/web_ui_data_source.h"
#include "services/network/public/mojom/content_security_policy.mojom.h"
#include "ui/base/webui/web_ui_util.h"
#include "ui/resources/grit/webui_generated_resources.h"
#include "ui/resources/grit/webui_resources.h"
#include "ui/resources/grit/webui_resources_map.h"
......
......@@ -126,7 +126,7 @@
#include "ui/events/keycodes/dom/dom_code.h"
#include "ui/events/keycodes/dom/keycode_converter.h"
#include "ui/latency/latency_info.h"
#include "ui/resources/grit/webui_resources.h"
#include "ui/resources/grit/webui_generated_resources.h"
#if defined(OS_WIN)
#include <uiautomation.h>
......
......@@ -17,7 +17,7 @@
#include "content/public/test/content_browser_test_utils.h"
#include "content/shell/browser/shell.h"
#include "net/base/filename_util.h"
#include "ui/resources/grit/webui_resources.h"
#include "ui/resources/grit/webui_generated_resources.h"
namespace content {
......
......@@ -658,7 +658,7 @@
"structures": [3820],
},
"<(SHARED_INTERMEDIATE_DIR)/ui/webui/resources/webui_generated_resources.grd": {
"META": {"sizes": {"includes": [500]}},
"META": {"sizes": {"includes": [600]}},
"includes": [3830],
},
"weblayer/weblayer_resources.grd": {
......
......@@ -444,6 +444,7 @@ component("base") {
"//ui/display",
"//ui/events",
"//ui/events/devices",
"//ui/resources:webui_generated_resources_grd",
"//ui/resources:webui_resources_grd",
"//ui/strings",
"//url",
......
......@@ -12,6 +12,7 @@ include_rules = [
"+ui/gfx",
"+ui/resources/grit/ui_resources.h",
"+ui/resources/grit/ui_unscaled_resources.h",
"+ui/resources/grit/webui_generated_resources.h",
"+ui/resources/grit/webui_resources.h",
"+ui/strings/grit/app_locale_settings.h",
"+ui/strings/grit/ui_strings.h",
......
......@@ -15,6 +15,7 @@
#include "ui/base/layout.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/template_expressions.h"
#include "ui/resources/grit/webui_generated_resources.h"
#include "ui/resources/grit/webui_resources.h"
namespace webui {
......
......@@ -147,6 +147,7 @@ repack("repack_ui_test_pak_100_percent") {
sources = [
"$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
"$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
"$root_gen_dir/ui/resources/webui_generated_resources.pak",
"$root_gen_dir/ui/resources/webui_resources.pak",
"$root_gen_dir/ui/strings/app_locale_settings_en-US.pak",
"$root_gen_dir/ui/strings/ui_strings_en-US.pak",
......@@ -159,10 +160,6 @@ repack("repack_ui_test_pak_100_percent") {
]
}
if (!is_android && !is_ios) {
sources += [ "$root_gen_dir/ui/resources/webui_generated_resources.pak" ]
}
output = "$root_out_dir/ui_test.pak"
deps = [
......
......@@ -3,19 +3,22 @@
# found in the LICENSE file.
import("//third_party/closure_compiler/compile_js.gni")
import("//tools/grit/preprocess_grit.gni")
import("//ui/webui/resources/tools/generate_grd.gni")
preprocess_folder = "preprocessed"
include_polymer = !is_android && !is_ios
generate_grd("build_grd") {
grd_prefix = "webui_generated"
out_grd = "$target_gen_dir/${grd_prefix}_resources.grd"
deps = [ "js/cr/ui:build_grdp" ]
grdp_files = [ "$root_gen_dir/ui/webui/resources/js/cr/ui/resources.grdp" ]
deps = [
"js:build_grdp",
"js/cr/ui:build_grdp",
]
grdp_files = [
"$target_gen_dir/js/cr/ui/resources.grdp",
"$target_gen_dir/js/resources.grdp",
]
if (include_polymer) {
deps += [
......@@ -40,50 +43,12 @@ generate_grd("build_grd") {
group("preprocess") {
deps = [
":preprocess_generated",
":preprocess_src",
"cr_components:preprocess",
"cr_elements:preprocess",
"js/cr/ui:preprocess",
]
}
preprocess_grit("preprocess_src") {
in_folder = "./"
out_folder = "$target_gen_dir/$preprocess_folder"
in_files = [
"js/action_link.js",
"js/color_utils.js",
"js/cr.m.js",
"js/plural_string_proxy.js",
"js:preprocess",
]
}
preprocess_grit("preprocess_generated") {
deps = [ ":modulize" ]
in_folder = target_gen_dir
out_folder = "$target_gen_dir/$preprocess_folder"
in_files = [
"js/assert.m.js",
"js/event_tracker.m.js",
"js/icon.m.js",
"js/load_time_data.m.js",
"js/parse_html_subset.m.js",
"js/promise_resolver.m.js",
"js/util.m.js",
"js/cr/event_target.m.js",
]
if (include_polymer) {
in_files += [
"js/i18n_behavior.m.js",
"js/list_property_update_behavior.m.js",
"js/search_highlight_utils.m.js",
"js/web_ui_listener_behavior.m.js",
]
}
}
group("closure_compile") {
deps = [
"js:closure_compile",
......
......@@ -21,16 +21,4 @@
<!-- CSS resources -->
<structure name="IDR_WEBUI_CSS_MD_COLORS"
file="css/md_colors.css" type="chrome_html" />
<!-- JS resources -->
<structure name="IDR_WEBUI_JS_I18N_BEHAVIOR"
file="js/i18n_behavior.js" type="chrome_html" preprocess="true" />
<structure name="IDR_WEBUI_JS_LIST_PROPERTY_UPDATE_BEHAVIOR"
file="js/list_property_update_behavior.js" type="chrome_html" />
<structure name="IDR_WEBUI_JS_POLYMER_CONFIG"
file="js/polymer_config.js" type="chrome_html" />
<structure name="IDR_WEBUI_JS_WEBUI_LISTENER_BEHAVIOR"
file="js/web_ui_listener_behavior.js" type="chrome_html" />
<structure name="IDR_WEBUI_JS_SEARCH_HIGHLIGHT_UTILS"
file="js/search_highlight_utils.js" type="chrome_html" />
</grit-part>
<?xml version="1.0" encoding="utf-8"?>
<grit-part>
<include name="IDR_WEBUI_JS_I18N_BEHAVIOR_M_JS"
file="${root_gen_dir}/ui/webui/resources/js/i18n_behavior.m.js"
use_base_dir="false" type="BINDATA"
preprocess="true" />
<include name="IDR_WEBUI_JS_LIST_PROPERTY_UPDATE_BEHAVIOR_M_JS"
file="${root_gen_dir}/ui/webui/resources/js/list_property_update_behavior.m.js"
use_base_dir="false" type="BINDATA" />
<include name="IDR_WEBUI_JS_SEARCH_HIGHLIGHT_UTILS_M_JS"
file="${root_gen_dir}/ui/webui/resources/js/search_highlight_utils.m.js"
use_base_dir="false" type="BINDATA" />
<include name="IDR_WEBUI_JS_WEBUI_LISTENER_BEHAVIOR_M_JS"
file="${root_gen_dir}/ui/webui/resources/js/web_ui_listener_behavior.m.js"
use_base_dir="false" type="BINDATA" />
</grit-part>
......@@ -3,8 +3,101 @@
# found in the LICENSE file.
import("//third_party/closure_compiler/compile_js.gni")
import("//tools/grit/preprocess_grit.gni")
import("//ui/webui/resources/tools/generate_grd.gni")
import("../tools/js_modulizer.gni")
preprocess_folder = "$root_gen_dir/ui/webui/resources/preprocessed/js"
preprocess_gen_manifest = "preprocessed_gen_manifest.json"
preprocess_src_manifest = "preprocessed_src_manifest.json"
include_polymer = !is_android && !is_ios
generate_grd("build_grdp") {
grd_prefix = "webui_js"
out_grd = "$target_gen_dir/resources.grdp"
deps = [ ":preprocess" ]
manifest_files = [
"$target_gen_dir/$preprocess_gen_manifest",
"$target_gen_dir/$preprocess_src_manifest",
]
resource_path_prefix = "js"
}
group("preprocess") {
public_deps = [
":preprocess_generated",
":preprocess_src",
"cr/ui:preprocess",
]
}
preprocess_grit("preprocess_src") {
in_folder = "./"
out_folder = "$preprocess_folder"
out_manifest = "$target_gen_dir/$preprocess_src_manifest"
in_files = [
"action_link.js",
"assert.js",
"color_utils.js",
"cr/event_target.js",
"cr.js",
"cr.m.js",
"cr/ui.js",
"event_tracker.js",
"i18n_template_no_process.js",
"icon.js",
"load_time_data.js",
"parse_html_subset.js",
"plural_string_proxy.js",
"promise_resolver.js",
"test_loader.js",
"util.js",
"webui_resource_test.js",
]
if (is_chromeos) {
in_files += [ "i18n_template_process.js" ]
}
if (include_polymer) {
in_files += [
"i18n_behavior.js",
"list_property_update_behavior.js",
"polymer_config.js",
"search_highlight_utils.js",
"web_ui_listener_behavior.js",
]
}
}
preprocess_grit("preprocess_generated") {
deps = [ ":modulize" ]
in_folder = target_gen_dir
out_folder = "$preprocess_folder"
out_manifest = "$target_gen_dir/$preprocess_gen_manifest"
in_files = [
"assert.m.js",
"cr/event_target.m.js",
"cr/ui.m.js",
"event_tracker.m.js",
"icon.m.js",
"load_time_data.m.js",
"parse_html_subset.m.js",
"promise_resolver.m.js",
"util.m.js",
]
if (include_polymer) {
in_files += [
"i18n_behavior.m.js",
"list_property_update_behavior.m.js",
"search_highlight_utils.m.js",
"web_ui_listener_behavior.m.js",
]
}
}
group("closure_compile") {
deps = [
":js_resources",
......
......@@ -13,9 +13,6 @@ without changes to the corresponding grd file. -->
</outputs>
<release seq="1">
<includes>
<if expr="chromeos">
<include name="IDR_WEBUI_JS_I18N_TEMPLATE_PROCESS_JS" file="js/i18n_template_process.js" type="BINDATA" />
</if>
<include name="IDR_WEBUI_JS_JSTEMPLATE_COMPILED_JS"
file="../../../third_party/jstemplate/jstemplate_compiled.js"
resource_path="js/jstemplate_compiled.js" type="BINDATA"/>
......@@ -70,48 +67,11 @@ without changes to the corresponding grd file. -->
file="images/throbber_medium.svg" type="BINDATA" />
<include name="IDR_WEBUI_IMAGES_THROBBER_SMALL_SVG"
file="images/throbber_small.svg" type="BINDATA" />
<!-- Web UI shared JS module resources. -->
<include name="IDR_WEBUI_JS_ASSERT_M_JS"
file="${root_gen_dir}/ui/webui/resources/js/assert.m.js"
use_base_dir="false" type="BINDATA" />
<include name="IDR_WEBUI_JS_COLOR_UTILS_JS"
file="js/color_utils.js" type="BINDATA" />
<include name="IDR_WEBUI_JS_CR_EVENT_TARGET_M_JS"
file="${root_gen_dir}/ui/webui/resources/js/cr/event_target.m.js"
use_base_dir="false" type="BINDATA" />
<include name="IDR_WEBUI_JS_CR_UI_M_JS"
file="${root_gen_dir}/ui/webui/resources/js/cr/ui.m.js"
use_base_dir="false" type="BINDATA" />
<include name="IDR_WEBUI_JS_EVENT_TRACKER_M_JS"
file="${root_gen_dir}/ui/webui/resources/js/event_tracker.m.js"
use_base_dir="false" type="BINDATA" />
<include name="IDR_WEBUI_JS_ICON_M_JS"
file="${root_gen_dir}/ui/webui/resources/js/icon.m.js"
use_base_dir="false" type="BINDATA" />
<include name="IDR_WEBUI_JS_LOAD_TIME_DATA_M_JS"
file="${root_gen_dir}/ui/webui/resources/js/load_time_data.m.js"
use_base_dir="false" type="BINDATA" />
<include name="IDR_WEBUI_JS_PARSE_HTML_SUBSET_M_JS"
file="${root_gen_dir}/ui/webui/resources/js/parse_html_subset.m.js"
use_base_dir="false" type="BINDATA" />
<include name="IDR_WEBUI_JS_PLURAL_STRING_PROXY"
file="js/plural_string_proxy.js" type="BINDATA" />
<include name="IDR_WEBUI_JS_PROMISE_RESOLVER_M_JS"
file="${root_gen_dir}/ui/webui/resources/js/promise_resolver.m.js"
use_base_dir="false" type="BINDATA" />
<include name="IDR_WEBUI_JS_UTIL_M_JS"
file="${root_gen_dir}/ui/webui/resources/js/util.m.js"
use_base_dir="false" type="BINDATA"
preprocess="true" />
<if expr="not is_android">
<part file="cr_components/cr_components_images.grdp" />
<part file="cr_elements_images.grdp" />
</if>
<if expr="not is_android and not is_ios">
<part file="cr_polymer_resources_v3.grdp" />
</if>
</includes>
<structures>
<structure name="IDR_WEBUI_CSS_ACTION_LINK_CSS"
......@@ -252,41 +212,6 @@ without changes to the corresponding grd file. -->
<structure name="IDR_WEBUI_HTML_UTIL_HTML"
file="html/util.html" type="chrome_html" />
<structure name="IDR_WEBUI_JS_ACTION_LINK_JS"
file="js/action_link.js" type="chrome_html" />
<structure name="IDR_WEBUI_JS_ASSERT_JS"
file="js/assert.js" type="chrome_html" />
<structure name="IDR_WEBUI_JS_PROMISE_RESOLVER_JS"
file="js/promise_resolver.js" type="chrome_html" />
<structure name="IDR_WEBUI_JS_CR_JS"
file="js/cr.js" type="chrome_html"
preprocess="true" />
<structure name="IDR_WEBUI_JS_CR_M_JS"
file="js/cr.m.js" type="chrome_html"
preprocess="true" />
<structure name="IDR_WEBUI_JS_CR_EVENT_TARGET_JS"
file="js/cr/event_target.js" type="chrome_html" />
<structure name="IDR_WEBUI_JS_CR_UI_JS"
file="js/cr/ui.js" type="chrome_html" />
<structure name="IDR_WEBUI_JS_EVENT_TRACKER_JS"
file="js/event_tracker.js" type="chrome_html" />
<structure name="IDR_WEBUI_JS_ICON_JS"
file="js/icon.js" type="chrome_html" />
<structure name="IDR_WEBUI_JS_I18N_TEMPLATE_NO_PROCESS_JS"
file="js/i18n_template_no_process.js"
type="chrome_html" />
<structure name="IDR_WEBUI_JS_LOAD_TIME_DATA_JS"
file="js/load_time_data.js" type="chrome_html" />
<structure name="IDR_WEBUI_JS_PARSE_HTML_SUBSET_JS"
file="js/parse_html_subset.js" type="chrome_html" />
<structure name="IDR_WEBUI_JS_TEST_LOADER_JS"
file="js/test_loader.js" type="chrome_html"/>
<structure name="IDR_WEBUI_JS_UTIL_JS"
file="js/util.js" type="chrome_html" preprocess="true"/>
<structure name="IDR_WEBUI_JS_WEBUI_RESOURCE_TEST_JS"
file="js/webui_resource_test.js" type="chrome_html" />
<if expr="is_ios">
<structure name="IDR_WEBUI_JS_IOS_WEB_UI"
file="js/ios/web_ui.js" type="chrome_html" />
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment