Summary
<project>
.
- Assembly
- NAnt
.Core .dll - Namespace
- NAnt
.Core .Types - Base Types
-
- Object
- Element
- DataTypeBase
- Derived Types
Syntax
[Serializable()]
[ElementName("fileset")]
public class FileSet : DataTypeBase
Examples
-
CVS/Repository -
org/apache/CVS/Entries -
org/apache/jakarta/tools/ant/CVS/Entries
-
org/apache/CVS/foo/bar/Entries ( foo/bar/ part does not match)
-
org/apache/jakarta/tools/ant/docs/index.html -
org/apache/jakarta/test.xml
-
org/apache/xyz.java ( jakarta/ part is missing)
-
org/apache/CVS/Entries -
org/apache/jakarta/tools/ant/CVS/Entries
-
org/apache/CVS/foo/bar/Entries ( foo/bar/ part does not match)
Pattern |
---|
**/CVS/* |
org/apache/jakarta/** |
org/apache/**/CVS/* |
**/test/** |
Remarks
Patterns
As described earlier, patterns are used for the inclusion and exclusion. These patterns look very much like the patterns used in DOS and UNIX:
-
'
*
' matches zero or more charactersFor example:
*.cs
matches.cs
,x.cs
andFooBar.cs
, but notFooBar.xml
(does not end with.cs
). -
'
?
' matches one characterFor example:
?.cs
matchesx.cs
,A.cs
, but not.cs
orxyz.cs
(both don't have one character before.cs
).
Combinations of *
's and ?
's are allowed.
Matching is done per-directory. This means that first the first directory
in the pattern is matched against the first directory in the path to match.
Then the second directory is matched, and so on. For example, when we have
the pattern /?abc/*/*.cs
and the path /xabc/foobar/test.cs
,
the first ?abc
is matched with xabc
, then *
is matched
with foobar
, and finally *.cs
is matched with test.cs
.
They all match, so the path matches the pattern.
To make things a bit more flexible, we added one extra feature, which makes
it possible to match multiple directory levels. This can be used to match a
complete directory tree, or a file anywhere in the directory tree. To do this,
**
must be used as the name of a directory. When **
is used as
the name of a directory in the pattern, it matches zero or more directories.
For example: /test/**
matches all files/directories under /test/
,
such as /test/x.cs
, or /test/foo/bar/xyz.html
, but not /xyz.xml
.
There is one "shorthand" - if a pattern ends with /
or \
, then
**
is appended. For example, mypackage/test/
is interpreted as
if it were mypackage/test/**
.
Case-Sensitivity
By default, pattern matching is case-sensitive on Unix and case-insensitive
on other platforms. The NAnt.Core.Types.FileSet.CaseSensitive
parameter can be used
to override this.
Default Excludes
There are a set of definitions that are excluded by default from all tasks that use filesets. They are:
- **/.svn
- **/.svn/**
- **/_svn
- **/_svn/**
- **/.git
- **/.git/**
- **/.git* (eg. .gitignore)
- **/.hg
- **/.hg/**
- **/.hg* (eg. .hgignore)
- **/SCCS
- **/SCCS/**
- **/vssver.scc
- **/vssver2.scc
- **/_vti_cnf/**
- **/*~
- **/#*#
- **/.#*
- **/%*%
- **/CVS
- **/CVS/**
- **/.cvsignore
- **/._*
- **/.bzr
- **/.bzr/**
- **/.bzr* (eg. .bzrignore)
- **/.DS_Store
If you do not want these default excludes applied, you may disable them
by setting NAnt.Core.Types.FileSet.DefaultExcludes
to false
.
Attributes
Type | Description |
---|---|
Serializable |
|
ElementNameAttribute | Indicates that class should be treated as a NAnt element. |
Constructors
Name | Summary |
---|---|
FileSet |
Initializes a new instance of the NAnt.Core.Types.FileSet class.
|
FileSet |
copy constructor |
Properties
Name | Value | Summary |
---|---|---|
AsIs | StringCollection |
Gets the collection of files that will be added to the
NAnt.Core.Types.FileSet without pattern matching or checking if the
file exists.
|
BaseDirectory | DirectoryInfo |
The base of the directory of this fileset. The default is the project
base directory.
|
CanBeReferenced | bool |
Gets a value indicating whether a reference to the type can be
defined.
Inherited from DataTypeBase
|
CaseSensitive | bool |
Indicates whether include and exclude patterns must be treated in a
case-sensitive way. The default is
true on Unix;
otherwise, false .
|
CustomXmlProcessing | bool |
Gets a value indicating whether the element is performing additional
processing using the
NAnt.Core.Element.XmlNode that was used to
initialize the element.
Inherited from Element
|
DefaultExcludes | bool |
Indicates whether default excludes should be used or not.
The default is
true .
|
DirectoryNames | StringCollection |
Gets the collection of directory names that match the fileset.
|
Excluded |
StringCollection |
Gets the collection of excluded directory names that match the fileset.
|
ExcludedFileNames | StringCollection |
Gets the collection of excluded file names that match the fileset.
|
ExcludeElements | FileSet |
The items to exclude from the fileset.
|
Excludes | StringCollection |
Gets the collection of exclude patterns.
|
ExcludesFiles | FileSet |
The files from which a list of patterns or files to exclude should
be obtained.
|
FailOnEmpty | bool |
When set to
true , causes the fileset element to
throw a NAnt.Core.ValidationException when no files match the
includes and excludes criteria. The default is false .
|
FileNames | StringCollection |
Gets the collection of file names that match the fileset.
|
HasEmptyDirectories | bool |
Gets a value indicating whether this instance contains empty directories.
|
ID | string |
The ID used to be referenced later.
Inherited from DataTypeBase
|
IncludeElements | FileSet |
The items to include in the fileset.
|
Includes | StringCollection |
Gets the collection of include patterns.
|
IncludesFiles | FileSet |
The files from which a list of patterns or files to include should
be obtained.
|
IsEverythingIncluded | bool |
Gets a value indicating whether this instance retrieved all
files/directories scanned and nothing was excluded.
|
Location | Location |
Gets or sets the location in the build file where the element is
defined.
Inherited from Element
|
Most |
FileInfo |
Determines the most recently modified file in the fileset (by LastWriteTime of the
System.IO.FileInfo ).
|
Name | string |
Gets the name of the data type.
Inherited from DataTypeBase
|
NamespaceManager | XmlNamespaceManager |
Gets or sets the
System.Xml.XmlNamespaceManager .
Inherited from Element
|
Parent | Object |
Gets or sets the parent of the element.
Inherited from Element
|
PathFiles | PathScanner | |
Project | Project |
Gets or sets the
NAnt.Core.Element.Project to which this element belongs.
Inherited from Element
|
Properties | PropertyDictionary |
Gets the properties local to this
NAnt.Core.Element and the
NAnt.Core.Element.Project .
Inherited from Element
|
RefID | string |
The ID to use as the reference.
Inherited from DataTypeBase
|
ScannedDirectories | StringCollection |
Gets the collection of directory names that were scanned for files.
|
SetExcludes | FileSet |
The items to exclude from the fileset.
|
SetIncludes | FileSet |
The items to include in the fileset.
|
SetIncludesList | FileSet |
The files from which a list of patterns or files to include should
be obtained.
|
XmlNode | XmlNode |
Gets or sets the XML node of the element.
Inherited from Element
|
Methods
Name | Value | Summary |
---|---|---|
AddPatternSet |
void |
Adds a nested set of patterns, or references a standalone patternset.
|
Clone |
Object |
Creates a shallow copy of the
NAnt.Core.Types.FileSet .
|
CopyTo |
void |
Copies all instance data of the
NAnt.Core.DataTypeBase to a given
NAnt.Core.DataTypeBase .
Inherited from DataTypeBase
|
CopyTo |
void |
Copies all instance data of the
NAnt.Core.Element to a given
NAnt.Core.Element .
Inherited from Element
|
CopyTo |
void |
Copies all instance data of the
NAnt.Core.Types.FileSet to a given
NAnt.Core.Types.FileSet .
|
Find |
string |
Determines if a file has a more recent last write time than the
given time, or no longer exists.
static
|
Find |
string |
Determines if one of the given files has a more recent last write
time than the given time. If one of the given files no longer exists,
the target will be considered out-of-date.
static
|
Get |
XmlNode |
Locates the XML node for the specified attribute in the project
configuration node.
Inherited from Element
|
Get |
XmlNode |
Inherited from Element
|
GetLocation |
Location |
Retrieves the location in the build file where the element is
defined.
Inherited from Element
|
Initialize |
void |
Derived classes should override to this method to provide extra
initialization and validation not covered by the base class.
|
Initialize |
void |
Performs default initialization.
Inherited from Element
|
Initialize |
Element |
Initializes the build element.
Inherited from Element
static
|
InitializeElement |
void |
Derived classes should override to this method to provide extra
initialization and validation not covered by the base class.
Inherited from Element
|
InitializeXml |
void |
Initializes all build attributes and child elements.
Inherited from Element
|
Log |
void |
Logs a message with the given priority.
Inherited from Element
|
Log |
void |
Logs a message with the given priority.
Inherited from Element
|
Reset |
void |
Should be overridden by derived classes. clones the referenced types
data into the current instance.
|
Scan |
void | |
ToString |
string |
See Also
- NAnt.Core.Types.PatternSet