Browse Source

yes, mapperesources work inside <zip>

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@718263 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 17 years ago
parent
commit
c4b1f65a6e
2 changed files with 34 additions and 1 deletions
  1. +1
    -1
      src/main/org/apache/tools/ant/types/resources/MappedResource.java
  2. +33
    -0
      src/tests/antunit/taskdefs/zip-test.xml

+ 1
- 1
src/main/org/apache/tools/ant/types/resources/MappedResource.java View File

@@ -30,7 +30,7 @@ import org.apache.tools.ant.util.FileNameMapper;
* dynamically remap the resource's name.
*
* <p>Strips the FileProvider interface from decorated resources since
* it may be used to circomvent name mapping.</p>
* it may be used to circumvent name mapping.</p>
*
* <p>Overwrites all setters to throw exceptions.</p>
*


+ 33
- 0
src/tests/antunit/taskdefs/zip-test.xml View File

@@ -27,4 +27,37 @@
<unzip src="${output}/test.zip" dest="${output}/bar"/>
<au:assertFileExists file="${output}/bar/foo"/>
</target>

<target name="testMappedResources">
<mkdir dir="${input}"/>
<mkdir dir="${output}/out"/>
<echo file="${input}/foo.txt">Hello, world!</echo>
<zip destfile="${output}/test.zip">
<mappedresources>
<fileset dir="${input}"/>
<globmapper from="foo.*" to="bar.*"/>
</mappedresources>
</zip>
<unzip src="${output}/test.zip" dest="${output}/out"/>
<au:assertFileDoesntExist file="${output}/out/foo.txt"/>
<au:assertFileExists file="${output}/out/bar.txt"/>
<au:assertFilesMatch expected="${input}/foo.txt"
actual="${output}/out/bar.txt"/>
</target>

<target name="testMappedClasspath">
<mkdir dir="${input}"/>
<mkdir dir="${output}/out"/>
<zip destfile="${output}/test.zip">
<mappedresources>
<path path="${java.class.path}"/>
<chainedmapper>
<flattenmapper/>
<globmapper from="*" to="WEB-INF/lib/*"/>
</chainedmapper>
</mappedresources>
</zip>
<unzip src="${output}/test.zip" dest="${output}/out"/>
<au:assertFileExists file="${output}/out/WEB-INF/lib/ant.jar"/>
</target>
</project>

Loading…
Cancel
Save