use of org.apache.tools.ant.DirectoryScanner in project ant by apache.
the class Find method execute2.
public void execute2() {
validate();
String foundLocation = null;
for (FileSet fs : filesets) {
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
String[] includedFiles = ds.getIncludedFiles();
for (String includedFile : includedFiles) {
String filename = includedFile.replace('\\', '/');
filename = filename.substring(filename.lastIndexOf("/") + 1);
if (foundLocation == null && file.equals(filename)) {
File base = ds.getBasedir();
File found = new File(base, includedFile);
foundLocation = found.getAbsolutePath();
}
}
}
if (foundLocation != null)
getProject().setNewProperty(location, foundLocation);
}
use of org.apache.tools.ant.DirectoryScanner in project ci.ant by WASdev.
the class DeployTask method scanFileSets.
/**
* returns the list of files (full path name) to process.
*
* @return the list of files included via the filesets.
*/
private List<File> scanFileSets() {
final List<File> list = new ArrayList<File>();
for (int i = 0; i < fileSets.size(); i++) {
FileSet fs = fileSets.get(i);
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
ds.scan();
String[] names = ds.getIncludedFiles();
for (String element : names) {
list.add(new File(ds.getBasedir(), element));
}
}
return list;
}
use of org.apache.tools.ant.DirectoryScanner in project ceylon by eclipse.
the class SourceModules method getModules.
// TODO filters by module name, supported backends (transitive)
public Set<Module> getModules() {
if (this.dir == null) {
this.dir = getProject().resolveFile(Constants.DEFAULT_SOURCE_DIR);
}
FileSet fs = new FileSet();
fs.setDir(this.dir);
// TODO Handle default module
fs.setIncludes("**/" + Constants.MODULE_DESCRIPTOR);
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
String[] files = ds.getIncludedFiles();
log("<sourcemodules> found files " + Arrays.toString(files), Project.MSG_VERBOSE);
URI base = dir.toURI();
LinkedHashSet<Module> result = new LinkedHashSet<Module>();
try {
CeylonClassLoader loader = Util.getCeylonClassLoaderCachedInProject(getProject());
for (String file : files) {
URI uri = new File(this.dir, file).getParentFile().toURI();
log("<sourcemodules> file " + file + "=> uri " + uri, Project.MSG_VERBOSE);
String moduleName = base.relativize(uri).getPath().replace('/', '.');
if (moduleName.endsWith(".")) {
moduleName = moduleName.substring(0, moduleName.length() - 1);
}
log("<sourcemodules> file " + file + "=> moduleName " + moduleName, Project.MSG_VERBOSE);
Module mav = new Module();
mav.setName(moduleName);
String version;
try {
version = new ModuleDescriptorReader(loader, mav.getName(), dir).getModuleVersion();
} catch (NoSuchModuleException e) {
log("<sourcemodules> file " + file + "=> module cannot be read: " + moduleName, Project.MSG_VERBOSE);
// skip it
continue;
}
log("<sourcemodules> file " + file + "=> module " + moduleName + "/" + version, Project.MSG_VERBOSE);
mav.setVersion(version);
result.add(mav);
}
} catch (ClassLoaderSetupException x) {
log("failed to set up Ceylon classloader: could not load module set", Project.MSG_VERBOSE);
}
return result;
}
use of org.apache.tools.ant.DirectoryScanner in project ceylon by eclipse.
the class CeylonCompileAntTask method addToCompileList.
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));
}
}
}
use of org.apache.tools.ant.DirectoryScanner in project ceylon by eclipse.
the class CeylonCompileJsAntTask method addToCompileList.
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));
}
}
}
Aggregations