Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 80937 invoked from network); 17 Dec 2004 14:20:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 17 Dec 2004 14:20:49 -0000 Received: (qmail 37937 invoked by uid 500); 17 Dec 2004 14:20:47 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 37870 invoked by uid 500); 17 Dec 2004 14:20:47 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 37856 invoked by uid 500); 17 Dec 2004 14:20:47 -0000 Received: (qmail 37852 invoked by uid 99); 17 Dec 2004 14:20:47 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Fri, 17 Dec 2004 06:18:48 -0800 Received: (qmail 79273 invoked by uid 1539); 17 Dec 2004 14:18:31 -0000 Date: 17 Dec 2004 14:18:31 -0000 Message-ID: <20041217141831.79272.qmail@minotaur.apache.org> From: peterreilly@apache.org To: ant-cvs@apache.org Subject: cvs commit: ant/docs/manual/CoreTypes mapper.html X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N peterreilly 2004/12/17 06:18:31 Modified: docs/manual/CoreTypes mapper.html Log: doc for extra attributes for , doc for remove reference to optional.jar PR: 32487, 16686, 28584 Revision Changes Path 1.20 +183 -10 ant/docs/manual/CoreTypes/mapper.html Index: mapper.html =================================================================== RCS file: /home/cvs/ant/docs/manual/CoreTypes/mapper.html,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- mapper.html 19 Nov 2004 09:07:10 -0000 1.19 +++ mapper.html 17 Dec 2004 14:18:31 -0000 1.20 @@ -239,6 +239,69 @@ Qlasses/dir/dir2/A.property +

+ The globmapper mapper can take the following extra attributes. +

+ + + + + + + + + + + + + + + +
AttributeDescriptionRequired
casesensitice + If this is false, the mapper will ignore case when matching the glob pattern. + This attribute can be true or false, the default is true. + Since ant 1.6.3. + No
handledirchar + If this is specified, the mapper will ignore the difference between the normal + directory separator characters - \ and /. + This attribute can be true or false, the default is false. + This attribute is useful for cross-platform build files. + Since ant 1.6.3. + No
+

+ An example: +

+
  +      <pathconvert property="x" targetos="unix">
  +        <path path="Aj.Java"/>
  +        <mapper>
  +        <chainedmapper>
  +          <flattenmapper/>
  +          <globmapper from="a*.java" to="*.java.bak" casesensitive="no"/>
  +        </chainedmapper>
  +        </mapper>
  +      </pathconvert>
  +      <echo>x is ${x}</echo>
  +    
+

+ will output "x is j.java.bak". +

+

+ and +

+
  +      <pathconvert property="x" targetos="unix">
  +        <path path="d/e/f/j.java"/>
  +        <mapper>
  +          <globmapper from="${basedir}\d/e\*" to="*" ignoredirchar="yes"/>
  +        </mapper>
  +      </pathconvert>
  +      <echo>x is ${x}</echo>
  +    
+

+ will output "x is f/j.java". +

+

regexp

Both to and from define regular expressions. If the source file name matches the from @@ -254,7 +317,7 @@

The regexp mapper needs a supporting library and an implementation of org.apache.tools.ant.util.regexp.RegexpMatcher that hides the specifics of the library. Ant comes with implementations for -the java.util.regex package of JDK 1.4, +the java.util.regex package of JDK 1.4 or higher, jakarta-regexp and jakarta-ORO. If you compile from sources and plan to use one of them, make sure the libraries are @@ -263,13 +326,16 @@ href="http://www.crocodile.org/~sts/Rex/" target="_top">gnu.rex with Ant, see this article.

-

This means, you need optional.jar from the Ant release -you are using and one of the supported regular -expression libraries. Make sure, both will be loaded from the same +

This means, you need one of the supported regular expression + libraries and + the corresponding ant-[jakarta-oro, jakarta-regexp, apache-oro, apache-regexp}.jar +from the Ant release you are using. +Make sure, both will be loaded from the same classpath, that is either put them into your CLASSPATH, ANT_HOME/lib directory or a nested <classpath> element of the mapper - you cannot have -optional.jar in ANT_HOME/lib and the library +ant-[jakarta-oro, jakarta-regexp, apache-oro, apache-regexp].jar in ANT_HOME/lib + and the library in a nested <classpath>.

Ant will choose the regular-expression library based on the following algorithm:

@@ -337,8 +403,8 @@
  -<mapper type="regexp" from="^(.*)\.(.*)$$" to="\2.\1"/>
  -<regexpmapper from="^(.*)\.(.*)$$" to="\2.\1"/>
  +<mapper type="regexp" from="^(.*)\.(.*)$$" to="\2.\1"/>
  +<regexpmapper from="^(.*)\.(.*)$$&" to="\2.\1"/>
   
@@ -363,8 +429,8 @@
  -<mapper type="regexp" from="^(.*?)(\$$[^/\\\.]*)?\.class$$" to="\1.java"/>
  -<regexpmapper from="^(.*?)(\$$[^/\\\.]*)?\.class$$" to="\1.java"/>
  +<mapper type="regexp" from="^(.*?)(\$$[^/\\\.]*)?\.class$$" to="\1.java"/>
  +<regexpmapper from="^(.*?)(\$$[^/\\\.]*)?\.class$$" to="\1.java"/>
   
@@ -388,7 +454,65 @@
java/lang/ClassLoader.java
- +

+ The regexpmapper mapper can take the following extra attributes. +

+ + + + + + + + + + + + + + + +
AttributeDescriptionRequired
casesensitive + If this is false, the mapper will ignore case when matching the pattern. + This attribute can be true or false, the default is true. + Since ant 1.6.3. + No
handledirchar + If this is specified, the mapper will treat a \ character in a filename + as a / for the purposes of matching. + This attribute can be true or false, the default is false. + This attribute is useful for cross-platform build files. + Since ant 1.6.3. + No
+

+ An example: +

+
  +      <pathconvert property="x" targetos="unix">
  +        <path path="Aj.Java"/>
  +        <chainedmapper>
  +          <flattenmapper/>
  +          <globmapper from="a(*.)java" to="\1.java.bak" casesensitive="no"/>
  +        </chainedmapper>
  +      </pathconvert>
  +      <echo>x is ${x}</echo>
  +    
+

+ will output "x is j.java.bak". +

+

+ and +

+
  +    <pathconvert property="hd.prop" targetos="windows">
  +      <path path="d\e/f\j.java"/>
  +      <chainedmapper>
  +        <regexpmapper from="${basedir}/d/e/(.*)" to="\1" handledirchar="yes"/>
  +      </chainedmapper>
  +    </pathconvert>
  +    
+

+ will set hd.prop to "f\j.java". +

package

Sharing the same syntax as the glob mapper, the package mapper replaces @@ -502,6 +626,55 @@

The chained mapper has no corresponding + <mapper type> attribute. +

+ + + + + +

filtermapper (since ant 1.6.3)

+

+ This mapper implementation applies a filterchain + to the source file name. +

+Examples: +
  +<filtermapper>
  +  <replacestring from="\" to="/"/>
  +</filtermapper>
  +
+ + + + + + + + + + +
Source file nameTarget file names
foo\bar\A.javafoo/bar/A.java
+
  +<filtermapper>
  +  <scriptfilter language="beanshell">
  +    self.setToken(self.getToken().toUpperCase());
  +  </scriptfilter>
  +</filtermapper>
  +
+ + + + + + + + + + +
Source file nameTarget file names
foo\bar\A.javaFOO\BAR\A.JAVA
+ +

The filtermapper has no corresponding <mapper type> attribute.


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