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

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

Issue 2690263004: Add option to GRIT to provide a resource ordering input file. (Closed)
Patch Set: Reverse dict using 1-liner-ish. Created 3 years, 10 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/grd_reader.py ('k') | tools/grit/grit_rule.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/grit/grit/tool/build.py
diff --git a/tools/grit/grit/tool/build.py b/tools/grit/grit/tool/build.py
index a5703b20bb66df63aaef3008eab56319e4963731..cab2b37c67ec961261937e133ff3ab69db1b6abb 100755
--- a/tools/grit/grit/tool/build.py
+++ b/tools/grit/grit/tool/build.py
@@ -85,6 +85,17 @@ Options:
-o OUTPUTDIR Specify what directory output paths are relative to.
Defaults to the current directory.
+ -p FILE Specify a file containing a pre-determined mapping from
+ resource names to resource ids which will be used to assign
+ resource ids to those resources. Resources not found in this
+ file will be assigned ids normally. The motivation is to run
+ your app's startup and have it dump the resources it loads,
+ and then pass these via this flag. This will pack startup
+ resources together, thus reducing paging while all other
+ resources are unperturbed. The file should have the format:
+ RESOURCE_ONE_NAME 123
+ RESOURCE_TWO_NAME 124
+
-D NAME[=VAL] Specify a C-preprocessor-like define NAME with optional
value VAL (defaults to 1) which will be used to control
conditional inclusion of resources.
@@ -146,6 +157,7 @@ are exported to translation interchange files (e.g. XMB files), etc.
def Run(self, opts, args):
self.output_directory = '.'
first_ids_file = None
+ predetermined_ids_file = None
whitelist_filenames = []
assert_output_files = []
target_platform = None
@@ -157,7 +169,7 @@ are exported to translation interchange files (e.g. XMB files), etc.
depend_on_stamp = False
js_minifier = None
replace_ellipsis = True
- (own_opts, args) = getopt.getopt(args, 'a:o:D:E:f:w:t:h:',
+ (own_opts, args) = getopt.getopt(args, 'a:p:o:D:E:f:w:t:h:',
('depdir=','depfile=','assert-file-list=',
'output-all-resource-defines',
'no-output-all-resource-defines',
@@ -192,6 +204,8 @@ are exported to translation interchange files (e.g. XMB files), etc.
output_all_resource_defines = False
elif key == '--no-replace-ellipsis':
replace_ellipsis = False
+ elif key == '-p':
+ predetermined_ids_file = val
elif key == '-t':
target_platform = val
elif key == '-h':
@@ -233,6 +247,7 @@ are exported to translation interchange files (e.g. XMB files), etc.
self.res = grd_reader.Parse(opts.input,
debug=opts.extra_verbose,
first_ids_file=first_ids_file,
+ predetermined_ids_file=predetermined_ids_file,
defines=self.defines,
target_platform=target_platform)
« no previous file with comments | « tools/grit/grit/grd_reader.py ('k') | tools/grit/grit_rule.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698