Browse Source

when working on resources <sync> forgot about the source resources that are not out-of date. PR 51462

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1151386 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 14 years ago
parent
commit
82642e35eb
3 changed files with 27 additions and 6 deletions
  1. +3
    -0
      WHATSNEW
  2. +3
    -6
      src/main/org/apache/tools/ant/taskdefs/Sync.java
  3. +21
    -0
      src/tests/antunit/taskdefs/sync-test.xml

+ 3
- 0
WHATSNEW View File

@@ -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:
-------------- --------------




+ 3
- 6
src/main/org/apache/tools/ant/taskdefs/Sync.java View File

@@ -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);
} }


/** /**


+ 21
- 0
src/tests/antunit/taskdefs/sync-test.xml View File

@@ -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>

Loading…
Cancel
Save