Index: tools/grit/grit/tool/build.py |
diff --git a/tools/grit/grit/tool/build.py b/tools/grit/grit/tool/build.py |
index 65a966f5ac041b30a72a202a856c05f0dc025765..5812de404c2ae0abe27208fb60ef049e33f4bf24 100755 |
--- a/tools/grit/grit/tool/build.py |
+++ b/tools/grit/grit/tool/build.py |
@@ -18,6 +18,7 @@ from grit import grd_reader |
from grit import util |
from grit.tool import interface |
from grit import shortcuts |
+from grit.format import minifier |
# It would be cleaner to have each module register itself, but that would |
@@ -123,6 +124,12 @@ Options: |
generated will depend on a stampfile instead of the first |
output in the input .grd file. |
+ --js-minifier A command to run to minify Javascript. If not set then |
+ Javascript won't be minified. The command should read the |
+ original Javascript from standard input, and output the |
+ minified Javascript to standard output. A non-zero exit |
+ status will be taken as indicating failure. |
+ |
Conditional inclusion of resources only affects the output of files which |
control which resources get linked into a binary, e.g. it affects .rc files |
meant for compilation but it does not affect resource header files (that define |
@@ -145,11 +152,13 @@ are exported to translation interchange files (e.g. XMB files), etc. |
output_all_resource_defines = None |
write_only_new = False |
depend_on_stamp = False |
+ js_minifier = None |
(own_opts, args) = getopt.getopt(args, 'a:o:D:E:f:w:t:h:', |
('depdir=','depfile=','assert-file-list=', |
'output-all-resource-defines', |
'no-output-all-resource-defines', |
'depend-on-stamp', |
+ 'js-minifier=', |
'write-only-new=')) |
for (key, val) in own_opts: |
if key == '-a': |
@@ -188,6 +197,8 @@ are exported to translation interchange files (e.g. XMB files), etc. |
write_only_new = val != '0' |
elif key == '--depend-on-stamp': |
depend_on_stamp = True |
+ elif key == '--js-minifier': |
+ js_minifier = val |
if len(args): |
print 'This tool takes no tool-specific arguments.' |
@@ -207,6 +218,9 @@ are exported to translation interchange files (e.g. XMB files), etc. |
whitelist_contents = util.ReadFile(whitelist_filename, util.RAW_TEXT) |
self.whitelist_names.update(whitelist_contents.strip().split('\n')) |
+ if js_minifier: |
+ minifier.SetJsMinifier(js_minifier) |
+ |
self.write_only_new = write_only_new |
self.res = grd_reader.Parse(opts.input, |