return true;
}
+ void EraseOatFile() {
+ DCHECK(oat_file_.get() != nullptr);
+ oat_file_->Erase();
+ oat_file_.reset();
+ }
+
// Set up the environment for compilation. Includes starting the runtime and loading/opening the
// boot class path.
bool Setup() {
if (!driver_->WriteElf(android_root_, is_host_, dex_files_, oat_writer.get(),
oat_file_.get())) {
LOG(ERROR) << "Failed to write ELF file " << oat_file_->GetPath();
- oat_file_->Erase();
return false;
}
}
// Create the boot.oat.
if (!dex2oat.CreateOatFile()) {
+ dex2oat.EraseOatFile();
return EXIT_FAILURE;
}
// Create the app oat.
if (!dex2oat.CreateOatFile()) {
+ dex2oat.EraseOatFile();
return EXIT_FAILURE;
}
LOG(INFO) << CommandLine();
if (!dex2oat.Setup()) {
+ dex2oat.EraseOatFile();
return EXIT_FAILURE;
}