use of org.apache.tools.ant.DirectoryScanner 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.DirectoryScanner in project poi by apache.
the class TestAllFiles method files.
@Parameters(name = "{index}: {0} using {1}")
public static Iterable<Object[]> files() {
DirectoryScanner scanner = new DirectoryScanner();
scanner.setBasedir(ROOT_DIR);
scanner.setExcludes(SCAN_EXCLUDES);
scanner.scan();
System.out.println("Handling " + scanner.getIncludedFiles().length + " files");
List<Object[]> files = new ArrayList<Object[]>();
for (String file : scanner.getIncludedFiles()) {
// ... failures/handlers lookup doesn't work on windows otherwise
file = file.replace('\\', '/');
if (IGNORED.contains(file)) {
System.out.println("Ignoring " + file);
continue;
}
FileHandler handler = HANDLERS.get(getExtension(file));
files.add(new Object[] { file, handler });
// for some file-types also run OPCFileHandler
if (handler instanceof XSSFFileHandler || handler instanceof XWPFFileHandler || handler instanceof XSLFFileHandler || handler instanceof XDGFFileHandler) {
files.add(new Object[] { file, new OPCFileHandler() });
}
if (handler instanceof HSSFFileHandler || handler instanceof HSLFFileHandler || handler instanceof HWPFFileHandler || handler instanceof HDGFFileHandler) {
files.add(new Object[] { file, new HPSFFileHandler() });
}
}
return files;
}
use of org.apache.tools.ant.DirectoryScanner in project bnd by bndtools.
the class WrapTask method addConfiguredFileSet.
public void addConfiguredFileSet(FileSet list) {
DirectoryScanner scanner = list.getDirectoryScanner(getProject());
String[] files = scanner.getIncludedFiles();
for (int i = 0; i < files.length; i++) {
File f = getFile(scanner.getBasedir(), files[i]);
this.jars.add(f);
}
}
use of org.apache.tools.ant.DirectoryScanner 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.DirectoryScanner in project processdash by dtuma.
the class GenerateTranslator method execute.
public void execute() throws BuildException {
validate();
DirectoryScanner ds = fileset.getDirectoryScanner(getProject());
String[] srcFilenames = ds.getIncludedFiles();
if (srcFilenames.length == 0)
throw new BuildException("You must designate at least one input properties file.");
File[] srcFiles = new File[srcFilenames.length];
for (int j = 0; j < srcFiles.length; j++) srcFiles[j] = new File(ds.getBasedir(), srcFilenames[j]);
try {
openProperties(srcFiles);
} catch (IOException e) {
throw new BuildException("Could not read properties files.");
}
File lexerFile = getLexFileName();
try {
writeOutput(lexerFile);
} catch (IOException ioe) {
throw new BuildException("Cannot create file '" + lexerFile + "'.");
}
try {
JLex.Main.main(new String[] { lexerFile.getAbsolutePath() });
} catch (IOException ioe) {
throw new BuildException("Cannot create file '" + lexerFile + ".java'");
}
if (!keepLexerFile)
lexerFile.delete();
}
Aggregations