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

Unified Diff: build/android/incremental_install/installer.py

Issue 1684583003: Add java-side support for _incremental instrumentation tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 4 years, 10 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/incremental_install/java/org/chromium/incrementalinstall/BootstrapApplication.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/incremental_install/installer.py
diff --git a/build/android/incremental_install/installer.py b/build/android/incremental_install/installer.py
index feebadbbbec7799fb2519555968960e5cf975bfe..b5b1d050e5510261198775f8e5fe52a2a743bff4 100755
--- a/build/android/incremental_install/installer.py
+++ b/build/android/incremental_install/installer.py
@@ -13,6 +13,7 @@ import os
import posixpath
import shutil
import sys
+import zipfile
sys.path.append(
os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)))
@@ -63,6 +64,12 @@ def _GetDeviceIncrementalDir(package):
return '/data/local/tmp/incremental-app-%s' % package
+def _HasClasses(jar_path):
+ """Returns whether the given jar contains classes.dex."""
+ with zipfile.ZipFile(jar_path) as jar:
+ return 'classes.dex' in jar.namelist()
+
+
def Uninstall(device, package, enable_device_cache=False):
"""Uninstalls and removes all incremental files for the given package."""
main_timer = time_profile.TimeProfile()
@@ -138,7 +145,10 @@ def Install(device, apk, split_globs=None, native_libs=None, dex_files=None,
# Ensure no two files have the same name.
transformed_names = _TransformDexPaths(dex_files)
for src_path, dest_name in zip(dex_files, transformed_names):
- shutil.copy(src_path, os.path.join(temp_dir, dest_name))
+ # Binary targets with no extra classes create .dex.jar without a
+ # classes.dex (which Android chokes on).
+ if _HasClasses(src_path):
+ shutil.copy(src_path, os.path.join(temp_dir, dest_name))
device.PushChangedFiles([(temp_dir, device_dex_dir)],
delete_device_stale=True)
push_dex_timer.Stop(log=False)
« no previous file with comments | « no previous file | build/android/incremental_install/java/org/chromium/incrementalinstall/BootstrapApplication.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698