private boolean waitForPredexFile(Item item, File outFile, boolean multiDex) throws InterruptedException, IOException { // wait until the file is pre-dexed by the first thread. item.getLatch().await(); // check that the generated file actually exists if (item.areOutputFilesPresent()) { if (multiDex) { // output should be a folder for (File sourceFile : item.getOutputFiles()) { File destFile = new File(outFile, sourceFile.getName()); checkSame(sourceFile, destFile); Files.copy(sourceFile, destFile); } } else { // file already pre-dex, just copy the output. if (item.getOutputFiles().isEmpty()) { throw new RuntimeException(item.toString()); } checkSame(item.getOutputFiles().get(0), outFile); Files.copy(item.getOutputFiles().get(0), outFile); } incrementHits(); return true; } return false; }
item.getLatch().countDown();