@Override public void visitFile(FileVisitDetails fileDetails) { fileTreeElements.add(new RegularFileSnapshot(getPath(fileDetails.getFile()), fileDetails.getRelativePath(), false, fileSnapshot(fileDetails))); } }
@Override public void visitFile(FileVisitDetails details) { ByteArrayOutputStream stream = new ByteArrayOutputStream(); details.copyTo(stream); // BAOS dont need to be clsoed. byte[] array = stream.toByteArray(); String path = details.getRelativePath().getPathString().replace('\\', '/'); if (details.getName().endsWith(".java")) { sourceMap.put(path, new String(array, Constants.CHARSET)); } else { resourceMap.put(path, array); } }
@Override public void visitFile(FileVisitDetails arg0) { arg0.copyTo(arg0.getRelativePath().getFile(compiled)); }
@Override public void visitDir(FileVisitDetails dir) { directories.add(dir.getFile()); }
@Override public void visitFile(FileVisitDetails fileVisitDetails) { String name = fileVisitDetails.getName(); if (name.startsWith("_")) return; File in = fileVisitDetails.getFile(); String pathString = fileVisitDetails.getRelativePath().getPathString(); fileVisitDetails.getFile().getParentFile(), name.substring(0, name.length() - 5) + ".css" );
public Provider<List<String>> defaultModulesProvider() { return project.provider (() -> { final List<String> modules = new ArrayList<>(); if (sourceDirectories != null) { sourceDirectories.getAsFileTree().visit (file -> { if (!file.isDirectory()) { String moduleWithExtension = file.getPath().replace('/', '.'); String module = moduleWithExtension .substring(0, moduleWithExtension.lastIndexOf(".")); if (module.equals("Main")) { executable.set(file.getFile().getAbsolutePath()); } else { modules.add(module); } }}); } return modules; }); }
public RelativePath getRelativeSourcePath() { return this.fileDetails.getRelativePath(); }
@Override public void visitFile(FileVisitDetails file) { try { String name = file.getRelativePath().toString().replace('\\', '/'); if (!entries.contains(name)) { ZipEntry n = new ZipEntry(name); n.setTime(file.getLastModified()); out.putNextEntry(n); ByteStreams.copy(file.open(), out); entries.add(name); } } catch (IOException e) { throw new RuntimeException(e); } }
@Override @SuppressWarnings("unchecked") public void visitFile(FileVisitDetails details) { try { if (spec.isSatisfiedBy(details)) { ZipEntry entry = new ZipEntry(details.getPath()); entry.setTime(details.getLastModified()); outs.putNextEntry(entry); details.copyTo(outs); outs.closeEntry(); } else { try (InputStream stream = details.open()) { unsigned.put(details.getPath(), new MapEntry(ByteStreams.toByteArray(stream), details.getLastModified())); } } } catch (IOException e) { e.printStackTrace(); } }
@Override public void visitFile(FileVisitDetails details) { JarEntry entry = new JarEntry(details.getPath()); entry.setSize(details.getSize()); entry.setTime(details.getLastModified()); try { if (spec.isSatisfiedBy(details)) { zout1.putNextEntry(entry); details.copyTo(zout1); zout1.closeEntry(); } else { zout2.putNextEntry(entry); details.copyTo(zout2); zout2.closeEntry(); } } catch (IOException e) { throw new RuntimeException(e); } } });
public String getSourcePath() { return this.fileDetails.getPath(); }
public String getSourceName() { return this.fileDetails.getName(); }
public boolean isDirectory() { return fileDetails.isDirectory(); }
@Override public void visitFile(FileVisitDetails details) { ByteArrayOutputStream stream = new ByteArrayOutputStream(); details.copyTo(stream); String file = new String(stream.toByteArray(), Constants.CHARSET); loadedPatches.add(new PatchedFile(file, context, fuzz)); }
@Override public void visitFile(final FileVisitDetails fileVisitDetails) { result.add(fileVisitDetails.getFile()); } });
@Override public void visitFile(FileVisitDetails fileVisitDetails) { String name = fileVisitDetails.getName(); if (name.startsWith("_")) return; File in = fileVisitDetails.getFile(); String pathString = fileVisitDetails.getRelativePath().getPathString();
@Override protected void configureForVariant(final BaseVariant variant, FindBugs task) { task.setDescription("Run FindBugs analysis for " + variant.getName() + " classes"); task.setSource(getAllJava(variant)); task.dependsOn(variant.getJavaCompiler()); ConventionMapping taskMapping = task.getConventionMapping(); taskMapping.map("classes", () -> { // the simple "classes = sourceSet.output" may lead to non-existing resources directory // being passed to FindBugs Ant task, resulting in an error List<String> generatedClasses = new LinkedList<>(); getJavaCompile(variant).getSource().visit(fileVisitDetails -> { if (!fileVisitDetails.isDirectory() && fileVisitDetails.getPath().endsWith(".java") && fileVisitDetails.getFile().getAbsolutePath().startsWith(project.getBuildDir().getAbsolutePath())) { generatedClasses.add(fileVisitDetails.getPath().replace(".java", "")); } }); return getOutput(variant) .filter(file -> generatedClasses.parallelStream().noneMatch(generatedClass -> file.getAbsolutePath().endsWith(generatedClass + ".class") || file.getAbsolutePath().contains(generatedClass + "$"))); }); taskMapping.map("classpath", () -> getCompileClasspath(variant)); } }
@Override public void visitDir(FileVisitDetails dir) { try { String name = dir.getRelativePath().toString().replace('\\', '/'); if (!name.endsWith("/")) name += "/"; if (entries.contains(name)) return; entries.add(name); ZipEntry entry = new ZipEntry(name); zout.putNextEntry(entry); } catch (IOException e) { throw new RuntimeException(e); } }