Skip to content

Commit

Permalink
WebUI: Replace vulcanize with polymer-bundler.
Browse files Browse the repository at this point in the history
Summary of changes needed for the migration:
 - Excluded URLs behavior is different than Vulcanize, need to explicitly list
   all URLs to be excluded (unlike Vulcanize, transitive deps of an excluded
   URL are not implicitly excluded).
 - Excluded URLs need to match exactly, unlike Vulcanize where foo.html would
   match chrome://some-path/foo.html.
 - Input HTML files need to have
   <html><head>...</head><body>...</body></html> tags.
 - A single invocation of poylmer-bundler produces both "basic" and
   "lazy" modules (achieved by using the --shell flag), unlike Vulcanize
   which required two separate invocations.
 - Using new --manifest-out instead of previous --out-request-list flag to
   generate depfiles for Ninja.
 - Using --rewrite-urls-in-templates to preserve previous rewriting behavior.
 - polymer-bundler does not blow up when it can't find a file (unlike Vulcanize,
   so check output manifest for any reported "missing" dependencies).
 - Removed some Windows specific hacks that don't seem necessary anymore.

BUG=731881
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation

Review-Url: https://codereview.chromium.org/2936333002
Cr-Commit-Position: refs/heads/master@{#488821}
  • Loading branch information
freshp86 authored and Commit Bot committed Jul 22, 2017
1 parent af39181 commit 1e6a87f
Show file tree
Hide file tree
Showing 19 changed files with 205 additions and 190 deletions.
6 changes: 3 additions & 3 deletions chrome/browser/resources/md_bookmarks/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ vulcanized_unbuilt = "vulcanized.unbuilt.html"

vulcanize("vulcanize") {
host = "bookmarks"
html_in_file = "bookmarks.html"
html_out_file = vulcanized_unbuilt
html_in_files = [ "bookmarks.html" ]
html_out_files = [ vulcanized_unbuilt ]

input = rebase_path(".", root_build_dir)
js_out_file = "crisper.js"
js_out_files = [ "crisper.js" ]

deps = []
}
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/resources/md_bookmarks/bookmarks.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<body>
<bookmarks-app></bookmarks-app>

<link rel="import" href="chrome://resources/html/load_time_data.html">
<script src="chrome://resources/js/load_time_data.js"></script>
<script src="chrome://bookmarks/strings.js"></script>
<link rel="import" href="chrome://bookmarks/app.html">
</body>
Expand Down
6 changes: 3 additions & 3 deletions chrome/browser/resources/md_downloads/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ vulcanized_unbuilt = "vulcanized.unbuilt.html"
vulcanize("vulcanize") {
deps = []
host = "downloads"
html_in_file = "downloads.html"
html_out_file = vulcanized_unbuilt
html_in_files = [ "downloads.html" ]
html_out_files = [ vulcanized_unbuilt ]
input = rebase_path(".", root_build_dir)
insert_in_head = "<base href=chrome://downloads>"
js_out_file = "crisper.js"
js_out_files = [ "crisper.js" ]
}

polymer_css_build("build") {
Expand Down
30 changes: 11 additions & 19 deletions chrome/browser/resources/md_history/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,24 @@ lazy_load_unbuilt = "lazy_load.vulcanized.unbuilt.html"

vulcanize("vulcanize_app") {
host = "history"
html_in_file = "app.html"
html_out_file = app_unbuilt
html_in_files = [
"app.html",
"lazy_load.html",
]
html_out_files = [
app_unbuilt,
lazy_load_unbuilt,
]

input = rebase_path(".", root_build_dir)
js_out_file = "app.crisper.js"

excludes = [
"chrome://resources/html/util.html",
"chrome://history/constants.html",
js_out_files = [
"app.crisper.js",
"lazy_load.crisper.js",
]

deps = []
}

vulcanize("vulcanize_lazy_load") {
host = "history"
html_in_file = "lazy_load.html"
html_out_file = lazy_load_unbuilt

input = rebase_path(".", root_build_dir)
js_out_file = "lazy_load.crisper.js"
excludes = [
"chrome://resources/html/util.html",
"chrome://history/constants.html",
"chrome://history/app.html",
]

deps = []
Expand All @@ -46,6 +39,5 @@ polymer_css_build("build") {
]
deps = [
":vulcanize_app",
":vulcanize_lazy_load",
]
}
19 changes: 12 additions & 7 deletions chrome/browser/resources/md_history/lazy_load.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<link rel="import" href="chrome://history/synced_device_manager.html">
<link rel="import" href="chrome://resources/cr_elements/cr_action_menu/cr_action_menu.html">
<link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html">
<link rel="import" href="chrome://resources/cr_elements/cr_drawer/cr_drawer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_toolbar/cr_toolbar_selection_overlay.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<html>
<head></head>
<body>
<link rel="import" href="chrome://history/synced_device_manager.html">
<link rel="import" href="chrome://resources/cr_elements/cr_action_menu/cr_action_menu.html">
<link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html">
<link rel="import" href="chrome://resources/cr_elements/cr_drawer/cr_drawer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_toolbar/cr_toolbar_selection_overlay.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
</body>
</html>
29 changes: 11 additions & 18 deletions chrome/browser/resources/settings/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,20 @@ unpak_folder = "settings_resources.unpak"

vulcanize("vulcanize_app") {
host = "md-settings"
html_in_file = "settings.html"
html_out_file = app_unbuilt
insert_in_head = "<base href=\"chrome://\$i18n{hostname}\">"
input = rebase_path("$target_gen_dir/$unpak_folder", root_build_dir)
js_out_file = "crisper.js"

deps = [
":unpak",
html_in_files = [
"settings.html",
"lazy_load.html",
]
html_out_files = [
app_unbuilt,
lazy_load_unbuilt,
]
}

vulcanize("vulcanize_lazy_load") {
host = "md-settings"
html_in_file = "lazy_load.html"
html_out_file = lazy_load_unbuilt
insert_in_head = "<base href=\"chrome://\$i18n{hostname}\">"
input = rebase_path("$target_gen_dir/$unpak_folder", root_build_dir)
js_out_file = "lazy_load.crisper.js"

excludes = [ "/settings.html" ]
js_out_files = [
"crisper.js",
"lazy_load.crisper.js",
]

deps = [
":unpak",
Expand All @@ -55,7 +49,6 @@ polymer_css_build("build") {
]
deps = [
":vulcanize_app",
":vulcanize_lazy_load",
]
}

Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/resources/settings/i18n_setup.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<script src="chrome://resources/js/load_time_data.js"></script>
<script src="/strings.js"></script>
<script src="strings.js"></script>
31 changes: 18 additions & 13 deletions chrome/browser/resources/settings/lazy_load.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
<link rel="import" href="a11y_page/a11y_page.html">
<link rel="import" href="downloads_page/downloads_page.html">
<link rel="import" href="languages_page/languages_page.html">
<link rel="import" href="passwords_and_forms_page/passwords_and_forms_page.html">
<link rel="import" href="printing_page/printing_page.html">
<link rel="import" href="privacy_page/privacy_page.html">
<link rel="import" href="reset_page/reset_page.html">
<html>
<head></head>
<body>
<link rel="import" href="a11y_page/a11y_page.html">
<link rel="import" href="downloads_page/downloads_page.html">
<link rel="import" href="languages_page/languages_page.html">
<link rel="import" href="passwords_and_forms_page/passwords_and_forms_page.html">
<link rel="import" href="printing_page/printing_page.html">
<link rel="import" href="privacy_page/privacy_page.html">
<link rel="import" href="reset_page/reset_page.html">

<if expr="chromeos">
<link rel="import" href="date_time_page/date_time_page.html">
</if>
<if expr="chromeos">
<link rel="import" href="date_time_page/date_time_page.html">
</if>

<if expr="not chromeos">
<link rel="import" href="system_page/system_page.html">
</if>
<if expr="not chromeos">
<link rel="import" href="system_page/system_page.html">
</if>
</body>
</html>
24 changes: 13 additions & 11 deletions chrome/browser/resources/vulcanize.gni
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,23 @@ template("vulcanize") {
]

# This depfile is generated by vulcanize_gn.py
depfile = "${target_gen_dir}/${invoker.html_out_file}.d"
depfile = "${target_gen_dir}/${target_name}.d"

outputs = []
foreach(_out, invoker.html_out_files) {
outputs += [ "$target_gen_dir/$_out" ]
}
foreach(_out, invoker.js_out_files) {
outputs += [ "$target_gen_dir/$_out" ]
}

outputs = [
"$target_gen_dir/${invoker.html_out_file}",
"$target_gen_dir/${invoker.js_out_file}",
]
deps = invoker.deps

# Note that we have to manually pass the sources to our script if the
# script needs them as inputs.
args = [
"--host",
invoker.host,
"--html_in_file",
invoker.html_in_file,
"--html_out_file",
invoker.html_out_file,
"--js_out_file",
invoker.js_out_file,
"--input",
invoker.input,
"--out_folder",
Expand All @@ -61,6 +59,10 @@ template("vulcanize") {
rebase_path(depfile, root_build_dir),
]

args += [ "--html_in_files" ] + invoker.html_in_files
args += [ "--html_out_files" ] + invoker.html_out_files
args += [ "--js_out_files" ] + invoker.js_out_files

if (defined(invoker.excludes)) {
args += [ "--exclude" ] + invoker.excludes
}
Expand Down
Loading

0 comments on commit 1e6a87f

Please sign in to comment.