ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <dona...@apache.org>
Subject Re: [PATCH] 'Contains' element for Include and Exclude
Date Tue, 16 Oct 2001 09:38:09 GMT
Hi,

while it is probably useful functionality I can't see it making it into ant 
at this stage because it is not general enough. It essentially is one 
particular case of "selection" (term I defined in other mail) and the use 
case is not even broad. 

Other people have asked for selection on criterion such as files date, 
readability etc which are all more general purpose but have been knocked 
back. There was even a general purpose culler proposal that is probably more 
appropriate (though I like name selector now). 

This functionality will be in Ant2 which we will take a shot at again after 
Stefan gets back. Until then I would recomend a task that creates the set of 
files separately from regular filesets.

On Tue, 16 Oct 2001 08:32, Magesh Umasankar wrote:
> This patch provides the following feature:
> 
> * The include and exclude elements allows inclusion of 
>   zero or more 'contains' elements.
> * The contains element takes in 2 attributes:
>     o text
>     o ignorecase
> * the text attribute defines the text to be searched 
>   for in the file(s).
> * the ignorecase attribute specifies if the search is to 
>   be performed in a case-sensitive manner.
> * If a Regular Expression Matcher is defined, the text 
>   attribute is treated as a regular expression, 
>   otherwise, it is treated as plain text.  When using a 
>   regular expression, it is possible to also include 
>   files that do not contain a specific pattern.
> 
>   
> Example:
> 
> <property name="ant.regexp.matcherimpl" 
>     value="org.apache.tools.ant.util.regexp.JakartaOroMatcher"/>
> ...
> <copy todir="/tmp">
>   <fileset dir=".">
>     <patternset id="foo">
>       <!-- 
>           Include xml files that contain the text foo and ABC and
>           does not contain the text bar (case doesn't matter) 
>       -->
>       <include name="**/*.xml">
>         <contains text="foo"/>
>         <contains text="^bar" ignorecase="yes"/>
>         <contains text="ABC"/>
>       </include>
>       <exclude name="**/Test*.xml>
>         <contains text="[0-9]foobar*" ignorecase="no"/>
>       </include>
>     </patternset>
>   </fileset>
> </copy>
> 
> This patch does not break backwards compatibility.
> 
> Please consider adding this feature for Ant 1.5.
> 
> Thanks,
> Magesh

-- 
Cheers,

Pete

Frank Zappa observed: "It's not getting any smarter out
                       there.You have to come to terms with
                       stupidity, and make it work for you."

Mime
View raw message