OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2015 The Chromium Authors. All rights reserved. | 3 # Copyright 2015 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """Install *_incremental.apk targets as well as their dependent files.""" | 7 """Install *_incremental.apk targets as well as their dependent files.""" |
8 | 8 |
9 import argparse | 9 import argparse |
10 import glob | 10 import glob |
11 import logging | 11 import logging |
12 import os | 12 import os |
13 import posixpath | 13 import posixpath |
14 import shutil | 14 import shutil |
15 import sys | 15 import sys |
16 | 16 |
17 sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir)) | 17 sys.path.append( |
| 18 os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, 'gyp'))) |
| 19 from util import build_utils |
| 20 |
| 21 sys.path.append( |
| 22 os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))) |
| 23 import devil_chromium |
18 from devil.android import apk_helper | 24 from devil.android import apk_helper |
19 from devil.android import device_utils | 25 from devil.android import device_utils |
20 from devil.android import device_errors | 26 from devil.android import device_errors |
21 from devil.android.sdk import version_codes | 27 from devil.android.sdk import version_codes |
22 from devil.utils import reraiser_thread | 28 from devil.utils import reraiser_thread |
23 from pylib import constants | 29 from pylib import constants |
24 from pylib.utils import run_tests_helper | 30 from pylib.utils import run_tests_helper |
25 from pylib.utils import time_profile | 31 from pylib.utils import time_profile |
26 | 32 |
27 sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, 'gyp')) | |
28 from util import build_utils | |
29 | |
30 | 33 |
31 def _TransformDexPaths(paths): | 34 def _TransformDexPaths(paths): |
32 """Given paths like ["/a/b/c", "/a/c/d"], returns ["b.c", "c.d"].""" | 35 """Given paths like ["/a/b/c", "/a/c/d"], returns ["b.c", "c.d"].""" |
33 prefix_len = len(os.path.commonprefix(paths)) | 36 prefix_len = len(os.path.commonprefix(paths)) |
34 return [p[prefix_len:].replace(os.sep, '.') for p in paths] | 37 return [p[prefix_len:].replace(os.sep, '.') for p in paths] |
35 | 38 |
36 | 39 |
37 def _Execute(concurrently, *funcs): | 40 def _Execute(concurrently, *funcs): |
38 """Calls all functions in |funcs| concurrently or in sequence.""" | 41 """Calls all functions in |funcs| concurrently or in sequence.""" |
39 timer = time_profile.TimeProfile() | 42 timer = time_profile.TimeProfile() |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 action='count', | 90 action='count', |
88 help='Verbose level (multiple times for more)') | 91 help='Verbose level (multiple times for more)') |
89 | 92 |
90 args = parser.parse_args() | 93 args = parser.parse_args() |
91 | 94 |
92 run_tests_helper.SetLogLevel(args.verbose_count) | 95 run_tests_helper.SetLogLevel(args.verbose_count) |
93 constants.SetBuildType('Debug') | 96 constants.SetBuildType('Debug') |
94 if args.output_directory: | 97 if args.output_directory: |
95 constants.SetOutputDirectory(args.output_directory) | 98 constants.SetOutputDirectory(args.output_directory) |
96 | 99 |
| 100 devil_chromium.Initialize() |
| 101 |
97 main_timer = time_profile.TimeProfile() | 102 main_timer = time_profile.TimeProfile() |
98 install_timer = time_profile.TimeProfile() | 103 install_timer = time_profile.TimeProfile() |
99 push_native_timer = time_profile.TimeProfile() | 104 push_native_timer = time_profile.TimeProfile() |
100 push_dex_timer = time_profile.TimeProfile() | 105 push_dex_timer = time_profile.TimeProfile() |
101 | 106 |
102 if args.device: | 107 if args.device: |
103 # Retries are annoying when commands fail for legitimate reasons. Might want | 108 # Retries are annoying when commands fail for legitimate reasons. Might want |
104 # to enable them if this is ever used on bots though. | 109 # to enable them if this is ever used on bots though. |
105 device = device_utils.DeviceUtils( | 110 device = device_utils.DeviceUtils( |
106 args.device, default_retries=0, enable_device_files_cache=True) | 111 args.device, default_retries=0, enable_device_files_cache=True) |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 logging.info( | 233 logging.info( |
229 'Took %s seconds (setup=%s, install=%s, libs=%s, dex=%s, finalize=%s)', | 234 'Took %s seconds (setup=%s, install=%s, libs=%s, dex=%s, finalize=%s)', |
230 main_timer.GetDelta(), setup_timer.GetDelta(), install_timer.GetDelta(), | 235 main_timer.GetDelta(), setup_timer.GetDelta(), install_timer.GetDelta(), |
231 push_native_timer.GetDelta(), push_dex_timer.GetDelta(), | 236 push_native_timer.GetDelta(), push_dex_timer.GetDelta(), |
232 finalize_timer.GetDelta()) | 237 finalize_timer.GetDelta()) |
233 | 238 |
234 | 239 |
235 if __name__ == '__main__': | 240 if __name__ == '__main__': |
236 sys.exit(main()) | 241 sys.exit(main()) |
237 | 242 |
OLD | NEW |