| 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 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 action='store_true', | 67 action='store_true', |
| 68 default=False, | 68 default=False, |
| 69 help='Remove the app and all side-loaded files.') | 69 help='Remove the app and all side-loaded files.') |
| 70 parser.add_argument('--output-directory', | 70 parser.add_argument('--output-directory', |
| 71 help='Path to the root build directory.') | 71 help='Path to the root build directory.') |
| 72 parser.add_argument('--no-threading', | 72 parser.add_argument('--no-threading', |
| 73 action='store_false', | 73 action='store_false', |
| 74 default=True, | 74 default=True, |
| 75 dest='threading', | 75 dest='threading', |
| 76 help='Do not install and push concurrently') | 76 help='Do not install and push concurrently') |
| 77 parser.add_argument('--no-cache', |
| 78 action='store_false', |
| 79 default=True, |
| 80 dest='cache', |
| 81 help='Do not use cached information about what files are ' |
| 82 'currently on the target device.') |
| 77 parser.add_argument('-v', | 83 parser.add_argument('-v', |
| 78 '--verbose', | 84 '--verbose', |
| 79 dest='verbose_count', | 85 dest='verbose_count', |
| 80 default=0, | 86 default=0, |
| 81 action='count', | 87 action='count', |
| 82 help='Verbose level (multiple times for more)') | 88 help='Verbose level (multiple times for more)') |
| 83 | 89 |
| 84 args = parser.parse_args() | 90 args = parser.parse_args() |
| 85 | 91 |
| 86 run_tests_helper.SetLogLevel(args.verbose_count) | 92 run_tests_helper.SetLogLevel(args.verbose_count) |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 if has_selinux and apk_help.HasIsolatedProcesses(): | 176 if has_selinux and apk_help.HasIsolatedProcesses(): |
| 171 raise Exception('Cannot use incremental installs on versions of Android ' | 177 raise Exception('Cannot use incremental installs on versions of Android ' |
| 172 'where isoloated processes cannot access the filesystem ' | 178 'where isoloated processes cannot access the filesystem ' |
| 173 '(this includes Android M+, and Samsung L+) without ' | 179 '(this includes Android M+, and Samsung L+) without ' |
| 174 'first disabling isoloated processes.\n' | 180 'first disabling isoloated processes.\n' |
| 175 'To do so, use GN arg:\n' | 181 'To do so, use GN arg:\n' |
| 176 ' disable_incremental_isolated_processes=true') | 182 ' disable_incremental_isolated_processes=true') |
| 177 | 183 |
| 178 cache_path = '%s/files-cache.json' % device_incremental_dir | 184 cache_path = '%s/files-cache.json' % device_incremental_dir |
| 179 def restore_cache(): | 185 def restore_cache(): |
| 186 if not args.cache: |
| 187 logging.info('Ignoring device cache') |
| 188 return |
| 180 # Delete the cached file so that any exceptions cause the next attempt | 189 # Delete the cached file so that any exceptions cause the next attempt |
| 181 # to re-compute md5s. | 190 # to re-compute md5s. |
| 182 cmd = 'P=%s;cat $P 2>/dev/null && rm $P' % cache_path | 191 cmd = 'P=%s;cat $P 2>/dev/null && rm $P' % cache_path |
| 183 lines = device.RunShellCommand(cmd, check_return=False, large_output=True) | 192 lines = device.RunShellCommand(cmd, check_return=False, large_output=True) |
| 184 if lines: | 193 if lines: |
| 185 device.LoadCacheData(lines[0]) | 194 device.LoadCacheData(lines[0]) |
| 186 else: | 195 else: |
| 187 logging.info('Device cache not found: %s', cache_path) | 196 logging.info('Device cache not found: %s', cache_path) |
| 188 | 197 |
| 189 def save_cache(): | 198 def save_cache(): |
| (...skipping 29 matching lines...) Expand all Loading... |
| 219 logging.info( | 228 logging.info( |
| 220 'Took %s seconds (setup=%s, install=%s, libs=%s, dex=%s, finalize=%s)', | 229 'Took %s seconds (setup=%s, install=%s, libs=%s, dex=%s, finalize=%s)', |
| 221 main_timer.GetDelta(), setup_timer.GetDelta(), install_timer.GetDelta(), | 230 main_timer.GetDelta(), setup_timer.GetDelta(), install_timer.GetDelta(), |
| 222 push_native_timer.GetDelta(), push_dex_timer.GetDelta(), | 231 push_native_timer.GetDelta(), push_dex_timer.GetDelta(), |
| 223 finalize_timer.GetDelta()) | 232 finalize_timer.GetDelta()) |
| 224 | 233 |
| 225 | 234 |
| 226 if __name__ == '__main__': | 235 if __name__ == '__main__': |
| 227 sys.exit(main()) | 236 sys.exit(main()) |
| 228 | 237 |
| OLD | NEW |