git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1151386 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -70,6 +70,9 @@ Fixed bugs: | |||||
| * <sync> only supported a single non-fileset resource collection even | * <sync> only supported a single non-fileset resource collection even | ||||
| though the manual said it could be multiple. | though the manual said it could be multiple. | ||||
| * <sync> didn't work properly when working on resource collections. | |||||
| Bugzilla Report 51462. | |||||
| Other changes: | Other changes: | ||||
| -------------- | -------------- | ||||
| @@ -487,13 +487,10 @@ public class Sync extends Task { | |||||
| protected Map scan(Resource[] resources, File toDir) { | protected Map scan(Resource[] resources, File toDir) { | ||||
| assertTrue("No mapper", mapperElement == null); | assertTrue("No mapper", mapperElement == null); | ||||
| Map m = super.scan(resources, toDir); | |||||
| Iterator iter = m.keySet().iterator(); | |||||
| while (iter.hasNext()) { | |||||
| nonOrphans.add(((Resource) iter.next()).getName()); | |||||
| for (int i = 0; i < resources.length; i++) { | |||||
| nonOrphans.add(resources[i].getName()); | |||||
| } | } | ||||
| return m; | |||||
| return super.scan(resources, toDir); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -151,4 +151,25 @@ | |||||
| </sync> | </sync> | ||||
| </target> | </target> | ||||
| <target name="testSyncWithResources" depends="setUp" | |||||
| description="https://issues.apache.org/bugzilla/show_bug.cgi?id=51462"> | |||||
| <sync todir="${output}"> | |||||
| <mappedresources> | |||||
| <fileset dir="${input}"/> | |||||
| <globmapper from="*" to="test/*"/> | |||||
| </mappedresources> | |||||
| </sync> | |||||
| <au:assertFileDoesntExist file="${output}/bar.txt"/> | |||||
| <au:assertFileExists file="${output}/test/a/foo.txt"/> | |||||
| <sync todir="${output}"> | |||||
| <mappedresources> | |||||
| <fileset dir="${input}"/> | |||||
| <globmapper from="*" to="test/*"/> | |||||
| </mappedresources> | |||||
| </sync> | |||||
| <au:assertFileDoesntExist file="${output}/bar.txt"/> | |||||
| <au:assertFileExists file="${output}/test/a/foo.txt"/> | |||||
| </target> | |||||
| </project> | </project> | ||||