Skip to content

Commit

Permalink
WebUI: Split :preprocess target in build_webui() to separate targets.
Browse files Browse the repository at this point in the history
This is in preparation of adding source maps generation in
build_webui().

Bug: 1416356
Change-Id: I007503a33fc3ff9ca150d078122b4f22aa21909b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4247057
Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
Reviewed-by: Rebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1105397}
  • Loading branch information
freshp86 authored and Chromium LUCI CQ committed Feb 15, 2023
1 parent 515dce8 commit cde79d5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 11 deletions.
39 changes: 29 additions & 10 deletions chrome/browser/resources/tools/build_webui.gni
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,9 @@ template("build_webui") {
}
}

preprocess_if_expr("preprocess") {
preprocess_if_expr("preprocess_ts_files") {
visibility = [
":build_ts",
":css_wrapper_files",
":html_wrapper_files",
]

Expand All @@ -135,35 +134,55 @@ template("build_webui") {
in_folder = "."
out_folder = preprocess_dir
in_files = ts_files
}

if (defined(html_files)) {
in_files += html_files
}
if (defined(html_files) || defined(invoker.css_files)) {
preprocess_if_expr("preprocess_html_css_files") {
visibility = [
":css_wrapper_files",
":html_wrapper_files",
]

if (defined(invoker.css_files)) {
in_files += invoker.css_files
if (use_blink) {
defines = chrome_grit_defines
}

in_folder = "."
out_folder = preprocess_dir

in_files = []
if (defined(html_files)) {
in_files += html_files
}

if (defined(invoker.css_files)) {
in_files += invoker.css_files
}
}
}

if (defined(html_files)) {
html_to_wrapper("html_wrapper_files") {
visibility = [ ":build_ts" ]
deps = [ ":preprocess" ]
deps = [ ":preprocess_html_css_files" ]
in_folder = preprocess_dir
out_folder = preprocess_dir
in_files = html_files
minify = optimize

if (defined(invoker.html_to_wrapper_template)) {
template = invoker.html_to_wrapper_template
if (invoker.html_to_wrapper_template == "detect") {
deps += [ ":preprocess_ts_files" ]
}
}
}
}

if (defined(invoker.css_files)) {
css_to_wrapper("css_wrapper_files") {
visibility = [ ":build_ts" ]
deps = [ ":preprocess" ]
deps = [ ":preprocess_html_css_files" ]
in_folder = preprocess_dir
out_folder = preprocess_dir
in_files = invoker.css_files
Expand Down Expand Up @@ -202,7 +221,7 @@ template("build_webui") {

in_files = ts_files

extra_deps = [ ":preprocess" ]
extra_deps = [ ":preprocess_ts_files" ]

if (defined(html_files)) {
in_files += html_wrapper_files
Expand Down
3 changes: 2 additions & 1 deletion docs/webui_build_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,8 @@ rules described earlier.
Under the cover, build_webui() defines the following targets
preprocess_if_expr("preprocess")
preprocess_if_expr("preprocess_ts_files")
preprocess_if_expr("preprocess_html_css_files")
html_to_wrapper("html_wrapper_files")
css_to_wrapper("css_wrapper_files")
copy("copy_mojo")
Expand Down

0 comments on commit cde79d5

Please sign in to comment.