Ignore missing files in dex2oat
Bug: 11599365
Change-Id: I43f7437d2574c3776f921472f38b5a03a87c2822
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index c4cce2f..a8bd74c 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -409,22 +409,19 @@
return true;
}
-static size_t OpenDexFiles(const std::vector<const char*>& dex_filenames,
- const std::vector<const char*>& dex_locations,
- std::vector<const DexFile*>& dex_files) {
- size_t failure_count = 0;
+static void OpenDexFiles(const std::vector<const char*>& dex_filenames,
+ const std::vector<const char*>& dex_locations,
+ std::vector<const DexFile*>& dex_files) {
for (size_t i = 0; i < dex_filenames.size(); i++) {
const char* dex_filename = dex_filenames[i];
const char* dex_location = dex_locations[i];
const DexFile* dex_file = DexFile::Open(dex_filename, dex_location);
if (dex_file == NULL) {
LOG(WARNING) << "Failed to open .dex from file '" << dex_filename << "'\n";
- ++failure_count;
} else {
dex_files.push_back(dex_file);
}
}
- return failure_count;
}
// The primary goal of the watchdog is to prevent stuck build servers
@@ -846,11 +843,7 @@
options.push_back(std::make_pair("compiler", reinterpret_cast<void*>(NULL)));
std::vector<const DexFile*> boot_class_path;
if (boot_image_option.empty()) {
- size_t failure_count = OpenDexFiles(dex_filenames, dex_locations, boot_class_path);
- if (failure_count > 0) {
- LOG(ERROR) << "Failed to open some dex files: " << failure_count;
- return EXIT_FAILURE;
- }
+ OpenDexFiles(dex_filenames, dex_locations, boot_class_path);
options.push_back(std::make_pair("bootclasspath", &boot_class_path));
} else {
options.push_back(std::make_pair(boot_image_option.c_str(), reinterpret_cast<void*>(NULL)));
@@ -914,11 +907,7 @@
}
dex_files.push_back(dex_file);
} else {
- size_t failure_count = OpenDexFiles(dex_filenames, dex_locations, dex_files);
- if (failure_count > 0) {
- LOG(ERROR) << "Failed to open some dex files: " << failure_count;
- return EXIT_FAILURE;
- }
+ OpenDexFiles(dex_filenames, dex_locations, dex_files);
}
// Ensure opened dex files are writable for dex-to-dex transformations.