use of org.apache.tools.ant.types.FileSet in project jetty.project by eclipse.
the class AntWebAppContext method getClassPathFiles.
/**
* @return a list of classpath files (libraries and class directories).
*/
public List<File> getClassPathFiles() {
List<File> classPathFiles = new ArrayList<File>();
Iterator classesIterator = classes.iterator();
while (classesIterator.hasNext()) {
FileSet clazz = (FileSet) classesIterator.next();
classPathFiles.add(clazz.getDirectoryScanner(project).getBasedir());
}
Iterator iterator = libraries.iterator();
while (iterator.hasNext()) {
FileSet library = (FileSet) iterator.next();
String[] includedFiles = library.getDirectoryScanner(project).getIncludedFiles();
File baseDir = library.getDirectoryScanner(project).getBasedir();
for (int i = 0; i < includedFiles.length; i++) {
classPathFiles.add(new File(baseDir, includedFiles[i]));
}
}
return classPathFiles;
}
use of org.apache.tools.ant.types.FileSet in project cglib by cglib.
the class AbstractProcessTask method getFiles.
protected Collection getFiles() {
Map fileMap = new HashMap();
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();
}
use of org.apache.tools.ant.types.FileSet in project processing by processing.
the class AppBundlerTask method copyClassPathEntries.
private void copyClassPathEntries(File javaDirectory) throws IOException {
for (FileSet fileSet : classPath) {
File classPathDirectory = fileSet.getDir();
DirectoryScanner directoryScanner = fileSet.getDirectoryScanner(getProject());
String[] includedFiles = directoryScanner.getIncludedFiles();
for (String includedFile : includedFiles) {
File source = new File(classPathDirectory, includedFile);
File destination = new File(javaDirectory, new File(includedFile).getName());
copy(source, destination);
}
}
}
use of org.apache.tools.ant.types.FileSet in project bnd by bndtools.
the class DeployTask method execute.
@Override
public void execute() throws BuildException {
try {
Project project = Workspace.getProject(getProject().getBaseDir());
// Deploy the files that need to be released
for (FileSet fileset : filesets) {
DirectoryScanner ds = fileset.getDirectoryScanner(getProject());
String[] files = ds.getIncludedFiles();
if (files.length == 0)
logger.debug("No files included");
for (int i = 0; i < files.length; i++) {
File file = new File(ds.getBasedir(), files[i]);
try {
if (file.isFile() && file.getName().endsWith(".jar")) {
if (deployRepo != null)
project.deploy(deployRepo, file);
else
project.deploy(file);
} else
messages.NotAJarFile_(file);
} catch (Exception e) {
messages.FailedToDeploy_Exception_(file, e);
}
}
}
report(project);
if (project.getErrors().size() > 0)
throw new BuildException("Deploy failed");
} catch (Throwable t) {
t.printStackTrace();
throw new BuildException(t);
}
}
use of org.apache.tools.ant.types.FileSet in project processdash by dtuma.
the class PackageLaunchProfile method calculateContentToken.
private String calculateContentToken() throws IOException {
List<File> files = new ArrayList<File>();
for (FileSet fs : filesets) {
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
for (String name : ds.getIncludedFiles()) files.add(new File(ds.getBasedir(), name));
}
if (files.isEmpty())
throw new BuildException("You must designate at least one file " + "to include in the launch profile.");
Collections.sort(files, FILENAME_SORTER);
Checksum ck = new Adler32();
for (File f : files) calcChecksum(f, ck);
return Long.toString(Math.abs(ck.getValue()), Character.MAX_RADIX);
}
Aggregations