Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Unified Diff: tools/grit/grit_rule.gni

Issue 2179033002: Strip comments and whitespace from javascript resources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert changes to screen.js (no longer needed for this CL) Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/grit/grit/tool/build.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/grit/grit_rule.gni
diff --git a/tools/grit/grit_rule.gni b/tools/grit/grit_rule.gni
index b77a24d5e6fb3f2f429bb47c8f71fcea2941774e..d314e9b82a60b00c8e3fff8b22e12dd84e0410e4 100644
--- a/tools/grit/grit_rule.gni
+++ b/tools/grit/grit_rule.gni
@@ -82,6 +82,7 @@ import("//build/config/chrome_build.gni")
import("//build/config/crypto.gni")
import("//build/config/features.gni")
import("//build/config/ui.gni")
+import("//third_party/closure_compiler/closure_args.gni")
declare_args() {
# Enables used resource whitelist generation.
@@ -300,6 +301,11 @@ if (mac_views_browser) {
]
}
+# TODO(aberent): Enable for other platforms once the build machines have
+# Java on them (and hence can run the closure compiler).
+_strip_resource_files = is_android
+_js_minifier = "//third_party/closure_compiler/js_minify.py"
+
grit_resource_id_file = "//tools/gritsettings/resource_ids"
grit_info_script = "//tools/grit/grit_info.py"
@@ -441,6 +447,21 @@ template("grit") {
args += grit_flags + assert_files_flags
+ if (_strip_resource_files) {
+ js_minifier_command = rebase_path(_js_minifier)
+ js_minifier_command = "$js_minifier_command --closure_args"
+ foreach(closure_arg,
+ common_closure_args + minifying_closure_args +
+ default_disabled_closure_args) {
+ js_minifier_command = "$js_minifier_command $closure_arg"
+ }
+ args += [
+ "--js-minifier",
+ js_minifier_command,
+ ]
+ inputs += [ _js_minifier ]
+ }
+
if (defined(invoker.visibility)) {
# This needs to include both what the invoker specified (since they
# probably include generated headers from this target), as well as the
« no previous file with comments | « tools/grit/grit/tool/build.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698