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

Unified Diff: build/android/adb_install_apk.py

Issue 286423002: Make adb_install_apk.py saner for humans. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@android_build_cleanup
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/android/buildbot/bb_device_steps.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/adb_install_apk.py
diff --git a/build/android/adb_install_apk.py b/build/android/adb_install_apk.py
index 5493439fea16705f7b8165b34c1be45b94ee9e2a..492fdb00e811ab24baf5efe2aabb326ac30c6378 100755
--- a/build/android/adb_install_apk.py
+++ b/build/android/adb_install_apk.py
@@ -20,7 +20,7 @@ from pylib.utils import apk_helper
def AddInstallAPKOption(option_parser):
"""Adds apk option used to install the APK to the OptionParser."""
option_parser.add_option('--apk',
- help=('The name of the apk containing the '
+ help=('DEPRECATED The name of the apk containing the'
' application (with the .apk extension).'))
option_parser.add_option('--apk_package',
help=('The package name used by the apk containing '
@@ -41,10 +41,18 @@ def AddInstallAPKOption(option_parser):
'Default is env var BUILDTYPE or Debug.')
-def ValidateInstallAPKOption(option_parser, options):
+def ValidateInstallAPKOption(option_parser, options, args):
"""Validates the apk option and potentially qualifies the path."""
if not options.apk:
- option_parser.error('--apk is mandatory.')
+ if len(args) > 1:
+ options.apk = args[1]
+ else:
+ option_parser.error('apk target not specified.')
+ return
jbudorick 2014/05/19 15:13:42 nit: OptionParser.error exits, so the return is un
mlamouri (slow - plz ping) 2014/05/20 13:09:05 Oups, forgot about that one. Fixed.
+
+ if not options.apk.endswith('.apk'):
+ options.apk += '.apk'
+
if not os.path.exists(options.apk):
options.apk = os.path.join(constants.GetOutDirectory(), 'apks',
options.apk)
@@ -59,12 +67,17 @@ def _InstallApk(args):
def main(argv):
parser = optparse.OptionParser()
+ parser.set_usage("usage: %prog [options] target")
AddInstallAPKOption(parser)
options, args = parser.parse_args(argv)
+
+ if len(args) > 1 and options.apk:
+ parser.error("Appending the apk as argument can't be used with --apk.")
+ elif len(args) > 2:
+ parser.error("Too many arguments.")
+
constants.SetBuildType(options.build_type)
- ValidateInstallAPKOption(parser, options)
- if len(args) > 1:
- raise Exception('Error: Unknown argument:', args[1:])
+ ValidateInstallAPKOption(parser, options, args)
devices = android_commands.GetAttachedDevices()
if not devices:
« no previous file with comments | « no previous file | build/android/buildbot/bb_device_steps.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698