peterreilly 2004/12/17 06:18:31 Modified: docs/manual/CoreTypes mapper.html Log: doc for extra attributes for <globmapper>, <regexpmapper> doc for <filtermapper> 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 @@ <td valign="top"><code>Qlasses/dir/dir2/A.property</code></td> </tr> </table> + <p> + The globmapper mapper can take the following extra attributes. + </p> + <table border="1" cellpadding="2" cellspacing="0"> + <tr> + <td valign="top"><b>Attribute</b></td> + <td valign="top"><b>Description</b></td> + <td align="center" valign="top"><b>Required</b></td> + </tr> + <tr> + <td valign="top">casesensitice</td> + <td valign="top"> + 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. + <em>Since ant 1.6.3.</em> + </td> + <td align="center" valign="top">No</td> + </tr> + <tr> + <td valign="top">handledirchar</td> + <td valign="top"> + 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. + <em>Since ant 1.6.3.</em> + <td align="center" valign="top">No</td> + </tr> + </table> + <p> + An example: + </p> + <pre> + <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> + </pre> + <p> + will output "x is j.java.bak". + </p> + <p> + and + </p> + <pre> + <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> + </pre> + <p> + will output "x is f/j.java". + </p> + <h4><a name="regexp-mapper">regexp</a></h4> <p>Both <code>to</code> and <code>from</code> define regular expressions. If the source file name matches the <code>from</code> @@ -254,7 +317,7 @@ <p>The regexp mapper needs a supporting library and an implementation of <code>org.apache.tools.ant.util.regexp.RegexpMatcher</code> that hides the specifics of the library. Ant comes with implementations for -<a href="http://java.sun.com/j2se/1.4/docs/api/java/util/regex/package-summary.html" target="_top">the java.util.regex package of JDK 1.4</a>, +<a href="http://java.sun.com/j2se/1.4/docs/api/java/util/regex/package-summary.html" target="_top">the java.util.regex package of JDK 1.4 or higher</a>, <a href="http://jakarta.apache.org/regexp/" target="_top">jakarta-regexp</a> and <a href="http://jakarta.apache.org/oro/" target="_top">jakarta-ORO</a>. 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</a> with Ant, see <a href="http://marc.theaimsgroup.com/?l=ant-dev&m=97550753813481&w=2" target="_top">this</a> article.</p> -<p>This means, you need <code>optional.jar</code> from the Ant release -you are using <strong>and</strong> one of the supported regular -expression libraries. Make sure, both will be loaded from the same +<p>This means, you need one of the supported regular expression + libraries <strong>and</strong> + the corresponding <code>ant-[jakarta-oro, jakarta-regexp, apache-oro, apache-regexp}.jar</code> +from the Ant release you are using. +Make sure, both will be loaded from the same classpath, that is either put them into your <code>CLASSPATH</code>, <code>ANT_HOME/lib</code> directory or a nested <code><classpath></code> element of the mapper - you cannot have -<code>optional.jar</code> in <code>ANT_HOME/lib</code> and the library +<code>ant-[jakarta-oro, jakarta-regexp, apache-oro, apache-regexp].jar</code> in <code>ANT_HOME/lib</code> + and the library in a nested <code><classpath></code>.</p> <p>Ant will choose the regular-expression library based on the following algorithm:</p> @@ -337,8 +403,8 @@ </tr> </table> <blockquote><pre> -<mapper type="regexp" from="^(.*)\.(.*)$$" to="\2.\1"/> -<regexpmapper from="^(.*)\.(.*)$$" to="\2.\1"/> +<mapper type="regexp" from="^(.*)\.(.*)$$" to="\2.\1"/> +<regexpmapper from="^(.*)\.(.*)$$&" to="\2.\1"/> </pre></blockquote> <table border="1" cellpadding="2" cellspacing="0"> <tr> @@ -363,8 +429,8 @@ </tr> </table> <blockquote><pre> -<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"/> </pre></blockquote> <table border="1" cellpadding="2" cellspacing="0"> <tr> @@ -388,7 +454,65 @@ <td valign="top"><code>java/lang/ClassLoader.java</code></td> </tr> </table> - + <p> + The regexpmapper mapper can take the following extra attributes. + </p> + <table border="1" cellpadding="2" cellspacing="0"> + <tr> + <td valign="top"><b>Attribute</b></td> + <td valign="top"><b>Description</b></td> + <td align="center" valign="top"><b>Required</b></td> + </tr> + <tr> + <td valign="top">casesensitive</td> + <td valign="top"> + If this is false, the mapper will ignore case when matching the pattern. + This attribute can be true or false, the default is true. + <em>Since ant 1.6.3.</em> + </td> + <td align="center" valign="top">No</td> + </tr> + <tr> + <td valign="top">handledirchar</td> + <td valign="top"> + 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. + <em>Since ant 1.6.3.</em> + <td align="center" valign="top">No</td> + </tr> + </table> + <p> + An example: + </p> + <pre> + <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> + </pre> + <p> + will output "x is j.java.bak". + </p> + <p> + and + </p> + <pre> + <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> + </pre> + <p> + will set <code>hd.prop</code> to "f\j.java". + </p> <h4><a name="package-mapper">package</a></h4> <p>Sharing the same syntax as the <a href="#glob-mapper">glob mapper</a>, the package mapper replaces @@ -502,6 +626,55 @@ </tr> </table> <p>The chained mapper has no corresponding + <code><mapper <b>type</b>></code> attribute. + </p> + + <!-- --> + <!-- Filter Mapper --> + <!-- --> + +<h4><a name="filter-mapper">filtermapper (since ant 1.6.3)</a></h4> + <p> + This mapper implementation applies a <a href="filterchain.html">filterchain</a> + to the source file name. + </p> +<b>Examples:</b> +<blockquote><pre> +<filtermapper> + <replacestring from="\" to="/"/> +</filtermapper> +</pre></blockquote> + +<table border="1" cellpadding="2" cellspacing="0"> + <tr> + <td valign="top"><b>Source file name</b></td> + <td valign="top"><b>Target file names</b></td> + </tr> + <tr> + <td valign="center"><code>foo\bar\A.java</code></td> + <td valign="top"><code>foo/bar/A.java</code></td> + </tr> +</table> +<blockquote><pre> +<filtermapper> + <scriptfilter language="beanshell"> + self.setToken(self.getToken().toUpperCase()); + </scriptfilter> +</filtermapper> +</pre></blockquote> + +<table border="1" cellpadding="2" cellspacing="0"> + <tr> + <td valign="top"><b>Source file name</b></td> + <td valign="top"><b>Target file names</b></td> + </tr> + <tr> + <td valign="center"><code>foo\bar\A.java</code></td> + <td valign="top"><code>FOO\BAR\A.JAVA</code></td> + </tr> +</table> + + <p>The filtermapper has no corresponding <code><mapper <b>type</b>></code> attribute. </p> <hr>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]