Selectors are a specific subset of Phing data types
that allow you to
fine-tune matching in a Appendix D, Core TypesFileSet (or DirSet).
Phing supports the following core selectors, which typically match on both files and
directories in a <fileset>
:
<Contains> - Select files that contain a specific string
<Readable> - Select files if they are readable
<Writable> - Select files if they are writable
<Executable> - Select files if they are executable
<date> - Select files/directories that have been modified either before or after a specific date/time
<Depend> - Select files/directories that have been modified more recently than equivalent items elsewhere
<Depth> - Select files/directories that appear at a specific depth in a directory tree
<Different> - Select files that are different from those elsewhere
<Filename> - Select files/directories whose name matches a particular pattern. Equivalent to the include and exclude elements of a patternset.
<Present> - Select files/directories that either do or do not exist in some other location
<Symlink> - Select files if they are symlink.
<Containsregexp><containsregexp> - Select files that contain text matching a regular expression
<Size><size> - Select files that are larger or smaller than a particular number of bytes.
<Type><type> - Select files/directories by type ('file' or 'dir')
Additionally, to create more complex selections, a variety of selectors that contain other selectors are available for your use. They combine the selections of their child selectors in various ways.
Phing supports the following selector containers:
<And><and> - Select a file only if all the contained selectors select it.
<Majority><majority> - Select a file only if all the contained selectors select it.
<None><none> - Select a file only if none of the contained selectors select it.
<Not><not> - Can contain only one selector, and reverses what it selects and doesn't select.
<Or><or> - Select a file if any one of the contained selectors selects it.
<Selector><selector> - Contains only one selector and
forwards all requests to it without alteration. This is the selector to use if you
want to define a reference. It is usable as an element of
<project>
.
The <contains>
tag selects files that contain the string
specified by the text
attribute.
<fileset dir="${src}" includes="**/*.php"> <contains text="PHP"/> </fileset>
Table G.1: Attributes for the <contains>
selector
Name | Description | Default | Required |
---|---|---|---|
text | Specifies the text that every file must contain | n/a | Yes |
casesensitive | Whether to pay attention to case when looking for the string in the text attribute. | true | No |
ignorewhitespace | Whether to eliminate whitespace before checking for the string in the text attribute. | false | No |