Browse Source

don't automatically assume a to pattern contains a * in globmapper. PR 46506.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@733729 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 16 years ago
parent
commit
705993f911
4 changed files with 13 additions and 5 deletions
  1. +4
    -0
      WHATSNEW
  2. +1
    -1
      src/etc/testcases/taskdefs/pathconvert.xml
  3. +6
    -2
      src/main/org/apache/tools/ant/util/GlobPatternMapper.java
  4. +2
    -2
      src/tests/antunit/types/glob-test.xml

+ 4
- 0
WHATSNEW View File

@@ -322,6 +322,10 @@ Fixed bugs:
miss some files and directories in the presence of recursive
exclude patterns.

* globmapper didn't work properly if the "to" pattern didn't contain
a *.
Bugzilla Report 46506.

Other changes:
--------------



+ 1
- 1
src/etc/testcases/taskdefs/pathconvert.xml View File

@@ -31,7 +31,7 @@
<target name="testmapper">
<pathconvert property="result" dirsep="#">
<path refid="testpath" />
<mapper type="glob" from="${basedir}" to="test" />
<mapper type="glob" from="${basedir}" to="test*" />
</pathconvert>
</target>



+ 6
- 2
src/main/org/apache/tools/ant/util/GlobPatternMapper.java View File

@@ -68,6 +68,7 @@ public class GlobPatternMapper implements FileNameMapper {

// CheckStyle:VisibilityModifier ON

private boolean toContainsStar = false;
private boolean handleDirSep = false;
private boolean caseSensitive = true;

@@ -126,6 +127,7 @@ public class GlobPatternMapper implements FileNameMapper {
} else {
toPrefix = to.substring(0, index);
toPostfix = to.substring(index + 1);
toContainsStar = true;
}
} else {
throw new BuildException("this mapper requires a 'to' attribute");
@@ -148,8 +150,10 @@ public class GlobPatternMapper implements FileNameMapper {
return null;
}
return new String[] {toPrefix
+ extractVariablePart(sourceFileName)
+ toPostfix};
+ (toContainsStar
? extractVariablePart(sourceFileName)
+ toPostfix
: "")};
}

/**


+ 2
- 2
src/tests/antunit/types/glob-test.xml View File

@@ -47,7 +47,7 @@
<au:assertFileExists file="${output}/x.jar"/>
</target>

<target name="xtest-no-*-in-to" depends="setUp"
<target name="test-no-*-in-to" depends="setUp"
description="https://issues.apache.org/bugzilla/show_bug.cgi?id=46506">
<touch file="${input}/a-b.jar"/>
<copy todir="${output}">
@@ -58,7 +58,7 @@
<au:assertFileExists file="${output}/c.jar"/>
</target>

<target name="test-*-at-end-of" depends="setUp">
<target name="test-*-at-end-of-to" depends="setUp">
<touch file="${input}/a-b.jar"/>
<copy todir="${output}">
<fileset dir="${input}"/>


Loading…
Cancel
Save