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

Unified Diff: build/android/adb_install_apk.py

Issue 1200543002: [Android] Add support for installing split apks with adb_install_apk. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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/pylib/sdk/aapt.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 1e370f8fa8ea4c765a5bb003b94a666473c9d08b..07b7cfba297570b880500318299307091bcaf898 100755
--- a/build/android/adb_install_apk.py
+++ b/build/android/adb_install_apk.py
@@ -7,6 +7,7 @@
"""Utility script to install APKs from the command line quickly."""
import argparse
+import glob
import logging
import os
import sys
@@ -15,6 +16,7 @@ from pylib import constants
from pylib.device import device_blacklist
from pylib.device import device_errors
from pylib.device import device_utils
+from pylib.utils import apk_helper
from pylib.utils import run_tests_helper
@@ -30,6 +32,11 @@ def main():
# TODO(jbudorick): Remove once no clients pass --apk_package
parser.add_argument('--apk_package', help='DEPRECATED unused')
+ parser.add_argument('--split',
+ action='append',
+ dest='splits',
+ help='A glob matching the apk splits. '
+ 'Can be specified multiple times.')
parser.add_argument('--keep_data',
action='store_true',
default=False,
@@ -62,6 +69,24 @@ def main():
if not os.path.exists(apk):
parser.error('%s not found.' % apk)
+ if args.splits:
+ splits = []
+ base_apk_package = apk_helper.ApkHelper(apk).GetPackageName()
+ for split_pattern in args.splits:
+ if not split_pattern.endswith('.apk'):
jbudorick 2015/07/01 20:55:11 What's with this? Why are we modifying a user's gl
mikecase (-- gone --) 2015/07/01 22:14:57 Removed adding .apk to the end of the glob and ins
jbudorick 2015/07/01 22:18:56 This is going to sound somewhat get-off-my-lawn-is
+ split_pattern += '.apk'
+ apks = glob.glob(split_pattern)
+ if not apks:
+ apks = glob.glob(os.path.join(constants.GetOutDirectory(),
+ 'apks', split_pattern))
jbudorick 2015/07/01 20:55:11 nit: indentation is off. This implies that 'apks'
mikecase (-- gone --) 2015/07/01 22:14:57 Fixed.
+ if not apks:
+ logging.warning('No apks matched for %s.' % split_pattern)
+ for f in apks:
+ helper = apk_helper.ApkHelper(f)
+ if (helper.GetPackageName() == base_apk_package
+ and helper.GetSplitName() is not None):
jbudorick 2015/07/01 20:55:11 nit: and helper.GetSplitName() ?
mikecase (-- gone --) 2015/07/01 22:14:57 Done
+ splits.append(f)
+
devices = device_utils.DeviceUtils.HealthyDevices()
if args.device:
@@ -73,7 +98,10 @@ def main():
def blacklisting_install(device):
try:
- device.Install(apk, reinstall=args.keep_data)
+ if args.splits:
+ device.InstallSplitApk(apk, splits, reinstall=args.keep_data)
+ else:
+ device.Install(apk, reinstall=args.keep_data)
except device_errors.CommandFailedError:
logging.exception('Failed to install %s', args.apk)
device_blacklist.ExtendBlacklist([str(device)])
« no previous file with comments | « no previous file | build/android/pylib/sdk/aapt.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698