Java Code Examples for org.apache.tools.ant.types.FileList#getFiles()

The following examples show how to use org.apache.tools.ant.types.FileList#getFiles() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JarBundler.java    From JarBundler with Apache License 2.0 5 votes vote down vote up
private void processJarFileLists() throws BuildException {

		for (Iterator jarIter = mJarFileLists.iterator(); jarIter.hasNext();) {
			FileList fl = (FileList) jarIter.next();
			Project p = fl.getProject();
			File srcDir = fl.getDir(p);
			String[] files = fl.getFiles(p);

			try {

				for (int i = 0; i < files.length; i++) {
					String fileName = files[i];
					File src = new File(srcDir, fileName);
					File dest = new File(mJavaDir, fileName);

					if (mVerbose) 
						log("Copying JAR file to \"" + bundlePath(dest) + "\"");
					

					mFileUtils.copyFile(src, dest);
					bundleProperties.addToClassPath(fileName);
				}
			} catch (IOException ex) {
				throw new BuildException("Cannot copy jar file: " + ex);
			}
		}
	}
 
Example 2
Source File: JarBundler.java    From JarBundler with Apache License 2.0 5 votes vote down vote up
private void processExtraClassPathFileLists() throws BuildException {
	for (Iterator jarIter = mExtraClassPathFileLists.iterator(); jarIter
			.hasNext();) {
		FileList fl = (FileList) jarIter.next();
		Project p = fl.getProject();
		File srcDir = fl.getDir(p);
		String[] files = fl.getFiles(p);

		for (int i = 0; i < files.length; i++) {
			File f = new File(srcDir, files[i]);
			String path = f.getPath().replace(File.separatorChar, '/');
			bundleProperties.addToExtraClassPath(path);
		}
	}
}
 
Example 3
Source File: JarBundler.java    From JarBundler with Apache License 2.0 5 votes vote down vote up
private void processCopyingFileLists(List fileLists, File targetDir, boolean setExec) throws BuildException {
	for (Iterator execIter = fileLists.iterator(); execIter.hasNext();) {

		FileList fl = (FileList) execIter.next();
		Project p = fl.getProject();
		File srcDir = fl.getDir(p);
		String[] files = fl.getFiles(p);

		if (files.length == 0) {
			// this is probably an error -- warn about it
			System.err.println("WARNING: filelist for copying from directory "
							+ srcDir + ": no files found");
		} else {
			try {
				for (int i = 0; i < files.length; i++) {
					String fileName = files[i];
					File src = new File(srcDir, fileName);
					File dest = new File(targetDir, fileName);
					
					if (mVerbose) 
						log("Copying "
								+ (setExec ? "exec" : "resource")
								+ " file to \"" + bundlePath(dest) +"\"");
					
					mFileUtils.copyFile(src, dest);
					if (setExec)
						setExecutable(dest);
				}
			} catch (IOException ex) {
				throw new BuildException("Cannot copy jar file: " + ex);
			}
		}
	}
}
 
Example 4
Source File: CompileTask.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translates an Ant file list into the file format that the compiler
 * expects.
 */
private List<SourceFile> findJavaScriptFiles(FileList fileList) {
  List<SourceFile> files = Lists.newLinkedList();
  File baseDir = fileList.getDir(getProject());

  for (String included : fileList.getFiles(getProject())) {
    files.add(SourceFile.fromFile(new File(baseDir, included),
        Charset.forName(encoding)));
  }

  return files;
}