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

Side by Side Diff: build/android/incremental_install.py

Issue 1326813003: Tweak logging in incremental_install.py to know when each part is done (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@device-more-caching
Patch Set: rebased Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 sys 14 import sys
15 import time 15 import time
16 16
17 from devil.android import apk_helper 17 from devil.android import apk_helper
18 from devil.android import device_utils 18 from devil.android import device_utils
19 from devil.android import device_errors 19 from devil.android import device_errors
20 from devil.utils import reraiser_thread 20 from devil.utils import reraiser_thread
21 from pylib import constants 21 from pylib import constants
22 from pylib.utils import run_tests_helper
22 23
23 24
24 def main(): 25 def main():
25 start_time = time.time() 26 start_time = time.time()
26 logging.basicConfig(level=logging.INFO,
27 format='%(asctime)s (%(thread)d) %(message)s')
28
29 parser = argparse.ArgumentParser() 27 parser = argparse.ArgumentParser()
30 parser.add_argument('apk_path', 28 parser.add_argument('apk_path',
31 help='The path to the APK to install.') 29 help='The path to the APK to install.')
32 parser.add_argument('--split', 30 parser.add_argument('--split',
33 action='append', 31 action='append',
34 dest='splits', 32 dest='splits',
35 help='A glob matching the apk splits. ' 33 help='A glob matching the apk splits. '
36 'Can be specified multiple times.') 34 'Can be specified multiple times.')
37 parser.add_argument('--lib-dir', 35 parser.add_argument('--lib-dir',
38 help='Path to native libraries directory.') 36 help='Path to native libraries directory.')
39 parser.add_argument('-d', '--device', dest='device', 37 parser.add_argument('-d', '--device', dest='device',
40 help='Target device for apk to install on.') 38 help='Target device for apk to install on.')
41 parser.add_argument('--uninstall', 39 parser.add_argument('--uninstall',
42 action='store_true', 40 action='store_true',
43 default=False, 41 default=False,
44 help='Remove the app and all side-loaded files.') 42 help='Remove the app and all side-loaded files.')
45 parser.add_argument('--no-threading', 43 parser.add_argument('--no-threading',
46 action='store_true', 44 action='store_true',
47 default=False, 45 default=False,
48 help='Do not install and push concurrently') 46 help='Do not install and push concurrently')
47 parser.add_argument('-v',
48 '--verbose',
49 dest='verbose_count',
50 default=0,
51 action='count',
52 help='Verbose level (multiple times for more)')
49 53
50 args = parser.parse_args() 54 args = parser.parse_args()
51 55
56 logging.basicConfig(format='%(asctime)s (%(thread)d) %(message)s')
57 run_tests_helper.SetLogLevel(args.verbose_count)
52 constants.SetBuildType('Debug') 58 constants.SetBuildType('Debug')
53 59
54 if args.device: 60 if args.device:
55 # Retries are annoying when commands fail for legitimate reasons. Might want 61 # Retries are annoying when commands fail for legitimate reasons. Might want
56 # to enable them if this is ever used on bots though. 62 # to enable them if this is ever used on bots though.
57 device = device_utils.DeviceUtils(args.device, default_retries=0) 63 device = device_utils.DeviceUtils(args.device, default_retries=0)
58 else: 64 else:
59 devices = device_utils.DeviceUtils.HealthyDevices(default_retries=0) 65 devices = device_utils.DeviceUtils.HealthyDevices(default_retries=0)
60 if not devices: 66 if not devices:
61 raise device_errors.NoDevicesError() 67 raise device_errors.NoDevicesError()
(...skipping 23 matching lines...) Expand all
85 # Install .apk(s) if any of them have changed. 91 # Install .apk(s) if any of them have changed.
86 def do_install(): 92 def do_install():
87 if args.splits: 93 if args.splits:
88 splits = [] 94 splits = []
89 for split_glob in args.splits: 95 for split_glob in args.splits:
90 splits.extend((f for f in glob.glob(split_glob))) 96 splits.extend((f for f in glob.glob(split_glob)))
91 device.InstallSplitApk(args.apk_path, splits, reinstall=True, 97 device.InstallSplitApk(args.apk_path, splits, reinstall=True,
92 allow_cached_props=True) 98 allow_cached_props=True)
93 else: 99 else:
94 device.Install(args.apk_path, reinstall=True) 100 device.Install(args.apk_path, reinstall=True)
101 logging.info('Finished installing .apk')
95 102
96 # Push .so files to the device (if they have changed). 103 # Push .so files to the device (if they have changed).
97 def do_push_libs(): 104 def do_push_libs():
98 if args.lib_dir: 105 if args.lib_dir:
99 device_lib_dir = posixpath.join(device_incremental_dir, 'lib') 106 device_lib_dir = posixpath.join(device_incremental_dir, 'lib')
100 device.PushChangedFiles([(args.lib_dir, device_lib_dir)], 107 device.PushChangedFiles([(args.lib_dir, device_lib_dir)],
101 delete_device_stale=True) 108 delete_device_stale=True)
109 logging.info('Finished pushing native libs')
110
102 # Concurrency here speeds things up quite a bit, but DeviceUtils hasn't 111 # Concurrency here speeds things up quite a bit, but DeviceUtils hasn't
103 # been designed for multi-threading. Enabling only because this is a 112 # been designed for multi-threading. Enabling only because this is a
104 # developer-only tool. 113 # developer-only tool.
105 if args.no_threading: 114 if args.no_threading:
106 do_install() 115 do_install()
107 do_push_libs() 116 do_push_libs()
108 else: 117 else:
109 reraiser_thread.RunAsync((do_install, do_push_libs)) 118 reraiser_thread.RunAsync((do_install, do_push_libs))
110 logging.info('Took %s seconds' % round(time.time() - start_time, 1)) 119 logging.info('Took %s seconds' % round(time.time() - start_time, 1))
111 120
112 121
113 if __name__ == '__main__': 122 if __name__ == '__main__':
114 sys.exit(main()) 123 sys.exit(main())
115 124
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698