git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@278063 13f79535-47bb-0310-9956-ffa450edef68master
@@ -214,7 +214,7 @@ Other changes: | |||||
* added casesensitive attribute to <globmapper> and <regexpmapper> | * added casesensitive attribute to <globmapper> and <regexpmapper> | ||||
Bugzilla report 16686 | Bugzilla report 16686 | ||||
* added handledirchar attribute to <globmapper> and <regexpmapper> | |||||
* added handledirsep attribute to <globmapper> and <regexpmapper> | |||||
Bugzilla report 32487 | Bugzilla report 32487 | ||||
* added a new mapper <filtermapper> | * added a new mapper <filtermapper> | ||||
@@ -70,7 +70,7 @@ directory separator of your current platform. If you need to specify | |||||
this separator, use <code>${file.separator}</code> instead. | this separator, use <code>${file.separator}</code> instead. | ||||
For the regexpmapper, <code>${file.separator}</code> will not work, | For the regexpmapper, <code>${file.separator}</code> will not work, | ||||
as on windows it is the '\' character, and this is an escape character | as on windows it is the '\' character, and this is an escape character | ||||
for regular expressions, one should use the <code>handledirchar</code> attribute | |||||
for regular expressions, one should use the <code>handledirsep</code> attribute | |||||
instead. | instead. | ||||
</p> | </p> | ||||
<h3>Parameters specified as nested elements</h3> | <h3>Parameters specified as nested elements</h3> | ||||
@@ -264,7 +264,7 @@ that don't match the <code>from</code> pattern will be ignored.</p> | |||||
<td align="center" valign="top">No</td> | <td align="center" valign="top">No</td> | ||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
<td valign="top">handledirchar</td> | |||||
<td valign="top">handledirsep</td> | |||||
<td valign="top"> | <td valign="top"> | ||||
If this is specified, the mapper will ignore the difference between the normal | If this is specified, the mapper will ignore the difference between the normal | ||||
directory separator characters - \ and /. | directory separator characters - \ and /. | ||||
@@ -479,7 +479,7 @@ jakarta-ORO and finally try jakarta-regexp.</li> | |||||
<td align="center" valign="top">No</td> | <td align="center" valign="top">No</td> | ||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
<td valign="top">handledirchar</td> | |||||
<td valign="top">handledirsep</td> | |||||
<td valign="top"> | <td valign="top"> | ||||
If this is specified, the mapper will treat a \ character in a filename | If this is specified, the mapper will treat a \ character in a filename | ||||
as a / for the purposes of matching. | as a / for the purposes of matching. | ||||
@@ -512,7 +512,7 @@ jakarta-ORO and finally try jakarta-regexp.</li> | |||||
<pathconvert property="hd.prop" targetos="windows"> | <pathconvert property="hd.prop" targetos="windows"> | ||||
<path path="d\e/f\j.java"/> | <path path="d\e/f\j.java"/> | ||||
<chainedmapper> | <chainedmapper> | ||||
<regexpmapper from="${basedir}/d/e/(.*)" to="\1" handledirchar="yes"/> | |||||
<regexpmapper from="${basedir}/d/e/(.*)" to="\1" handledirsep="yes"/> | |||||
</chainedmapper> | </chainedmapper> | ||||
</pathconvert> | </pathconvert> | ||||
</pre> | </pre> | ||||
@@ -1,9 +1,9 @@ | |||||
<project> | <project> | ||||
<import file="define.mapperresult.xml"/> | <import file="define.mapperresult.xml"/> | ||||
<target name="handle.dirchar"> | |||||
<target name="handle.dirsep"> | |||||
<mapperresult input="d\e/f/j.java" output="f/j.java"> | <mapperresult input="d\e/f/j.java" output="f/j.java"> | ||||
<globmapper from="d/e\*" to="*" handledirchar="yes"/> | |||||
<globmapper from="d/e\*" to="*" handledirsep="yes"/> | |||||
</mapperresult> | </mapperresult> | ||||
</target> | </target> | ||||
@@ -7,9 +7,9 @@ | |||||
</mapperresult> | </mapperresult> | ||||
</target> | </target> | ||||
<target name="handle.dirchar"> | |||||
<target name="handle.dirsep"> | |||||
<mapperresult input="d\e/f\j.java" output="f/j.java"> | <mapperresult input="d\e/f\j.java" output="f/j.java"> | ||||
<regexpmapper from="d/e/(.*)" to="\1" handledirchar="yes"/> | |||||
<regexpmapper from="d/e/(.*)" to="\1" handledirsep="yes"/> | |||||
</mapperresult> | </mapperresult> | ||||
</target> | </target> | ||||
</project> | </project> |
@@ -62,17 +62,17 @@ public class GlobPatternMapper implements FileNameMapper { | |||||
*/ | */ | ||||
protected String toPostfix = null; | protected String toPostfix = null; | ||||
private boolean handleDirChar = false; | |||||
private boolean handleDirSep = false; | |||||
private boolean caseSensitive = true; | private boolean caseSensitive = true; | ||||
/** | /** | ||||
* Attribute specifing whether to ignore the difference | * Attribute specifing whether to ignore the difference | ||||
* between / and \ (the two common directory characters). | * between / and \ (the two common directory characters). | ||||
* @param handleDirChar a boolean, default is false. | |||||
* @param handleDirSep a boolean, default is false. | |||||
* @since Ant 1.6.3 | * @since Ant 1.6.3 | ||||
*/ | */ | ||||
public void setHandleDirChar(boolean handleDirChar) { | |||||
this.handleDirChar = handleDirChar; | |||||
public void setHandleDirSep(boolean handleDirSep) { | |||||
this.handleDirSep = handleDirSep; | |||||
} | } | ||||
/** | /** | ||||
@@ -156,7 +156,7 @@ public class GlobPatternMapper implements FileNameMapper { | |||||
if (!caseSensitive) { | if (!caseSensitive) { | ||||
name = name.toLowerCase(); | name = name.toLowerCase(); | ||||
} | } | ||||
if (handleDirChar) { | |||||
if (handleDirSep) { | |||||
if (name.indexOf('\\') != -1) { | if (name.indexOf('\\') != -1) { | ||||
name = name.replace('\\', '/'); | name = name.replace('\\', '/'); | ||||
} | } | ||||
@@ -40,17 +40,17 @@ public class RegexpPatternMapper implements FileNameMapper { | |||||
reg = (new RegexpMatcherFactory()).newRegexpMatcher(); | reg = (new RegexpMatcherFactory()).newRegexpMatcher(); | ||||
} | } | ||||
private boolean handleDirChar = false; | |||||
private boolean handleDirSep = false; | |||||
private int regexpOptions = 0; | private int regexpOptions = 0; | ||||
/** | /** | ||||
* Attribute specifing whether to ignore the difference | * Attribute specifing whether to ignore the difference | ||||
* between / and \ (the two common directory characters). | * between / and \ (the two common directory characters). | ||||
* @param handleDirChar a boolean, default is false. | |||||
* @param handleDirSep a boolean, default is false. | |||||
* @since Ant 1.6.3 | * @since Ant 1.6.3 | ||||
*/ | */ | ||||
public void setHandleDirChar(boolean handleDirChar) { | |||||
this.handleDirChar = handleDirChar; | |||||
public void setHandleDirSep(boolean handleDirSep) { | |||||
this.handleDirSep = handleDirSep; | |||||
} | } | ||||
/** | /** | ||||
@@ -102,7 +102,7 @@ public class RegexpPatternMapper implements FileNameMapper { | |||||
* null if the to pattern did not match | * null if the to pattern did not match | ||||
*/ | */ | ||||
public String[] mapFileName(String sourceFileName) { | public String[] mapFileName(String sourceFileName) { | ||||
if (handleDirChar) { | |||||
if (handleDirSep) { | |||||
if (sourceFileName.indexOf("\\") != -1) { | if (sourceFileName.indexOf("\\") != -1) { | ||||
sourceFileName = sourceFileName.replace('\\', '/'); | sourceFileName = sourceFileName.replace('\\', '/'); | ||||
} | } | ||||
@@ -34,8 +34,8 @@ public class GlobMapperTest extends BuildFileTest { | |||||
public void testIgnoreCase() { | public void testIgnoreCase() { | ||||
executeTarget("ignore.case"); | executeTarget("ignore.case"); | ||||
} | } | ||||
public void testHandleDirChar() { | |||||
executeTarget("handle.dirchar"); | |||||
public void testHandleDirSep() { | |||||
executeTarget("handle.dirsep"); | |||||
} | } | ||||
} | } | ||||
@@ -34,8 +34,8 @@ public class RegexpPatternMapperTest extends BuildFileTest { | |||||
public void testIgnoreCase() { | public void testIgnoreCase() { | ||||
executeTarget("ignore.case"); | executeTarget("ignore.case"); | ||||
} | } | ||||
public void testHandleDirChar() { | |||||
executeTarget("handle.dirchar"); | |||||
public void testHandleDirSep() { | |||||
executeTarget("handle.dirsep"); | |||||
} | } | ||||
} | } | ||||