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

Unified Diff: tools/grit/grit/tool/build.py

Issue 2094193004: Strip comments and whitespace from Javascript resources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to comments, plus rebases. Created 4 years, 5 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
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..bfe901ac82657ba0315d5b3d096fb5a93e29620d 100755
--- a/tools/grit/grit/tool/build.py
+++ b/tools/grit/grit/tool/build.py
@@ -2,6 +2,7 @@
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+from grit.util import RAW_TEXT
'''The 'grit build' tool along with integration for this tool with the
SCons build system.
@@ -11,6 +12,7 @@ import codecs
import filecmp
import getopt
import os
+import shlex
import shutil
import sys
@@ -123,6 +125,11 @@ Options:
generated will depend on a stampfile instead of the first
output in the input .grd file.
+ --moved-input-file-list
+ Provides a file listing files that should be fetched from
+ modified locations. Each entry in the list is of the form
+ <original-path>:<actual-path>. Both paths must be absolute.
+
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,12 +152,14 @@ are exported to translation interchange files (e.g. XMB files), etc.
output_all_resource_defines = None
write_only_new = False
depend_on_stamp = False
+ replacement_paths = {}
(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',
- 'write-only-new='))
+ 'write-only-new=',
+ 'moved-input-file-list='))
for (key, val) in own_opts:
if key == '-a':
assert_output_files.append(val)
@@ -188,6 +197,11 @@ 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 == '--moved-input-file-list':
+ moved_list = shlex.split(util.ReadFile(val, RAW_TEXT))
+ for m in moved_list:
+ (oldpath, newpath) = str.split(m, ':')
+ replacement_paths[oldpath] = newpath
if len(args):
print 'This tool takes no tool-specific arguments.'
@@ -200,6 +214,8 @@ are exported to translation interchange files (e.g. XMB files), etc.
(self.output_directory,
os.path.abspath(self.output_directory)))
+ util.SetReplacementPaths(replacement_paths)
+
if whitelist_filenames:
self.whitelist_names = set()
for whitelist_filename in whitelist_filenames:

Powered by Google App Engine
This is Rietveld 408576698