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

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

Issue 1577383002: [Android] Make the adb path configurable in three scripts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | build/android/buildbot/bb_device_status_check.py » ('j') | 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 (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 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 """Utility script to install APKs from the command line quickly.""" 7 """Utility script to install APKs from the command line quickly."""
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 sys 13 import sys
14 14
15 import devil_chromium 15 import devil_chromium
16 16 from devil import devil_env
17 from devil.android import apk_helper 17 from devil.android import apk_helper
18 from devil.android import device_blacklist 18 from devil.android import device_blacklist
19 from devil.android import device_errors 19 from devil.android import device_errors
20 from devil.android import device_utils 20 from devil.android import device_utils
21 from devil.utils import run_tests_helper 21 from devil.utils import run_tests_helper
22 from pylib import constants 22 from pylib import constants
23 23
24 24
25 def main(): 25 def main():
26 parser = argparse.ArgumentParser() 26 parser = argparse.ArgumentParser()
(...skipping 22 matching lines...) Expand all
49 default=os.environ.get('BUILDTYPE', 'Debug'), 49 default=os.environ.get('BUILDTYPE', 'Debug'),
50 help='If set, run test suites under out/Debug. ' 50 help='If set, run test suites under out/Debug. '
51 'Default is env var BUILDTYPE or Debug') 51 'Default is env var BUILDTYPE or Debug')
52 parser.add_argument('--release', action='store_const', const='Release', 52 parser.add_argument('--release', action='store_const', const='Release',
53 dest='build_type', 53 dest='build_type',
54 help='If set, run test suites under out/Release. ' 54 help='If set, run test suites under out/Release. '
55 'Default is env var BUILDTYPE or Debug.') 55 'Default is env var BUILDTYPE or Debug.')
56 parser.add_argument('-d', '--device', dest='devices', action='append', 56 parser.add_argument('-d', '--device', dest='devices', action='append',
57 help='Target device for apk to install on. Enter multiple' 57 help='Target device for apk to install on. Enter multiple'
58 ' times for multiple devices.') 58 ' times for multiple devices.')
59 parser.add_argument('--adb-path',
60 help='Absolute path to the adb binary to use.')
59 parser.add_argument('--blacklist-file', help='Device blacklist JSON file.') 61 parser.add_argument('--blacklist-file', help='Device blacklist JSON file.')
60 parser.add_argument('-v', '--verbose', action='count', 62 parser.add_argument('-v', '--verbose', action='count',
61 help='Enable verbose logging.') 63 help='Enable verbose logging.')
62 parser.add_argument('--downgrade', action='store_true', 64 parser.add_argument('--downgrade', action='store_true',
63 help='If set, allows downgrading of apk.') 65 help='If set, allows downgrading of apk.')
64 66
65 args = parser.parse_args() 67 args = parser.parse_args()
66 68
67 run_tests_helper.SetLogLevel(args.verbose) 69 run_tests_helper.SetLogLevel(args.verbose)
68 constants.SetBuildType(args.build_type) 70 constants.SetBuildType(args.build_type)
69 71
70 devil_chromium.Initialize(output_directory=constants.GetOutDirectory()) 72 devil_custom_deps = None
73 if args.adb_path:
74 devil_custom_deps = {
75 'adb': {
76 devil_env.GetPlatform(): [args.adb_path],
77 },
78 }
79
80 devil_chromium.Initialize(
81 output_directory=constants.GetOutDirectory(),
82 custom_deps=devil_custom_deps)
71 83
72 apk = args.apk_path or args.apk_name 84 apk = args.apk_path or args.apk_name
73 if not apk.endswith('.apk'): 85 if not apk.endswith('.apk'):
74 apk += '.apk' 86 apk += '.apk'
75 if not os.path.exists(apk): 87 if not os.path.exists(apk):
76 apk = os.path.join(constants.GetOutDirectory(), 'apks', apk) 88 apk = os.path.join(constants.GetOutDirectory(), 'apks', apk)
77 if not os.path.exists(apk): 89 if not os.path.exists(apk):
78 parser.error('%s not found.' % apk) 90 parser.error('%s not found.' % apk)
79 91
80 if args.splits: 92 if args.splits:
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 if blacklist: 132 if blacklist:
121 blacklist.Extend([str(device)], reason='install_timeout') 133 blacklist.Extend([str(device)], reason='install_timeout')
122 logging.warning('Blacklisting %s', str(device)) 134 logging.warning('Blacklisting %s', str(device))
123 135
124 device_utils.DeviceUtils.parallel(devices).pMap(blacklisting_install) 136 device_utils.DeviceUtils.parallel(devices).pMap(blacklisting_install)
125 137
126 138
127 if __name__ == '__main__': 139 if __name__ == '__main__':
128 sys.exit(main()) 140 sys.exit(main())
129 141
OLDNEW
« no previous file with comments | « no previous file | build/android/buildbot/bb_device_status_check.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698