use of org.apache.tools.ant.types.FileSet in project ant by apache.
the class Attrib method setFile.
/**
* A file to be attribed.
* @param src a file
*/
public void setFile(File src) {
FileSet fs = new FileSet();
fs.setFile(src);
addFileset(fs);
}
use of org.apache.tools.ant.types.FileSet in project ant by apache.
the class AbstractJarSignerTask method createUnifiedSources.
/**
* clone our filesets vector, and patch in the jar attribute as a new
* fileset, if is defined
* @return a vector of FileSet instances
*/
protected Vector<FileSet> createUnifiedSources() {
Vector<FileSet> sources = new Vector<>(filesets);
if (jar != null) {
// we create a fileset with the source file.
// this lets us combine our logic for handling output directories,
// mapping etc.
FileSet sourceJar = new FileSet();
sourceJar.setProject(getProject());
sourceJar.setFile(jar);
sources.add(sourceJar);
}
return sources;
}
use of org.apache.tools.ant.types.FileSet in project ant by apache.
the class FTPTest method testGetWithSelector.
@Test
public void testGetWithSelector() {
buildRule.executeTarget("ftp-get-with-selector");
assertContains("selectors are not supported in remote filesets", buildRule.getLog());
FileSet fsDestination = buildRule.getProject().getReference("fileset-destination-without-selector");
DirectoryScanner dsDestination = fsDestination.getDirectoryScanner(buildRule.getProject());
dsDestination.scan();
String[] sortedDestinationDirectories = dsDestination.getIncludedDirectories();
String[] sortedDestinationFiles = dsDestination.getIncludedFiles();
for (int counter = 0; counter < sortedDestinationDirectories.length; counter++) {
sortedDestinationDirectories[counter] = sortedDestinationDirectories[counter].replace(File.separatorChar, '/');
}
for (int counter = 0; counter < sortedDestinationFiles.length; counter++) {
sortedDestinationFiles[counter] = sortedDestinationFiles[counter].replace(File.separatorChar, '/');
}
FileSet fsSource = buildRule.getProject().getReference("fileset-source-without-selector");
DirectoryScanner dsSource = fsSource.getDirectoryScanner(buildRule.getProject());
dsSource.scan();
compareFiles(dsSource, sortedDestinationFiles, sortedDestinationDirectories);
}
use of org.apache.tools.ant.types.FileSet in project ant by apache.
the class FTPTest method testGetFollowSymlinksFalse.
@Test
public void testGetFollowSymlinksFalse() {
Assume.assumeTrue("System does not support Symlinks", supportsSymlinks);
Assume.assumeTrue(loginFailureMessage, loginSucceeded);
Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
buildRule.getProject().executeTarget("ftp-get-directory-no-symbolic-link");
FileSet fsDestination = buildRule.getProject().getReference("fileset-destination-without-selector");
DirectoryScanner dsDestination = fsDestination.getDirectoryScanner(buildRule.getProject());
dsDestination.scan();
compareFiles(dsDestination, new String[] {}, new String[] {});
}
use of org.apache.tools.ant.types.FileSet in project ant by apache.
the class ScriptDefTest method testNestedByClassName.
@Test
public void testNestedByClassName() {
buildRule.executeTarget("nestedbyclassname");
// get the fileset and its basedir
Project p = buildRule.getProject();
FileSet fileset = p.getReference("testfileset");
File baseDir = fileset.getDir(p);
String log = buildRule.getLog();
assertTrue("Expecting attribute value to be printed", log.contains("Attribute attr1 = test"));
assertTrue("Expecting nested element value to be printed", log.contains("Fileset basedir = " + baseDir.getAbsolutePath()));
}
Aggregations