OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Prints the size of each given file and optionally computes the size of | 6 """Prints the size of each given file and optionally computes the size of |
7 libchrome.so without the dependencies added for building with android NDK. | 7 libchrome.so without the dependencies added for building with android NDK. |
8 Also breaks down the contents of the APK to determine the installed size | 8 Also breaks down the contents of the APK to determine the installed size |
9 and assign size contributions to different classes of file. | 9 and assign size contributions to different classes of file. |
10 """ | 10 """ |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 _AAPT_PATH = lazy.WeakConstant(lambda: build_tools.GetPath('aapt')) | 35 _AAPT_PATH = lazy.WeakConstant(lambda: build_tools.GetPath('aapt')) |
36 _GRIT_PATH = os.path.join(host_paths.DIR_SOURCE_ROOT, 'tools', 'grit') | 36 _GRIT_PATH = os.path.join(host_paths.DIR_SOURCE_ROOT, 'tools', 'grit') |
37 _BUILD_UTILS_PATH = os.path.join( | 37 _BUILD_UTILS_PATH = os.path.join( |
38 host_paths.DIR_SOURCE_ROOT, 'build', 'android', 'gyp') | 38 host_paths.DIR_SOURCE_ROOT, 'build', 'android', 'gyp') |
39 _APK_PATCH_SIZE_ESTIMATOR_PATH = os.path.join( | 39 _APK_PATCH_SIZE_ESTIMATOR_PATH = os.path.join( |
40 host_paths.DIR_SOURCE_ROOT, 'third_party', 'apk-patch-size-estimator') | 40 host_paths.DIR_SOURCE_ROOT, 'third_party', 'apk-patch-size-estimator') |
41 | 41 |
42 # Prepend the grit module from the source tree so it takes precedence over other | 42 # Prepend the grit module from the source tree so it takes precedence over other |
43 # grit versions that might present in the search path. | 43 # grit versions that might present in the search path. |
44 with host_paths.SysPath(_GRIT_PATH, 1): | 44 with host_paths.SysPath(_GRIT_PATH, 0): |
45 from grit.format import data_pack # pylint: disable=import-error | 45 from grit.format import data_pack # pylint: disable=import-error |
46 | 46 |
47 with host_paths.SysPath(host_paths.BUILD_COMMON_PATH): | 47 with host_paths.SysPath(host_paths.BUILD_COMMON_PATH): |
48 import perf_tests_results_helper # pylint: disable=import-error | 48 import perf_tests_results_helper # pylint: disable=import-error |
49 | 49 |
50 with host_paths.SysPath(_BUILD_UTILS_PATH, 1): | 50 with host_paths.SysPath(_BUILD_UTILS_PATH, 0): |
51 from util import build_utils # pylint: disable=import-error | 51 from util import build_utils # pylint: disable=import-error |
52 | 52 |
53 with host_paths.SysPath(_APK_PATCH_SIZE_ESTIMATOR_PATH): | 53 with host_paths.SysPath(_APK_PATCH_SIZE_ESTIMATOR_PATH): |
54 import apk_patch_size_estimator # pylint: disable=import-error | 54 import apk_patch_size_estimator # pylint: disable=import-error |
55 | 55 |
56 | 56 |
57 # Python had a bug in zipinfo parsing that triggers on ChromeModern.apk | 57 # Python had a bug in zipinfo parsing that triggers on ChromeModern.apk |
58 # https://bugs.python.org/issue14315 | 58 # https://bugs.python.org/issue14315 |
59 def _PatchedDecodeExtra(self): | 59 def _PatchedDecodeExtra(self): |
60 # Try to decode the extra field. | 60 # Try to decode the extra field. |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 args.apk, tools_prefix, chartjson=chartjson) | 782 args.apk, tools_prefix, chartjson=chartjson) |
783 if chartjson: | 783 if chartjson: |
784 results_path = os.path.join(args.output_dir, 'results-chart.json') | 784 results_path = os.path.join(args.output_dir, 'results-chart.json') |
785 logging.critical('Dumping json to %s', results_path) | 785 logging.critical('Dumping json to %s', results_path) |
786 with open(results_path, 'w') as json_file: | 786 with open(results_path, 'w') as json_file: |
787 json.dump(chartjson, json_file) | 787 json.dump(chartjson, json_file) |
788 | 788 |
789 | 789 |
790 if __name__ == '__main__': | 790 if __name__ == '__main__': |
791 sys.exit(main()) | 791 sys.exit(main()) |
OLD | NEW |