Revert "Ignore missing files in dex2oat"
This reverts commit eb4d2ae2efdd186a01f3c91a3f6d44cc07e116ef.
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index a8bd74c..c4cce2f 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -409,19 +409,22 @@
return true;
}
-static void OpenDexFiles(const std::vector<const char*>& dex_filenames,
- const std::vector<const char*>& dex_locations,
- std::vector<const DexFile*>& dex_files) {
+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;
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
@@ -843,7 +846,11 @@
options.push_back(std::make_pair("compiler", reinterpret_cast<void*>(NULL)));
std::vector<const DexFile*> boot_class_path;
if (boot_image_option.empty()) {
- OpenDexFiles(dex_filenames, dex_locations, boot_class_path);
+ 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;
+ }
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)));
@@ -907,7 +914,11 @@
}
dex_files.push_back(dex_file);
} else {
- OpenDexFiles(dex_filenames, dex_locations, dex_files);
+ 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;
+ }
}
// Ensure opened dex files are writable for dex-to-dex transformations.