Commit fef60728 authored by rbpotter's avatar rbpotter Committed by Commit Bot

Bookmarks: Autogenerate grd files

Bug: 1132403
Change-Id: I414ca14eb4b4b8f39231969d62e0f8c09e37e80e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2467296Reviewed-by: default avatardpapad <dpapad@chromium.org>
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#816654}
parent 24a8a2eb
...@@ -111,19 +111,20 @@ if (!is_android) { ...@@ -111,19 +111,20 @@ if (!is_android) {
grit_flags = [ grit_flags = [
"-E", "-E",
"root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
"-E",
"root_src_dir=" + rebase_path("//", root_build_dir),
] ]
if (optimize_webui) { defines = chrome_grit_defines
source = "bookmarks/bookmarks_resources_vulcanized.grd"
deps = [ "//chrome/browser/resources/bookmarks:build" ]
} else {
source = "bookmarks/bookmarks_resources.grd"
deps = [ "//chrome/browser/resources/bookmarks:web_components" ] # These arguments are needed since the grd is generated at build time.
} enable_input_discovery_for_gn_analyze = false
defines += [ "SHARED_INTERMEDIATE_DIR=" +
rebase_path(root_gen_dir, root_build_dir) ]
bookmarks_gen_dir = "$root_gen_dir/chrome/browser/resources/bookmarks"
source = "$bookmarks_gen_dir/bookmarks_resources.grd"
deps = [ "//chrome/browser/resources/bookmarks:build_grd" ]
defines = chrome_grit_defines
outputs = [ outputs = [
"grit/bookmarks_resources.h", "grit/bookmarks_resources.h",
"grit/bookmarks_resources_map.cc", "grit/bookmarks_resources_map.cc",
......
...@@ -6,16 +6,22 @@ import("//chrome/common/features.gni") ...@@ -6,16 +6,22 @@ import("//chrome/common/features.gni")
import("//third_party/closure_compiler/compile_js.gni") import("//third_party/closure_compiler/compile_js.gni")
import("//tools/grit/preprocess_grit.gni") import("//tools/grit/preprocess_grit.gni")
import("//tools/polymer/html_to_js.gni") import("//tools/polymer/html_to_js.gni")
import("//ui/webui/resources/tools/generate_grd.gni")
import("../optimize_webui.gni") import("../optimize_webui.gni")
preprocess_folder = "preprocessed"
preprocess_manifest = "preprocessed_manifest.json"
preprocess_gen_manifest = "preprocessed_gen_manifest.json"
if (optimize_webui) { if (optimize_webui) {
preprocess_folder = "preprocessed" build_manifest = "build_manifest.json"
optimize_webui("build") { optimize_webui("build") {
host = "bookmarks" host = "bookmarks"
input = rebase_path("$target_gen_dir/$preprocess_folder", root_build_dir) input = rebase_path("$target_gen_dir/$preprocess_folder", root_build_dir)
js_out_files = [ "bookmarks.rollup.js" ] js_out_files = [ "bookmarks.rollup.js" ]
js_module_in_files = [ "bookmarks.js" ] js_module_in_files = [ "bookmarks.js" ]
out_manifest = "$target_gen_dir/$build_manifest"
deps = [ deps = [
":preprocess", ":preprocess",
...@@ -24,45 +30,67 @@ if (optimize_webui) { ...@@ -24,45 +30,67 @@ if (optimize_webui) {
] ]
excludes = [ "chrome://resources/js/cr.m.js" ] excludes = [ "chrome://resources/js/cr.m.js" ]
} }
}
preprocess_grit("preprocess") { generate_grd("build_grd") {
in_folder = "./" input_files = [ "bookmarks.html" ]
out_folder = "$target_gen_dir/$preprocess_folder" input_files_base_dir = rebase_path(".", "//")
in_files = [ if (optimize_webui) {
"actions.js", deps = [ ":build" ]
"api_listener.js", manifest_files = [ "$target_gen_dir/$build_manifest" ]
"bookmarks.js", } else {
"browser_proxy.js", deps = [
"constants.js", ":preprocess",
"debouncer.js", ":preprocess_generated",
"dialog_focus_manager.js",
"dnd_manager.js",
"mouse_focus_behavior.js",
"reducers.js",
"store_client.js",
"store.js",
"types.js",
"util.js",
] ]
} manifest_files = [
"$target_gen_dir/$preprocess_manifest",
preprocess_grit("preprocess_generated") { "$target_gen_dir/$preprocess_gen_manifest",
deps = [ ":web_components" ]
in_folder = target_gen_dir
out_folder = "$target_gen_dir/$preprocess_folder"
in_files = [
"app.js",
"command_manager.js",
"edit_dialog.js",
"folder_node.js",
"item.js",
"list.js",
"router.js",
"shared_style.js",
"shared_vars.js",
"toolbar.js",
] ]
} }
grd_prefix = "bookmarks"
out_grd = "$target_gen_dir/${grd_prefix}_resources.grd"
}
preprocess_grit("preprocess") {
in_folder = "./"
out_folder = "$target_gen_dir/$preprocess_folder"
out_manifest = "$target_gen_dir/$preprocess_manifest"
in_files = [
"actions.js",
"api_listener.js",
"bookmarks.js",
"browser_proxy.js",
"constants.js",
"debouncer.js",
"dialog_focus_manager.js",
"dnd_manager.js",
"mouse_focus_behavior.js",
"reducers.js",
"store_client.js",
"store.js",
"types.js",
"util.js",
]
}
preprocess_grit("preprocess_generated") {
deps = [ ":web_components" ]
in_folder = target_gen_dir
out_folder = "$target_gen_dir/$preprocess_folder"
out_manifest = "$target_gen_dir/$preprocess_gen_manifest"
in_files = [
"app.js",
"command_manager.js",
"edit_dialog.js",
"folder_node.js",
"item.js",
"list.js",
"router.js",
"shared_style.js",
"shared_vars.js",
"toolbar.js",
]
} }
html_to_js("web_components") { html_to_js("web_components") {
......
<?xml version="1.0" encoding="UTF-8"?>
<grit latest_public_release="0" current_release="1" output_all_resource_defines="false">
<outputs>
<output filename="grit/bookmarks_resources.h" type="rc_header">
<emit emit_type='prepend'></emit>
</output>
<output filename="grit/bookmarks_resources_map.cc"
type="resource_file_map_source" />
<output filename="grit/bookmarks_resources_map.h"
type="resource_map_header" />
<output filename="bookmarks_resources.pak" type="data_package" />
</outputs>
<release seq="1">
<includes>
<include name="IDR_BOOKMARKS_APP_JS"
file="${root_gen_dir}/chrome/browser/resources/bookmarks/app.js"
use_base_dir="false" type="BINDATA" preprocess="true" />
<include name="IDR_BOOKMARKS_COMMAND_MANAGER_JS"
file="${root_gen_dir}/chrome/browser/resources/bookmarks/command_manager.js"
use_base_dir="false" type="BINDATA" />
<include name="IDR_BOOKMARKS_EDIT_DIALOG_JS"
file="${root_gen_dir}/chrome/browser/resources/bookmarks/edit_dialog.js"
use_base_dir="false" type="BINDATA" />
<include name="IDR_BOOKMARKS_FOLDER_NODE_JS"
file="${root_gen_dir}/chrome/browser/resources/bookmarks/folder_node.js"
use_base_dir="false" type="BINDATA" />
<include name="IDR_BOOKMARKS_ITEM_JS"
file="${root_gen_dir}/chrome/browser/resources/bookmarks/item.js"
use_base_dir="false" type="BINDATA" preprocess="true" />
<include name="IDR_BOOKMARKS_LIST_JS"
file="${root_gen_dir}/chrome/browser/resources/bookmarks/list.js"
use_base_dir="false" type="BINDATA" />
<include name="IDR_BOOKMARKS_ROUTER_JS"
file="${root_gen_dir}/chrome/browser/resources/bookmarks/router.js"
use_base_dir="false" type="BINDATA" />
<include name="IDR_BOOKMARKS_SHARED_STYLE_JS"
file="${root_gen_dir}/chrome/browser/resources/bookmarks/shared_style.js"
use_base_dir="false" type="BINDATA" preprocess="true" />
<include name="IDR_BOOKMARKS_SHARED_VARS_JS"
file="${root_gen_dir}/chrome/browser/resources/bookmarks/shared_vars.js"
use_base_dir="false" type="BINDATA" />
<include name="IDR_BOOKMARKS_TOOLBAR_JS"
file="${root_gen_dir}/chrome/browser/resources/bookmarks/toolbar.js"
use_base_dir="false" type="BINDATA" />
</includes>
<structures>
<structure name="IDR_BOOKMARKS_ACTIONS_JS"
file="actions.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_API_LISTENER_JS"
file="api_listener.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_BOOKMARKS_HTML"
file="bookmarks.html"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_BOOKMARKS_JS"
file="bookmarks.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_BROWSER_PROXY_JS"
file="browser_proxy.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_CONSTANTS_JS"
file="constants.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_DEBOUNCER_JS"
file="debouncer.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_DIALOG_FOCUS_MANAGER_JS"
file="dialog_focus_manager.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_DND_MANAGER_JS"
file="dnd_manager.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_MOUSE_FOCUS_BEHAVIOR_JS"
file="mouse_focus_behavior.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_REDUCERS_JS"
file="reducers.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_STORE_CLIENT_JS"
file="store_client.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_STORE_JS"
file="store.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_TYPES_JS"
file="types.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_UTIL_JS"
file="util.js"
type="chrome_html" />
</structures>
</release>
</grit>
<?xml version="1.0" encoding="UTF-8"?>
<grit latest_public_release="0" current_release="1" output_all_resource_defines="false">
<outputs>
<output filename="grit/bookmarks_resources.h" type="rc_header">
<emit emit_type='prepend'></emit>
</output>
<output filename="grit/bookmarks_resources_map.cc"
type="resource_map_source" />
<output filename="grit/bookmarks_resources_map.h"
type="resource_map_header" />
<output filename="bookmarks_resources.pak" type="data_package" />
</outputs>
<release seq="1">
<includes>
<include name="IDR_BOOKMARKS_BOOKMARKS_HTML"
file="bookmarks.html"
type="chrome_html" />
<include name="IDR_BOOKMARKS_BOOKMARKS_ROLLUP_JS"
file="${root_gen_dir}\chrome\browser\resources\bookmarks\bookmarks.rollup.js"
use_base_dir="false"
type="chrome_html" />
</includes>
</release>
</grit>
...@@ -35,11 +35,6 @@ ...@@ -35,11 +35,6 @@
namespace { namespace {
#if !BUILDFLAG(OPTIMIZE_WEBUI)
constexpr char kGeneratedPath[] =
"@out_folder@/gen/chrome/browser/resources/bookmarks/";
#endif
void AddLocalizedString(content::WebUIDataSource* source, void AddLocalizedString(content::WebUIDataSource* source,
const std::string& message, const std::string& message,
int id) { int id) {
...@@ -51,16 +46,9 @@ void AddLocalizedString(content::WebUIDataSource* source, ...@@ -51,16 +46,9 @@ void AddLocalizedString(content::WebUIDataSource* source,
content::WebUIDataSource* CreateBookmarksUIHTMLSource(Profile* profile) { content::WebUIDataSource* CreateBookmarksUIHTMLSource(Profile* profile) {
content::WebUIDataSource* source = content::WebUIDataSource* source =
content::WebUIDataSource::Create(chrome::kChromeUIBookmarksHost); content::WebUIDataSource::Create(chrome::kChromeUIBookmarksHost);
#if BUILDFLAG(OPTIMIZE_WEBUI)
webui::SetupBundledWebUIDataSource(source, "bookmarks.js",
IDR_BOOKMARKS_BOOKMARKS_ROLLUP_JS,
IDR_BOOKMARKS_BOOKMARKS_HTML);
#else
webui::SetupWebUIDataSource( webui::SetupWebUIDataSource(
source, base::make_span(kBookmarksResources, kBookmarksResourcesSize), source, base::make_span(kBookmarksResources, kBookmarksResourcesSize), "",
kGeneratedPath, IDR_BOOKMARKS_BOOKMARKS_HTML); IDR_BOOKMARKS_BOOKMARKS_HTML);
#endif
// Build an Accelerator to describe undo shortcut // Build an Accelerator to describe undo shortcut
// NOTE: the undo shortcut is also defined in bookmarks/command_manager.js // NOTE: the undo shortcut is also defined in bookmarks/command_manager.js
......
...@@ -106,12 +106,9 @@ ...@@ -106,12 +106,9 @@
"includes": [1220], "includes": [1220],
"structures": [1240], "structures": [1240],
}, },
"chrome/browser/resources/bookmarks/bookmarks_resources.grd": { "<(SHARED_INTERMEDIATE_DIR)/chrome/browser/resources/bookmarks/bookmarks_resources.grd": {
"META": {"sizes": {"includes": [50],}},
"includes": [1260], "includes": [1260],
"structures": [1280],
},
"chrome/browser/resources/bookmarks/bookmarks_resources_vulcanized.grd": {
"includes": [1300],
}, },
"chrome/browser/resources/chromeos/cellular_setup/cellular_setup_resources.grd": { "chrome/browser/resources/chromeos/cellular_setup/cellular_setup_resources.grd": {
"structures": [1360], "structures": [1360],
......
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