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

Unified Diff: tools/binary_size/libsupersize/archive.py

Issue 2813963002: //tools/binary_size: Consolidate most tools into "supersize" command (Closed)
Patch Set: Fix readme formatting. Make archive's --outoput-file a positional arg Created 3 years, 8 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/binary_size/integration_test.py ('k') | tools/binary_size/libsupersize/console.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/binary_size/libsupersize/archive.py
diff --git a/tools/binary_size/map2size.py b/tools/binary_size/libsupersize/archive.py
old mode 100755
new mode 100644
similarity index 96%
rename from tools/binary_size/map2size.py
rename to tools/binary_size/libsupersize/archive.py
index 95310c3199fdc03141f023eeb5b640873a0a54cc..7524094731b9b2acea8cc0ba1068f95584c84933
--- a/tools/binary_size/map2size.py
+++ b/tools/binary_size/libsupersize/archive.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
# Copyright 2017 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.
@@ -400,24 +399,27 @@ def _ParseGnArgs(args_path):
return ["%s=%s" % x for x in sorted(args.iteritems())]
-def main(argv):
- parser = argparse.ArgumentParser(argv)
+def AddArguments(parser):
+ parser.add_argument('size_file', help='Path to output .size file.')
parser.add_argument('--elf-file', required=True,
help='Path to input ELF file. Currently used for '
- 'capturing metadata. Pass "" to skip metadata '
- 'collection.')
+ 'capturing metadata. Pass "" to skip '
+ 'metadata collection.')
parser.add_argument('--map-file',
help='Path to input .map(.gz) file. Defaults to '
'{{elf_file}}.map(.gz)?')
- parser.add_argument('--output-file', required=True,
- help='Path to output .size file.')
parser.add_argument('--no-source-paths', action='store_true',
help='Do not use .ninja files to map '
'object_path -> source_path')
- paths.AddOptions(parser)
- args = helpers.AddCommonOptionsAndParseArgs(parser, argv)
- if not args.output_file.endswith('.size'):
- parser.error('output_file must end with .size')
+ parser.add_argument('--tool-prefix', default='',
+ help='Path prefix for c++filt.')
+ parser.add_argument('--output-directory',
+ help='Path to the root build directory.')
+
+
+def Run(args, parser):
+ if not args.size_file.endswith('.size'):
+ parser.error('size_file must end with .size')
if args.map_file:
if (not args.map_file.endswith('.map')
@@ -469,10 +471,6 @@ def main(argv):
logging.info('Recording metadata: \n %s',
'\n '.join(describe.DescribeMetadata(size_info.metadata)))
- logging.info('Saving result to %s', args.output_file)
- file_format.SaveSizeInfo(size_info, args.output_file)
+ logging.info('Saving result to %s', args.size_file)
+ file_format.SaveSizeInfo(size_info, args.size_file)
logging.info('Done')
-
-
-if __name__ == '__main__':
- sys.exit(main(sys.argv))
« no previous file with comments | « tools/binary_size/integration_test.py ('k') | tools/binary_size/libsupersize/console.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698