ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Magesh Umasankar" <umag...@rediffmail.com>
Subject Re: [PATCH] 'Contains' element for Include and Exclude
Date Tue, 16 Oct 2001 03:18:52 GMT

This patch provides the following feature (a notcontains
element has been added since the previous submission.
So please ignore the earlier one):

* The include and exclude elements allows inclusion of 
  zero or more 'contains' and 'notcontains' elements.
* The contains and notcontains elements take 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"/>
        <notcontains 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

 

Mime
View raw message