ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Magesh Umasankar" <umag...@rediffmail.com>
Subject [PATCH] 'Contains' element for Include and Exclude
Date Mon, 15 Oct 2001 22:32:48 GMT

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
 

Mime
View raw message