/** * Executes the task - performs the actual compiler call. * * @throws BuildException on error. */ public void execute() throws BuildException { // first off, make sure that we've got a srcdir and destdir if (srcDir == null || destDir == null) { throw new BuildException("srcDir and destDir attributes must be set!"); } // scan source and dest dirs to build up both copy lists and // compile lists // scanDir(srcDir, destDir); DirectoryScanner ds = getDirectoryScanner(srcDir); String[] files = ds.getIncludedFiles(); scanDir(srcDir, destDir, files); // copy the source and support files copyFilesToDestination(); // compile the source files if (compileList.size() > 0) { log( "Compiling " + compileList.size() + " source file" + (compileList.size() == 1 ? "" : "s") + " to " + destDir); doNetRexxCompile(); if (removeKeepExtension && (!compile || keep)) { removeKeepExtensions(); } } }
/** * Executes the task. * * @throws BuildException if an error occurs */ public void execute() throws BuildException { checkParameters(); resetFileLists(); loadRegisteredScriptExtensions(); if (javac != null) jointCompilation = true; // scan source directories and dest directory to build up // compile lists String[] list = src.list(); for (String filename : list) { File file = getProject().resolveFile(filename); if (!file.exists()) { throw new BuildException( "srcdir \"" + file.getPath() + "\" does not exist!", getLocation()); } DirectoryScanner ds = this.getDirectoryScanner(file); String[] files = ds.getIncludedFiles(); scanDir(file, destDir != null ? destDir : file, files); } compile(); if (updatedProperty != null && taskSuccess && compileList.length != 0) { getProject().setNewProperty(updatedProperty, "true"); } }
/** Scans the source directories looking for source files to be decompiled. */ protected void scanSrc() throws BuildException { for (@SuppressWarnings("unchecked") Iterator<Resource> it = src.iterator(); it.hasNext(); ) { Resource resource = it.next(); FileResource fileResource = resource instanceof FileResource ? (FileResource) resource : null; if (fileResource != null) { File file = fileResource.getFile(); if (file.isDirectory()) { DirectoryScanner ds = getDirectoryScanner(file); String[] files = ds.getIncludedFiles(); scanDir(file, destdir != null ? destdir : file, files); } else { String[] files = new String[] {fileResource.getName()}; scanDir( fileResource.getBaseDir(), destdir != null ? destdir : fileResource.getBaseDir(), files); } } // else // { // //FIXME what to do? // } } }
void unpackJars() throws BuildException { // unpack in separate dirs, to allow multiple instances of the same // resource from different jars. int jarId = 0; Iterator it = task.getLibs().iterator(); while (it.hasNext()) { FileSet fs = (FileSet) it.next(); DirectoryScanner scanner = fs.getDirectoryScanner(task.getProject()); String[] files = scanner.getIncludedFiles(); Expand unjar = (Expand) task.createSubtask(Expand.class); for (int i = 0; i < files.length; i++) { File unpackDir = new File(scratchDir, jarId++ + ""); unpackDir.mkdirs(); unpackedJarDirs.add(unpackDir); unjar.setDest(unpackDir); unjar.setSrc(new File(scanner.getBasedir(), files[i])); unjar.execute(); } } }
protected File[] getAJFiles() { String[] list = javac.getSrcdir().list(); File destDir = javac.getDestdir(); File[] sourceFiles = new File[0]; for (int i = 0; i < list.length; i++) { File srcDir = javac.getProject().resolveFile(list[i]); if (!srcDir.exists()) { throw new BuildException( "srcdir \"" + srcDir.getPath() + "\" does not exist!", javac.getLocation()); } DirectoryScanner ds = getDirectoryScanner(srcDir); String[] files = ds.getIncludedFiles(); AJFileNameMapper m = new AJFileNameMapper(); SourceFileScanner sfs = new SourceFileScanner(javac); File[] moreFiles = sfs.restrictAsFiles(files, srcDir, destDir, m); if (moreFiles != null) { File[] origFiles = sourceFiles; sourceFiles = new File[origFiles.length + moreFiles.length]; System.arraycopy(origFiles, 0, sourceFiles, 0, origFiles.length); System.arraycopy(moreFiles, 0, sourceFiles, origFiles.length, moreFiles.length); } } return sourceFiles; }
@Override public void execute() throws BuildException { // instantiate and sanity check the parser class Object pobj = null; try { Class<?> pclass = Class.forName(_parser); pobj = pclass.newInstance(); } catch (Exception e) { throw new BuildException("Error instantiating config parser", e); } if (!(pobj instanceof CompiledConfigParser)) { throw new BuildException("Invalid parser class: " + _parser); } CompiledConfigParser parser = (CompiledConfigParser) pobj; // if we have a single file and target specified, do those if (_configdef != null) { parse(parser, _configdef, _target == null ? getTarget(_configdef) : _target); } // deal with the filesets for (FileSet fs : _filesets) { DirectoryScanner ds = fs.getDirectoryScanner(getProject()); File fromDir = fs.getDir(getProject()); for (String file : ds.getIncludedFiles()) { File source = new File(fromDir, file); parse(parser, source, getTarget(source)); } } }
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)); } } }
private String[] findJsonFiles(File targetDirectory) { DirectoryScanner scanner = new DirectoryScanner(); scanner.setIncludes(new String[] {"**/*.json"}); scanner.setBasedir(targetDirectory); scanner.scan(); return scanner.getIncludedFiles(); }
/** * Scans a directory for files matching the includes pattern. * * @param directory the directory to scan. * @param includes the includes pattern. * @param listener Hudson Build listener. * @return array of strings of paths for files that match the includes pattern in the directory. * @throws IOException */ protected String[] scan(final File directory, final String includes, final BuildListener listener) throws IOException { String[] fileNames = new String[0]; if (StringUtils.isNotBlank(includes)) { FileSet fs = null; try { fs = Util.createFileSet(directory, includes); DirectoryScanner ds = fs.getDirectoryScanner(); fileNames = ds.getIncludedFiles(); } catch (BuildException e) { e.printStackTrace(listener.getLogger()); throw new IOException(e); } } if (LOGGER.isLoggable(Level.FINE)) { for (String fileName : fileNames) { LOGGER.log(Level.FINE, "Test result file found: " + fileName); } } return fileNames; }
/** Executes the task. */ public void execute() throws BuildException { checkParameters(); final FileUtils fUtils = FileUtils.getFileUtils(); final Project project = getProject(); for (FileSet fileset : filesets) { final DirectoryScanner scanner = fileset.getDirectoryScanner(project); final File fromDir = fileset.getDir(project); final String[] srcFiles = scanner.getIncludedFiles(); for (int fIndex = 0; fIndex < srcFiles.length; fIndex++) { final File file = fUtils.resolveFile(fromDir, srcFiles[fIndex]); if (!file.isFile()) { continue; } if (false == forceAllFiles && false == file.getName().endsWith(".java")) { throw new BuildException( "File does not end with '.java'. Use 'force' attribute to override."); } try { checkLicense(file); } catch (IOException e) { throw new BuildException("Could not process file: " + file.getAbsolutePath(), e); } } } }
/** * Fulfill the ResourceCollection contract. * * @return number of elements as int. */ public synchronized int size() { if (isReference()) { return getRef().size(); } ensureDirectoryScannerSetup(); ds.scan(); return ds.getIncludedFilesCount() + ds.getIncludedDirsCount(); }
/** * Returns list of mapped files, that should be transformed. Files can by specified via attributes * (srcFile, srcDir) or resources (FileSet, FileList, DirSet, etc). Mapped file represents input * and output file for transformation. * * @return list of mapped files */ public List<MappedFile> getMappedFiles() { mappedFiles.clear(); // one src file if (getSrcFile() != null) { addMappedFile(getSrcFile()); } if (getSrcDir() != null) { addMappedFile(getSrcDir()); } Iterator element = resources.iterator(); while (element.hasNext()) { ResourceCollection rc = (ResourceCollection) element.next(); if (rc instanceof FileSet && rc.isFilesystemOnly()) { FileSet fs = (FileSet) rc; File fromDir = fs.getDir(getProject()); DirectoryScanner ds; try { ds = fs.getDirectoryScanner(getProject()); } catch (BuildException ex) { log("Could not scan directory " + fromDir, ex, Project.MSG_ERR); continue; } for (String f : ds.getIncludedFiles()) { addMappedFile(new File(fromDir + System.getProperty("file.separator") + f), fromDir); } } else { if (!rc.isFilesystemOnly()) { log("Only filesystem resources are supported", Project.MSG_WARN); continue; } Iterator rcIt = rc.iterator(); while (rcIt.hasNext()) { Resource r = (Resource) rcIt.next(); if (!r.isExists()) { log("Could not find resource " + r.toLongString(), Project.MSG_VERBOSE); continue; } if (r instanceof FileResource) { FileResource fr = (FileResource) r; addMappedFile(fr.getFile(), fr.getBaseDir()); } else { log( "Only file resources are supported (" + r.getClass().getSimpleName() + " found)", Project.MSG_WARN); continue; } } } } return mappedFiles; }
public String[] getIncludedDirectories(FileSet fileSet) { DirectoryScanner scanner = scan(fileSet); if (scanner != null) { return scanner.getIncludedDirectories(); } return EMPTY_STRING_ARRAY; }
/** * Tells if the specified directory is ignored by default (.svn, cvs, etc) * * @param directory */ private boolean isDefaultExcludes(File directory) { for (String pattern : DirectoryScanner.getDefaultExcludes()) { if (DirectoryScanner.match(pattern, directory.getAbsolutePath().replace("\\", "/"))) { return true; } } return false; }
public PluginsEnvironmentBuilder(File dir) throws Exception { DirectoryScanner directoryScanner = new DirectoryScanner(); directoryScanner.setBasedir(dir); directoryScanner.setIncludes(new String[] {"**\\liferay-plugin-package.properties"}); directoryScanner.scan(); String dirName = dir.getCanonicalPath(); for (String fileName : directoryScanner.getIncludedFiles()) { setupWarProject(dirName, fileName); } directoryScanner = new DirectoryScanner(); directoryScanner.setBasedir(dir); directoryScanner.setIncludes(new String[] {"**\\build.xml"}); directoryScanner.scan(); for (String fileName : directoryScanner.getIncludedFiles()) { String content = _fileUtil.read(dirName + "/" + fileName); boolean osgiProject = false; if (content.contains("<import file=\"../../build-common-osgi-plugin.xml\" />") || content.contains("../tools/sdk/build-common-osgi-plugin.xml\" />")) { osgiProject = true; } boolean sharedProject = false; if (content.contains("<import file=\"../build-common-shared.xml\" />") || content.contains("../tools/sdk/build-common-shared.xml\" />")) { sharedProject = true; } List<String> dependencyJars = Collections.emptyList(); if (osgiProject) { int x = content.indexOf("osgi.ide.dependencies"); if (x != -1) { x = content.indexOf("value=\"", x); x = content.indexOf("\"", x); int y = content.indexOf("\"", x + 1); dependencyJars = Arrays.asList(StringUtil.split(content.substring(x + 1, y))); } } if (osgiProject || sharedProject) { setupJarProject(dirName, fileName, dependencyJars, sharedProject); } } }
/** * Perform the check * * @throws BuildException if an error occurs during execution of this task. */ @Override public void execute() throws BuildException { try { CheckEolMode mode = null; if ("\n".equals(eoln)) { mode = CheckEolMode.LF; } else if ("\r\n".equals(eoln)) { mode = CheckEolMode.CRLF; } else { log( "Line ends check skipped, because OS line ends setting is neither LF nor CRLF.", Project.MSG_VERBOSE); return; } int count = 0; List<org.apache.tomcat.buildutil.CheckEolCheckFailureRemoteInterface> errors = new ArrayList<org.apache.tomcat.buildutil.CheckEolCheckFailureRemoteInterface>(); // Step through each file and check. for (FileSet fs : filesets) { DirectoryScanner ds = fs.getDirectoryScanner(getProject()); File basedir = ds.getBasedir(); String[] files = ds.getIncludedFiles(); if (files.length > 0) { log("Checking line ends in " + files.length + " file(s)"); for (int i = 0; i < files.length; i++) { File file = new File(basedir, files[i]); log("Checking file '" + file + "' for correct line ends", Project.MSG_DEBUG); try { check(file, errors, mode); } catch (IOException e) { throw new BuildException("Could not check file '" + file.getAbsolutePath() + "'", e); } count++; } } } if (count > 0) { log("Done line ends check in " + count + " file(s), " + errors.size() + " error(s) found."); } if (errors.size() > 0) { String message = "The following files have wrong line ends: " + errors; // We need to explicitly write the message to the log, because // long BuildException messages may be trimmed. E.g. I observed // this problem with Eclipse IDE 3.7. log(message, Project.MSG_ERR); throw new BuildException(message); } } catch (Exception excp) { excp.printStackTrace(); } }
private void addToCompileList(List<File> dirs) { for (File srcDir : dirs) { if (srcDir.isDirectory()) { FileSet fs = (FileSet) this.files.clone(); fs.setDir(srcDir); DirectoryScanner ds = fs.getDirectoryScanner(getProject()); String[] files = ds.getIncludedFiles(); for (String fileName : files) compileList.add(new File(srcDir, fileName)); } } }
/** Converts the file(s) identified by the given pattern. */ public static void convert(String pattern, boolean compress) throws IOException { DirectoryScanner scanner = new DirectoryScanner(); scanner.setBasedir("."); scanner.setIncludes(new String[] {pattern}); scanner.scan(); for (String source : scanner.getIncludedFiles()) { try { convert(source, source, compress); } catch (IOException e) { log.warning("Error converting file.", "file", source, e); } } }
public void execute() throws BuildException { IvyAdapter adapter = null; try { Class.forName("org.apache.ivy.Ivy"); adapter = new Ivy20Adapter(); } catch (ClassNotFoundException e) { adapter = new Ivy14Adapter(); } String setId = org + "." + module + "." + rev + ".fileset"; adapter.configure(this); adapter.fileset(this, setId); FileSet fileset = (FileSet) getProject().getReference(setId); DirectoryScanner scanner = fileset.getDirectoryScanner(getProject()); String files[] = scanner.getIncludedFiles(); File file = new File(scanner.getBasedir(), files[0]); File importFile = null; if ("xml".equalsIgnoreCase(type)) { importFile = file; } else if ("jar".equalsIgnoreCase(type) || "zip".equalsIgnoreCase(type)) { File dir = new File(file.getParentFile(), file.getName() + ".extracted"); if (!dir.exists() || dir.lastModified() < file.lastModified()) { dir.mkdir(); Expand expand = (Expand) getProject().createTask("unjar"); expand.setSrc(file); expand.setDest(dir); expand.perform(); } importFile = new File(dir, resource); if (!importFile.exists()) { throw new BuildException("Cannot find a '" + resource + "' file in " + file.getName()); } } else { throw new BuildException("Don't know what to do with type: " + type); } log("Importing " + importFile.getName(), Project.MSG_INFO); super.setFile(importFile.getAbsolutePath()); super.execute(); log("Import complete.", Project.MSG_INFO); }
/** Run Phantom test runner on a set of files */ @Override public void execute() throws BuildException { checkAttributes(); DirectoryScanner dirScanner = getDirectoryScanner(dir); String[] includedFiles = dirScanner.getIncludedFiles(); String[] absoluteFiles = new String[includedFiles.length]; for (int i = 0; i < includedFiles.length; i++) { absoluteFiles[i] = dir.getAbsolutePath() + "/" + includedFiles[i]; } // summarize results try { PhantomTestRunner testRunner = new PhantomTestRunner(getPhantom()); testRunner.setLogger(this); log("Running JS Tests..."); log("-------------------------------------------------------------------------------"); JsTestResults results = testRunner.runTests(absoluteFiles); log("-------------------------------------------------------------------------------"); log("Running JS Tests Completed"); int passCount = results.getPassCount(); int failCount = results.getFailCount(); int errorCount = results.getErrorCount(); log(passCount + " passed. " + failCount + " failed. " + errorCount + " errors"); reportResults(results); if (failCount > 0 || errorCount > 0) { String message = getFailureMessage(failCount, errorCount); if (fail) { throw new BuildException(message); } else { log(message); } } else { log(getSuccessMessage(passCount)); } } catch (IOException e) { throw new BuildException("An IO Exception caused while running JS Unit tests", e); } }
protected Collection<File> getFiles() { Map<String, File> fileMap = new HashMap<String, File>(); Project p = getProject(); for (int i = 0; i < filesets.size(); i++) { FileSet fs = (FileSet) filesets.elementAt(i); DirectoryScanner ds = fs.getDirectoryScanner(p); String[] srcFiles = ds.getIncludedFiles(); File dir = fs.getDir(p); for (int j = 0; j < srcFiles.length; j++) { File src = new File(dir, srcFiles[j]); fileMap.put(src.getAbsolutePath(), src); } } return fileMap.values(); }
// adding something to the excludes' public void test2() { String[] expected = { "**/*~", "**/#*#", "**/.#*", "**/%*%", "**/._*", "**/CVS", "**/CVS/**", "**/.cvsignore", "**/SCCS", "**/SCCS/**", "**/vssver.scc", "**/.svn", "**/.svn/**", "**/.git", "**/.git/**", "**/.gitattributes", "**/.gitignore", "**/.gitmodules", "**/.hg", "**/.hg/**", "**/.hgignore", "**/.hgsub", "**/.hgsubstate", "**/.hgtags", "**/.bzr", "**/.bzr/**", "**/.bzrignore", "**/.DS_Store", "foo" }; project.executeTarget("test2"); assertEquals("current default excludes", expected, DirectoryScanner.getDefaultExcludes()); }
public List<List<Path>> invoke(File baseDir, VirtualChannel channel) throws IOException { FileSet fs = Util.createFileSet(baseDir, pattern); DirectoryScanner ds = fs.getDirectoryScanner(); String[] files = ds.getIncludedFiles(); if (files.length > 0) { List<List<Path>> r = new ArrayList<List<Path>>(files.length); for (String match : files) { List<Path> file = buildPathList(baseDir, new File(baseDir, match)); r.add(file); } return r; } return null; }
protected List<String> getFileNames(String basedir, String[] excludes, String[] includes) { DirectoryScanner directoryScanner = new DirectoryScanner(); directoryScanner.setBasedir(basedir); if (_excludes != null) { excludes = ArrayUtil.append(excludes, _excludes); } directoryScanner.setExcludes(excludes); directoryScanner.setIncludes(includes); return sourceFormatterHelper.scanForFiles(directoryScanner); }
/** * Append all files found by a directory scanner to a vector. * * @param files the vector to append the files to. * @param ds the scanner to get the files from. */ protected void appendFiles(Vector files, DirectoryScanner ds) { String[] dsfiles = ds.getIncludedFiles(); for (int i = 0; i < dsfiles.length; i++) { files.addElement(dsfiles[i]); } }
public ExtInfoBuilder(String basedir, String outputDir, String servletContextName) throws Exception { DirectoryScanner ds = new DirectoryScanner(); ds.setBasedir(basedir); ds.setExcludes( new String[] { ".svn/**", "**/.svn/**", "ext-impl/ext-impl.jar", "ext-impl/src/**", "ext-service/ext-service.jar", "ext-service/src/**", "ext-util-bridges/ext-util-bridges.jar", "ext-util-bridges/src/**", "ext-util-java/ext-util-java.jar", "ext-util-java/src/**", "ext-util-taglib/ext-util-taglib.jar", "ext-util-taglib/src/**", "liferay-plugin-package.properties" }); ds.scan(); String[] files = ds.getIncludedFiles(); Arrays.sort(files); Element rootElement = new ElementImpl(DocumentHelper.createElement("ext-info")); Document document = new DocumentImpl(DocumentHelper.createDocument()); document.setRootElement(rootElement); DocUtil.add(rootElement, "servlet-context-name", servletContextName); Element filesElement = rootElement.addElement("files"); for (String file : files) { DocUtil.add( filesElement, "file", StringUtil.replace(file, StringPool.BACK_SLASH, StringPool.SLASH)); } _fileUtil.write(outputDir + "/ext-" + servletContextName + ".xml", document.formattedString()); }
public void produce(final DataConsumer pReceiver) throws IOException { String user = "******"; int uid = 0; String group = "root"; int gid = 0; int filemode = TarEntry.DEFAULT_FILE_MODE; int dirmode = TarEntry.DEFAULT_DIR_MODE; String prefix = ""; if (fileset instanceof Tar.TarFileSet) { Tar.TarFileSet tarfileset = (Tar.TarFileSet) fileset; user = tarfileset.getUserName(); uid = tarfileset.getUid(); group = tarfileset.getGroup(); gid = tarfileset.getGid(); filemode = tarfileset.getMode(); dirmode = tarfileset.getDirMode(tarfileset.getProject()); prefix = tarfileset.getPrefix(tarfileset.getProject()); } final DirectoryScanner scanner = fileset.getDirectoryScanner(fileset.getProject()); scanner.scan(); final File basedir = scanner.getBasedir(); final String[] directories = scanner.getIncludedDirectories(); for (int i = 0; i < directories.length; i++) { final String name = directories[i].replace('\\', '/'); pReceiver.onEachDir(prefix + "/" + name, null, user, uid, group, gid, dirmode, 0); } final String[] files = scanner.getIncludedFiles(); for (int i = 0; i < files.length; i++) { final String name = files[i].replace('\\', '/'); final File file = new File(basedir, name); final InputStream inputStream = new FileInputStream(file); try { pReceiver.onEachFile( inputStream, prefix + "/" + name, null, user, uid, group, gid, filemode, file.length()); } finally { inputStream.close(); } } }
private void handleClassPath() throws ManifestException { final StringBuffer value = new StringBuffer(); boolean rootIncluded = false; if (baseDir != null || classes.size() == 0) { value.append(".,"); rootIncluded = true; } Iterator<ZipFileSet> i = classes.iterator(); while (i.hasNext()) { final ZipFileSet zipFileSet = i.next(); final String prefix = zipFileSet.getPrefix(getProject()); if (prefix.length() > 0) { value.append(prefix); value.append(','); } else if (!rootIncluded) { value.append(".,"); rootIncluded = true; } } i = libs.iterator(); while (i.hasNext()) { final ZipFileSet fileset = i.next(); if (fileset.getSrc(getProject()) == null) { final DirectoryScanner ds = fileset.getDirectoryScanner(getProject()); final String[] files = ds.getIncludedFiles(); if (files.length != 0) { zipgroups.add(fileset); final String prefix = fixPrefix(fileset.getPrefix(getProject())); for (final String file : files) { value.append(prefix.replace('\\', '/')); value.append(file.replace('\\', '/')); value.append(','); } } } } if (value.length() > 2) { generatedManifest.addConfiguredAttribute( createAttribute(BUNDLE_CLASS_PATH_KEY, value.substring(0, value.length() - 1))); } }
private DirectoryScanner scan(FileSet fileSet) { File basedir = new File(fileSet.getDirectory()); if (!basedir.exists() || !basedir.isDirectory()) { return null; } DirectoryScanner scanner = new DirectoryScanner(); List<String> includesList = fileSet.getIncludes(); List<String> excludesList = fileSet.getExcludes(); if (includesList.size() > 0) { scanner.setIncludes(includesList.toArray(new String[0])); } if (excludesList.size() > 0) { scanner.setExcludes(excludesList.toArray(new String[0])); } if (true) // fileSet.isUseDefaultExcludes() ) { scanner.addDefaultExcludes(); } scanner.setBasedir(basedir); scanner.setFollowSymlinks(true); // fileSet.isFollowSymlinks() ); scanner.scan(); return scanner; }
@Override public void execute() { final Project proj = getProject(); this.projectName = proj.getName(); if (template == null) { throw new BuildException("template must be set"); } if (title == null) { title = ""; } if (description == null) { description = ""; } if (filesets.isEmpty() && fromFile == null && toFile == null) { throw new BuildException("Need to specify tofile and fromfile or give a fileset"); } if (filesets.isEmpty()) { // log("Project base is: " + getProject().getBaseDir()); // log("Attempting to transform: " + fromFile); if (!FileUtils.isAbsolutePath(fromFile)) { fromFile = getProject().getBaseDir() + File.separator + fromFile; } transform(fromFile, toFile.toString()); } else { if (fromFile != null) { throw new BuildException("Can not specify fromfile when using filesets"); } if (toFile != null) { throw new BuildException("Can not specify tofile when using filesets"); } for (final Object element : filesets) { final FileSet fs = (FileSet) element; final DirectoryScanner ds = fs.getDirectoryScanner(getProject()); final String[] files = ds.getIncludedFiles(); for (final String file : files) { transform(new File(fs.getDir(getProject()), file).getAbsolutePath(), file); } } } }