Chromium Code Reviews| 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..67155f98435224d18999a547cd5e5689a473ed33 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 |
|
Lei Zhang
2016/06/29 22:51:32
Why is this on top?
|
| '''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,12 @@ Options: |
| generated will depend on a stampfile instead of the first |
| output in the input .grd file. |
| + --moved-input-file |
| + Specifies that a file referenced (directly or indirectly) by |
| + the .grd file should be fetched from a different location. |
| + The argument is of the form <original-path>:<actual-path>. |
|
Lei Zhang
2016/06/29 22:51:32
nit: extra space, or s/ /: /
aberent
2016/07/14 15:41:36
Comment was wrong in other ways as well. Updated.
|
| + 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 +153,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 +198,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 +215,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: |