Commit 7177fe76 authored by rbpotter's avatar rbpotter Committed by Commit Bot

WebUI: Stop preprocessing rollup output

Since shared resources are now preprocessed before being passed to
rollup, there should not be any <if expr> in files used as inputs to
rollup. For UI specific files (not shared), preprocessing should be done
before passing files to rollup by either
(1) passing rollup the output of a preprocess_grit target or
(2) correctly specifying preprocessing for grd entries corresponding to
    files using <if expr>
Since there are no <if expr> in any inputs, there should also be no
such expressions in the bundled output.

This CL:
(1) Adds a check and assert that no <if expr> are found in the bundled
    output files generated by rollup.
(2) Removes preprocess="true" for files generated by rollup, as it
    should now be unnecessary.
(3) Fixes a few existing cases in settings/OS settings, where
    preprocessing was not specified in the grd for files that use
    <if expr>.

Bug: 1071641
Change-Id: I0f2b48af1d4b200a2f721217e8f294f296c9a5ce
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2415044Reviewed-by: default avatardpapad <dpapad@chromium.org>
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808003}
parent c0d0da84
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
<include name="IDR_BOOKMARKS_BOOKMARKS_ROLLUP_JS" <include name="IDR_BOOKMARKS_BOOKMARKS_ROLLUP_JS"
file="${root_gen_dir}\chrome\browser\resources\bookmarks\bookmarks.rollup.js" file="${root_gen_dir}\chrome\browser\resources\bookmarks\bookmarks.rollup.js"
use_base_dir="false" use_base_dir="false"
preprocess="true"
type="chrome_html" /> type="chrome_html" />
</includes> </includes>
</release> </release>
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
<include name="IDR_DOWNLOADS_DOWNLOADS_ROLLUP_JS" <include name="IDR_DOWNLOADS_DOWNLOADS_ROLLUP_JS"
file="${root_gen_dir}\chrome\browser\resources\downloads\downloads.rollup.js" file="${root_gen_dir}\chrome\browser\resources\downloads\downloads.rollup.js"
use_base_dir="false" use_base_dir="false"
preprocess="true"
type="BINDATA" /> type="BINDATA" />
</includes> </includes>
</release> </release>
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
<include name="IDR_EXTENSIONS_EXTENSIONS_ROLLUP_JS" <include name="IDR_EXTENSIONS_EXTENSIONS_ROLLUP_JS"
file="${root_gen_dir}\chrome\browser\resources\extensions\extensions.rollup.js" file="${root_gen_dir}\chrome\browser\resources\extensions\extensions.rollup.js"
use_base_dir="false" use_base_dir="false"
preprocess="true"
type="BINDATA" /> type="BINDATA" />
<include name="IDR_EXTENSIONS_CHECKUP_IMAGE" <include name="IDR_EXTENSIONS_CHECKUP_IMAGE"
file="checkup_image.svg" file="checkup_image.svg"
......
...@@ -24,17 +24,14 @@ ...@@ -24,17 +24,14 @@
type="BINDATA" /> type="BINDATA" />
<include name="IDR_HISTORY_HISTORY_ROLLUP_JS" <include name="IDR_HISTORY_HISTORY_ROLLUP_JS"
file="${root_gen_dir}\chrome\browser\resources\history\history.rollup.js" file="${root_gen_dir}\chrome\browser\resources\history\history.rollup.js"
preprocess="true"
type="BINDATA" type="BINDATA"
use_base_dir="false" /> use_base_dir="false" />
<include name="IDR_HISTORY_LAZY_LOAD_ROLLUP_JS" <include name="IDR_HISTORY_LAZY_LOAD_ROLLUP_JS"
file="${root_gen_dir}\chrome\browser\resources\history\lazy_load.rollup.js" file="${root_gen_dir}\chrome\browser\resources\history\lazy_load.rollup.js"
preprocess="true"
type="BINDATA" type="BINDATA"
use_base_dir="false" /> use_base_dir="false" />
<include name="IDR_HISTORY_SHARED_ROLLUP_JS" <include name="IDR_HISTORY_SHARED_ROLLUP_JS"
file="${root_gen_dir}\chrome\browser\resources\history\shared.rollup.js" file="${root_gen_dir}\chrome\browser\resources\history\shared.rollup.js"
preprocess="true"
type="BINDATA" type="BINDATA"
use_base_dir="false" /> use_base_dir="false" />
</includes> </includes>
......
...@@ -14,8 +14,7 @@ ...@@ -14,8 +14,7 @@
<includes> <includes>
<include name="IDR_NEW_TAB_PAGE_NEW_TAB_PAGE_JS" <include name="IDR_NEW_TAB_PAGE_NEW_TAB_PAGE_JS"
file="${root_gen_dir}/chrome/browser/resources/new_tab_page/new_tab_page.rollup.js" file="${root_gen_dir}/chrome/browser/resources/new_tab_page/new_tab_page.rollup.js"
use_base_dir="false" type="BINDATA" use_base_dir="false" type="BINDATA" />
preprocess="true" />
<part file="new_tab_page_resources_common.grdp" /> <part file="new_tab_page_resources_common.grdp" />
</includes> </includes>
</release> </release>
......
...@@ -257,6 +257,13 @@ def _bundle_v3(tmp_out_dir, in_path, out_path, manifest_out_path, args, ...@@ -257,6 +257,13 @@ def _bundle_v3(tmp_out_dir, in_path, out_path, manifest_out_path, args,
'unexpected number of bundles - %s - generated by rollup' % \ 'unexpected number of bundles - %s - generated by rollup' % \
(len(generated_paths)) (len(generated_paths))
for bundled_file in bundled_paths:
with open(bundled_file, 'r') as f:
output = f.read()
assert "<if expr" not in output, \
'Unexpected <if expr> found in bundled output. Check that all ' + \
'input files using such expressions are preprocessed.'
return bundled_paths return bundled_paths
def _bundle_v2(tmp_out_dir, in_path, out_path, manifest_out_path, args, def _bundle_v2(tmp_out_dir, in_path, out_path, manifest_out_path, args,
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
<include name="IDR_PRINT_PREVIEW_PRINT_PREVIEW_ROLLUP_JS" <include name="IDR_PRINT_PREVIEW_PRINT_PREVIEW_ROLLUP_JS"
file="${root_gen_dir}\chrome\browser\resources\print_preview\print_preview.rollup.js" file="${root_gen_dir}\chrome\browser\resources\print_preview\print_preview.rollup.js"
use_base_dir="false" use_base_dir="false"
preprocess="true"
type="BINDATA" /> type="BINDATA" />
</includes> </includes>
</release> </release>
......
...@@ -612,11 +612,13 @@ ...@@ -612,11 +612,13 @@
file="${root_gen_dir}/chrome/browser/resources/settings/settings_page/settings_subpage.m.js" file="${root_gen_dir}/chrome/browser/resources/settings/settings_page/settings_subpage.m.js"
use_base_dir="false" use_base_dir="false"
compress="false" compress="false"
preprocess="true"
type="BINDATA"/> type="BINDATA"/>
<include name="IDR_OS_SETTINGS_SETTINGS_ANIMATED_PAGES_M_JS" <include name="IDR_OS_SETTINGS_SETTINGS_ANIMATED_PAGES_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/settings_page/settings_animated_pages.m.js" file="${root_gen_dir}/chrome/browser/resources/settings/settings_page/settings_animated_pages.m.js"
use_base_dir="false" use_base_dir="false"
compress="false" compress="false"
preprocess="true"
type="BINDATA"/> type="BINDATA"/>
<include name="IDR_OS_SETTINGS_SETTINGS_TOGGLE_BUTTON_M_JS" <include name="IDR_OS_SETTINGS_SETTINGS_TOGGLE_BUTTON_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/controls/settings_toggle_button.m.js" file="${root_gen_dir}/chrome/browser/resources/settings/controls/settings_toggle_button.m.js"
...@@ -643,6 +645,7 @@ ...@@ -643,6 +645,7 @@
file="${root_gen_dir}/chrome/browser/resources/settings/prefs/prefs.m.js" file="${root_gen_dir}/chrome/browser/resources/settings/prefs/prefs.m.js"
use_base_dir="false" use_base_dir="false"
compress="false" compress="false"
preprocess="true"
type="BINDATA"/> type="BINDATA"/>
<include name="IDR_OS_SETTINGS_PREFS_PREF_UTIL_M_JS" <include name="IDR_OS_SETTINGS_PREFS_PREF_UTIL_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/prefs/pref_util.m.js" file="${root_gen_dir}/chrome/browser/resources/settings/prefs/pref_util.m.js"
......
...@@ -85,19 +85,16 @@ ...@@ -85,19 +85,16 @@
<include name="IDR_OS_SETTINGS_OS_SETTINGS_ROLLUP_JS" <include name="IDR_OS_SETTINGS_OS_SETTINGS_ROLLUP_JS"
file="${root_gen_dir}\chrome\browser\resources\settings\chromeos\os_settings.rollup.js" file="${root_gen_dir}\chrome\browser\resources\settings\chromeos\os_settings.rollup.js"
use_base_dir="false" use_base_dir="false"
preprocess="true"
type="BINDATA" /> type="BINDATA" />
<include name="IDR_OS_SETTINGS_OS_SETTINGS_V3_HTML" <include name="IDR_OS_SETTINGS_OS_SETTINGS_V3_HTML"
file="chromeos/os_settings_v3.html" file="chromeos/os_settings_v3.html"
type="BINDATA" /> type="BINDATA" />
<include name="IDR_OS_SETTINGS_LAZY_LOAD_ROLLUP_JS" <include name="IDR_OS_SETTINGS_LAZY_LOAD_ROLLUP_JS"
file="${root_gen_dir}\chrome\browser\resources\settings\chromeos\lazy_load.rollup.js" file="${root_gen_dir}\chrome\browser\resources\settings\chromeos\lazy_load.rollup.js"
preprocess="true"
type="BINDATA" type="BINDATA"
use_base_dir="false" /> use_base_dir="false" />
<include name="IDR_OS_SETTINGS_SHARED_ROLLUP_JS" <include name="IDR_OS_SETTINGS_SHARED_ROLLUP_JS"
file="${root_gen_dir}\chrome\browser\resources\settings\chromeos\shared.rollup.js" file="${root_gen_dir}\chrome\browser\resources\settings\chromeos\shared.rollup.js"
preprocess="true"
type="BINDATA" type="BINDATA"
use_base_dir="false" /> use_base_dir="false" />
</includes> </includes>
......
...@@ -457,6 +457,7 @@ ...@@ -457,6 +457,7 @@
<include name="IDR_SETTINGS_PEOPLE_PAGE_SYNC_CONTROLS_M_JS" <include name="IDR_SETTINGS_PEOPLE_PAGE_SYNC_CONTROLS_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/people_page/sync_controls.m.js" file="${root_gen_dir}/chrome/browser/resources/settings/people_page/sync_controls.m.js"
use_base_dir="false" use_base_dir="false"
preprocess="true"
compress="false" type="BINDATA" /> compress="false" type="BINDATA" />
<include name="IDR_SETTINGS_PEOPLE_PAGE_SYNC_PAGE_M_JS" <include name="IDR_SETTINGS_PEOPLE_PAGE_SYNC_PAGE_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/people_page/sync_page.m.js" file="${root_gen_dir}/chrome/browser/resources/settings/people_page/sync_page.m.js"
...@@ -466,6 +467,7 @@ ...@@ -466,6 +467,7 @@
<include name="IDR_SETTINGS_PREFS_PREFS_M_JS" <include name="IDR_SETTINGS_PREFS_PREFS_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/prefs/prefs.m.js" file="${root_gen_dir}/chrome/browser/resources/settings/prefs/prefs.m.js"
use_base_dir="false" use_base_dir="false"
preprocess="true"
compress="false" type="BINDATA" /> compress="false" type="BINDATA" />
<include name="IDR_SETTINGS_PREFS_PREFS_BEHAVIOR_M_JS" <include name="IDR_SETTINGS_PREFS_PREFS_BEHAVIOR_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/prefs/prefs_behavior.m.js" file="${root_gen_dir}/chrome/browser/resources/settings/prefs/prefs_behavior.m.js"
...@@ -665,6 +667,7 @@ ...@@ -665,6 +667,7 @@
<include name="IDR_SETTINGS_SETTINGS_PAGE_SETTINGS_ANIMATED_PAGES_M_JS" <include name="IDR_SETTINGS_SETTINGS_PAGE_SETTINGS_ANIMATED_PAGES_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/settings_page/settings_animated_pages.m.js" file="${root_gen_dir}/chrome/browser/resources/settings/settings_page/settings_animated_pages.m.js"
use_base_dir="false" use_base_dir="false"
preprocess="true"
compress="false" type="BINDATA" /> compress="false" type="BINDATA" />
<include name="IDR_SETTINGS_SETTINGS_PAGE_SETTINGS_SECTION_M_JS" <include name="IDR_SETTINGS_SETTINGS_PAGE_SETTINGS_SECTION_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/settings_page/settings_section.m.js" file="${root_gen_dir}/chrome/browser/resources/settings/settings_page/settings_section.m.js"
......
...@@ -55,16 +55,13 @@ ...@@ -55,16 +55,13 @@
<include name="IDR_SETTINGS_SETTINGS_ROLLUP_JS" <include name="IDR_SETTINGS_SETTINGS_ROLLUP_JS"
file="${root_gen_dir}\chrome\browser\resources\settings\settings.rollup.js" file="${root_gen_dir}\chrome\browser\resources\settings\settings.rollup.js"
use_base_dir="false" use_base_dir="false"
preprocess="true"
type="BINDATA" /> type="BINDATA" />
<include name="IDR_SETTINGS_LAZY_LOAD_ROLLUP_JS" <include name="IDR_SETTINGS_LAZY_LOAD_ROLLUP_JS"
file="${root_gen_dir}\chrome\browser\resources\settings\lazy_load.rollup.js" file="${root_gen_dir}\chrome\browser\resources\settings\lazy_load.rollup.js"
preprocess="true"
type="BINDATA" type="BINDATA"
use_base_dir="false" /> use_base_dir="false" />
<include name="IDR_SETTINGS_SHARED_ROLLUP_JS" <include name="IDR_SETTINGS_SHARED_ROLLUP_JS"
file="${root_gen_dir}\chrome\browser\resources\settings\shared.rollup.js" file="${root_gen_dir}\chrome\browser\resources\settings\shared.rollup.js"
preprocess="true"
type="BINDATA" type="BINDATA"
use_base_dir="false" /> use_base_dir="false" />
</includes> </includes>
......
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