@Nonnull public static FileSet createFileSet(@Nonnull File baseDir, @Nonnull String includes) { return createFileSet(baseDir,includes,null); }
@Override public Map<String,String> invoke(File basedir, VirtualChannel channel) throws IOException, InterruptedException { Map<String,String> r = new HashMap<String,String>(); FileSet fileSet = Util.createFileSet(basedir, includes, excludes); fileSet.setDefaultexcludes(defaultExcludes); fileSet.setCaseSensitive(caseSensitive); for (String f : fileSet.getDirectoryScanner().getIncludedFiles()) { f = f.replace(File.separatorChar, '/'); r.put(f, f); } return r; } }
private void scan(String pattern) { LOGGER.fine("Scanning "+pattern+" for hs_err_pid files"); pattern = pattern.replace("%p","*").replace("%%","%"); File f = new File(pattern).getAbsoluteFile(); if (!pattern.contains("*")) scanFile(f); else {// GLOB File commonParent = f; while (commonParent!=null && commonParent.getPath().contains("*")) { commonParent = commonParent.getParentFile(); } if (commonParent==null) { LOGGER.warning("Failed to process "+f); return; // huh? } FileSet fs = Util.createFileSet(commonParent, f.getPath().substring(commonParent.getPath().length()+1), null); DirectoryScanner ds = fs.getDirectoryScanner(new Project()); for (String child : ds.getIncludedFiles()) { scanFile(new File(commonParent,child)); } } }
/** * Runs Ant glob expansion. * * @return * A set of relative file names from the base directory. */ @Nonnull private static String[] glob(File dir, String includes, String excludes, boolean defaultExcludes) throws IOException { if(isAbsolute(includes)) throw new IOException("Expecting Ant GLOB pattern, but saw '"+includes+"'. See http://ant.apache.org/manual/Types/fileset.html for syntax"); FileSet fs = Util.createFileSet(dir,includes,excludes); fs.setDefaultexcludes(defaultExcludes); DirectoryScanner ds; try { ds = fs.getDirectoryScanner(new Project()); } catch (BuildException x) { throw new IOException(x.getMessage()); } String[] files = ds.getIncludedFiles(); return files; }
@Override public List<Record> invoke(File baseDir, VirtualChannel channel) throws IOException { List<Record> results = new ArrayList<Record>(); FileSet src = Util.createFileSet(baseDir,targets); DirectoryScanner ds = src.getDirectoryScanner(); for( String f : ds.getIncludedFiles() ) { File file = new File(baseDir,f); // consider the file to be produced by this build only if the timestamp // is newer than when the build has started. // 2000ms is an error margin since since VFAT only retains timestamp at 2sec precision boolean produced = buildTimestamp <= file.lastModified()+2000; try { results.add(new Record(produced,f,file.getName(),new FilePath(file).digest())); } catch (IOException e) { throw new IOException(Messages.Fingerprinter_DigestFailed(file),e); } catch (InterruptedException e) { throw new IOException(Messages.Fingerprinter_Aborted(),e); } } return results; }
public void scan(File dir, FileVisitor visitor) throws IOException { if(fixEmpty(includes)==null && excludes==null) { // optimization new Full().scan(dir,visitor); return; } FileSet fs = Util.createFileSet(dir,includes,excludes); fs.setDefaultexcludes(useDefaultExcludes); if(dir.exists()) { DirectoryScanner ds = fs.getDirectoryScanner(new org.apache.tools.ant.Project()); for( String f : ds.getIncludedFiles()) { File file = new File(dir, f); scanSingle(file, f, visitor); } } }
FileSet fs = Util.createFileSet(reading(dir),"**/"+fileMask); fs.setCaseSensitive(caseSensitive); DirectoryScanner ds = fs.getDirectoryScanner(new Project());
/** * Returns the appropriate FileSet for the selected baseDir * @param baseDir * @return */ private FileSet getFileSet(File baseDir) { return Util.createFileSet(baseDir, "*.xml","testng-results.xml,testng-failed.xml"); }
public static FileSet createFileSet(File baseDir, String includes) { return createFileSet(baseDir, includes, null); }
public static FileSet createFileSet(File baseDir, String includes) { return createFileSet(baseDir, includes, null); }
@Nonnull public static FileSet createFileSet(@Nonnull File baseDir, @Nonnull String includes) { return createFileSet(baseDir,includes,null); }
@Override public String[] call() throws Throwable { return Util.createFileSet(new File(baseDir), StringUtils.join(testFilesExpression,",")).getDirectoryScanner().getIncludedFiles(); } });
@Override public Map<String,String> invoke(File basedir, VirtualChannel channel) throws IOException, InterruptedException { Map<String,String> r = new HashMap<>(); for (String f : Util.createFileSet(basedir, includes, excludes).getDirectoryScanner().getIncludedFiles()) { f = f.replace(File.separatorChar, '/'); r.put(f, f); } return r; } }
@Override public Map<String,String> invoke(File basedir, VirtualChannel channel) throws IOException, InterruptedException { Map<String,String> r = new HashMap<String,String>(); FileSet fileSet = Util.createFileSet(basedir, includes, excludes); fileSet.setDefaultexcludes(defaultExcludes); fileSet.setCaseSensitive(caseSensitive); for (String f : fileSet.getDirectoryScanner().getIncludedFiles()) { f = f.replace(File.separatorChar, '/'); r.put(f, f); } return r; } }
/** * Runs Ant glob expansion. * * @return * A set of relative file names from the base directory. */ private static String[] glob(File dir, String includes) throws IOException { if(isAbsolute(includes)) throw new IOException("Expecting Ant GLOB pattern, but saw '"+includes+"'. See http://ant.apache.org/manual/Types/fileset.html for syntax"); FileSet fs = Util.createFileSet(dir,includes); DirectoryScanner ds = fs.getDirectoryScanner(new Project()); String[] files = ds.getIncludedFiles(); return files; }
/** * Runs Ant glob expansion. * * @return * A set of relative file names from the base directory. */ private static String[] glob(File dir, String includes) throws IOException { if(isAbsolute(includes)) throw new IOException("Expecting Ant GLOB pattern, but saw '"+includes+"'. See http://ant.apache.org/manual/Types/fileset.html for syntax"); FileSet fs = Util.createFileSet(dir,includes); DirectoryScanner ds = fs.getDirectoryScanner(new Project()); String[] files = ds.getIncludedFiles(); return files; }
private boolean hasMatch(File dir, String pattern) { FileSet fs = Util.createFileSet(dir,pattern); DirectoryScanner ds = fs.getDirectoryScanner(new Project()); return ds.getIncludedFilesCount()!=0 || ds.getIncludedDirsCount()!=0; }
private boolean hasMatch(File dir, String pattern) { FileSet fs = Util.createFileSet(dir, pattern); DirectoryScanner ds = fs.getDirectoryScanner(new Project()); return ds.getIncludedFilesCount() != 0 || ds.getIncludedDirsCount() != 0; }
private boolean hasMatch(File dir, String pattern) { FileSet fs = Util.createFileSet(dir,pattern); DirectoryScanner ds = fs.getDirectoryScanner(new Project()); return ds.getIncludedFilesCount()!=0 || ds.getIncludedDirsCount()!=0; }
private boolean hasMatch(File dir, String pattern) { FileSet fs = Util.createFileSet(dir,pattern); DirectoryScanner ds = fs.getDirectoryScanner(new Project()); return ds.getIncludedFilesCount()!=0 || ds.getIncludedDirsCount()!=0; }