FileUtils.delete(outputFile); break;
/** * Clears the cache. * * @throws IOException failed to clear the cache */ public void clear() throws IOException { File[] files = directory.listFiles(); if (files == null) { return; } for (File f : files) { if (f.isFile()) { FileUtils.delete(f); } } } }
break; case REMOVED: FileUtils.delete(outputJar); break;
/** * Removes any cached version of the given path. * * @param f the path * @throws IOException failed to remove the file */ public void remove(@NonNull File f) throws IOException { File toRemove = new File(directory, key(f)); if (toRemove.exists()) { FileUtils.delete(toRemove); } }
private static void deleteDirectoryContents(@NonNull File directory) throws IOException { if (!directory.exists()) { FileUtils.mkdirs(directory); } else if (!directory.isDirectory()) { FileUtils.delete(directory); FileUtils.mkdirs(directory); } else { FileUtils.deleteDirectoryContents(directory); } }
/** * Process the incremental file records individually with the passed {@link RecordHandler}. * @param incrementalFile a file containing change records. * @param handler the record handler. */ public static void process(@NonNull File incrementalFile, @NonNull RecordHandler handler) throws IOException, TransformException { if (!incrementalFile.isFile()) { return; } Map<String, Status> changeRecords = load(incrementalFile).records; // delete the incremental changes file to reset the list of changes FileUtils.delete(incrementalFile); if (changeRecords.isEmpty()) { return; } for (Map.Entry<String, Status> changeRecord : changeRecords.entrySet()) { handler.handle(changeRecord.getKey(), changeRecord.getValue()); } }
private static void instrumentFilesIncremental( @NonNull Instrumenter instrumenter, @NonNull File inputDir, @NonNull File outputDir, @NonNull Map<File, Status> changedFiles) throws IOException { for (Map.Entry<File, Status> changedInput : changedFiles.entrySet()) { File inputFile = changedInput.getKey(); if (!inputFile.getName().endsWith(SdkConstants.DOT_CLASS)) { continue; } File outputFile = new File(outputDir, FileUtils.relativePossiblyNonExistingPath(inputFile, inputDir)); switch (changedInput.getValue()) { case REMOVED: FileUtils.delete(outputFile); break; case ADDED: // fall through case CHANGED: instrumentFile(instrumenter, inputFile, outputFile); } } }
private static void deleteOutputFile( @NonNull IncrementalVisitor.VisitorBuilder visitorBuilder, @NonNull File inputDir, @NonNull File inputFile, @NonNull File outputDir) { String inputPath = FileUtils.relativePossiblyNonExistingPath(inputFile, inputDir); String outputPath = visitorBuilder.getMangledRelativeClassFilePath(inputPath); File outputFile = new File(outputDir, outputPath); if (outputFile.exists()) { try { FileUtils.delete(outputFile); } catch (IOException e) { // it's not a big deal if the file cannot be deleted, hopefully // no code is still referencing it, yet we should notify. LOGGER.warning("Cannot delete %1$s file.\nCause: %2$s", outputFile, Throwables.getStackTraceAsString(e)); } } }
FileUtils.delete(tmpBuildInfoFile);
FileUtils.delete(depFile);
inputMap = store.loadFrom(incrementalData); } catch (Exception ignored) { FileUtils.delete(incrementalData); getProject().getLogger().info( "Failed to read dependency store: full task run!"); executor.waitForTasksWithQuickFail(true /*cancelRemaining*/); } catch (Throwable t) { FileUtils.delete(incrementalData); throw new RuntimeException(t);
FileUtils.delete(classFile);
FileUtils.delete(classesJar);