Fix fallout from []: it broke "blaze mobile-install" when no --native_lib arguments were passed to the install script.
--
MOS_MIGRATED_REVID=99271033
diff --git a/src/tools/android/java/com/google/devtools/build/android/incrementaldeployment/StubApplication.java b/src/tools/android/java/com/google/devtools/build/android/incrementaldeployment/StubApplication.java
index 6ddcd1b..223da84 100644
--- a/src/tools/android/java/com/google/devtools/build/android/incrementaldeployment/StubApplication.java
+++ b/src/tools/android/java/com/google/devtools/build/android/incrementaldeployment/StubApplication.java
@@ -328,10 +328,11 @@
File newManifestFile = new File(nativeLibDir, "native_manifest");
File incrementalDir = new File("/data/data/" + packageName + "/incrementallib");
File installedManifestFile = new File(incrementalDir, "manifest");
+ String defaultNativeLibDir = "/data/data/" + packageName + "/lib";
if (!newManifestFile.exists()) {
// Native libraries are not installed incrementally. Just use the regular directory.
- return "/data/data/" + packageName + "/lib";
+ return defaultNativeLibDir;
}
Map<String, String> newManifest = parseManifest(newManifestFile);
@@ -339,6 +340,9 @@
Set<String> libsToDelete = new HashSet<String>();
Set<String> libsToUpdate = new HashSet<String>();
+ String realNativeLibDir = newManifest.isEmpty()
+ ? defaultNativeLibDir : incrementalDir.toString();
+
if (!incrementalDir.exists()) {
if (!incrementalDir.mkdirs()) {
throw new IOException("Could not mkdir " + incrementalDir);
@@ -370,7 +374,7 @@
if (libsToDelete.isEmpty() && libsToUpdate.isEmpty()) {
// Nothing to be done. Be lazy.
- return incrementalDir.toString();
+ return realNativeLibDir;
}
// Delete the installed manifest file. If anything below goes wrong, everything will be
@@ -398,7 +402,8 @@
// time we get here we can start with a clean slate.
installedManifestFile.delete();
}
- return incrementalDir.toString();
+
+ return realNativeLibDir;
}
private static Map<String, String> parseManifest(File file) throws IOException {