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

Unified Diff: build/android/incremental_install/java/org/chromium/incrementalinstall/ClassLoaderPatcher.java

Issue 1684583003: Add java-side support for _incremental instrumentation tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add installer.py change 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
Index: build/android/incremental_install/java/org/chromium/incrementalinstall/ClassLoaderPatcher.java
diff --git a/build/android/incremental_install/java/org/chromium/incrementalinstall/ClassLoaderPatcher.java b/build/android/incremental_install/java/org/chromium/incrementalinstall/ClassLoaderPatcher.java
index c1682e81e049ebda1ab784f4b628f5c96a803b75..cd79259632a92c8d1aa447cec4da8dd85ef63e54 100644
--- a/build/android/incremental_install/java/org/chromium/incrementalinstall/ClassLoaderPatcher.java
+++ b/build/android/incremental_install/java/org/chromium/incrementalinstall/ClassLoaderPatcher.java
@@ -103,6 +103,10 @@ final class ClassLoaderPatcher {
*/
void importNativeLibs(File libDir) throws ReflectiveOperationException, IOException {
Log.i(TAG, "Importing native libraries from: " + libDir);
+ if (!libDir.exists()) {
+ Log.i(TAG, "No native libs exist.");
+ return;
+ }
// The library copying is not necessary on older devices, but we do it anyways to
// simplify things (it's fast compared to dexing).
// https://code.google.com/p/android/issues/detail?id=79480
@@ -169,14 +173,20 @@ final class ClassLoaderPatcher {
private static void copyChangedFiles(File srcDir, File dstDir) throws IOException {
// No need to delete stale libs since libraries are loaded explicitly.
+ int numNotChanged = 0;
for (File f : srcDir.listFiles()) {
// Note: Tried using hardlinks, but resulted in EACCES exceptions.
File dest = new File(dstDir, f.getName());
- copyIfModified(f, dest);
+ if (!copyIfModified(f, dest)) {
+ numNotChanged++;
+ }
+ }
+ if (numNotChanged > 0) {
+ Log.i(TAG, numNotChanged + " libs already up-to-date.");
}
}
- private static void copyIfModified(File src, File dest) throws IOException {
+ private static boolean copyIfModified(File src, File dest) throws IOException {
nyquist 2016/02/10 07:08:32 Optional nit: Add a super-tiny comment as to what
agrieve 2016/02/10 16:47:15 Electing not to since it's private and is clear fr
long lastModified = src.lastModified();
if (!dest.exists() || dest.lastModified() != lastModified) {
nyquist 2016/02/10 07:08:32 Optional nit: Would it be easier to read with some
agrieve 2016/02/10 16:47:15 Done.
Log.i(TAG, "Copying " + src + " -> " + dest);
@@ -188,9 +198,9 @@ final class ClassLoaderPatcher {
dest.setReadable(true, false);
dest.setExecutable(true, false);
dest.setLastModified(lastModified);
- } else {
- Log.i(TAG, "Up-to-date: " + dest);
+ return true;
}
+ return false;
}
private void ensureAppFilesSubDirExists() {

Powered by Google App Engine
This is Rietveld 408576698