ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erik Hatcher" <jakarta-...@ehatchersolutions.com>
Subject Re: Selector examples
Date Wed, 01 May 2002 17:23:47 GMT
More selector questions:

They cannot be pre-defined and applied to multiple <fileset>'s, can they?
It doesn't appear this was taken into account though.

It would have been nice if this functionality was available for 1.5, but I'm
guessing thats not a possibility at this point.  We can re-use <patternset>
across multiple <fileset>'s though, so it will be confusing that selectors
are locked into a single fileset.

    Erik


----- Original Message -----
From: "Bruce Atherton" <bruce@callenish.com>
To: "Ant Developers List" <ant-dev@jakarta.apache.org>
Sent: Tuesday, April 30, 2002 9:41 PM
Subject: Re: Selector examples


> At 07:17 PM 4/30/2002 -0400, you wrote:
> >Could you provide, just briefly and quickly, some examples of the
selector
> >usage that you have been playing with?
>
> Sure thing. I'll describe each of the selectors here, and you can also
look
> at the build.xml file I attached to my last message to see some of them in
> use. That file downloads the Ant 1.4.1 tarball and unpacks it, makes a few
> changes so that the selectors have something to play with, and then runs
> each of the static selectors in turn.
>
> Here is a description of each of the selectors so far. The selectors are
> used inside <fileset> or in other selectors that act as containers. The
> containers are:
>
>      <and> - only select a file if it is selected by all the selectors in
> this container
>      <or> - select a file if any of the selectors in this container select
it
>      <not> - selected files become not selected, and vice versa. This can
> contains only a single selector
>      <none> - select a file if none of the contained selectors select it
>      <majority> - this selects a file if the majority of its contained
> selectors select it. It is here to make people aware they can go beyond
> boolean thinking.
>
> The noncontainer selectors that are provided, which I am calling static
> selectors, are:
>
>      <filenameselect> - selects files based on name attribute, just like
> include. And to emulate exclude, it has a negate attribute as well
>      <depthselect> - selects files based on directory depth, using min and
> max attribute
>      <sizeselect> - selects files based on their size. Attributes are
size,
> units (K, M, as well as Ki for 2^10), and when (less, more, equal)
>      <dateselect> - selects files based on the date of their last
> modification. Attributes are millis, datetime, when (before, after,
equal),
> and checkdirs
>      <presentselect> - selects files based on whether they exist or not in
> another directory tree. Attributes are targetdir and present (srcdir,
> both). It can contain a mapper element to map the files
>      <dependselect> - selects files if they are newer than ones in another
> directory tree. Attributes are targetdir and granularity. It also can
> contain a mapper element
>      <containsselect> - selects files that contain a string. Attributes
are
> contains and casesensitive
>
> There is also a special selector, <extendselect>, with which users can
> include their own selectors. It uses the <param> element code from
filters.
> It has attributes for classname, classpath, and classpathref. Static
> selectors can be called from extendselect unless they have their own
elements.
>
> Here are a couple of examples. To get all the files which contain the
> "<html>" tag that are bigger than 5,000 bytes, put this fileset in your
task:
>
>    <fileset dir="jakarta-ant" includeEmptyDirs="true">
>      <and>
>        <containsselect contains="<html>" casesensitive="false"/>
>        <sizeselect size="5" units="K" when="more"/>
>      </and>
>    </fileset>
>
> To get a list of all the files which are unchanged since Ant 1.4.1, use
this:
>
>    <fileset dir="jakarta-ant" includeEmptyDirs="true">
>      <or>
>        <dateselect datetime="10/11/2001 6:59 AM" when="before"/>
>        <dateselect datetime="10/11/2001 6:59 AM" when="equal"/>
>      </or>
>    </fileset>
>
> Hope that is clearer.
>
>
>
> --
> To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message