You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2015/09/12 22:22:15 UTC

[2/2] ant git commit: Make really work with non-filesystem resources

Make <bunzip2> really work with non-filesystem resources


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/3c2ed137
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/3c2ed137
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/3c2ed137

Branch: refs/heads/master
Commit: 3c2ed1374f54be5918921d64304ca2c82ca06548
Parents: 7f0eeea
Author: Stefan Bodewig <bo...@apache.org>
Authored: Sat Sep 12 22:21:49 2015 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Sat Sep 12 22:21:49 2015 +0200

----------------------------------------------------------------------
 .../org/apache/tools/ant/taskdefs/BUnzip2.java  |  4 +--
 src/tests/antunit/taskdefs/bunzip2-test.xml     | 26 ++++++++++++++++++--
 2 files changed, 26 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/3c2ed137/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java b/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java
index 323b738..e4a7995 100644
--- a/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java
+++ b/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java
@@ -56,8 +56,8 @@ public class BUnzip2 extends Unpack {
      * Do the unbzipping.
      */
     protected void extract() {
-        if (source.lastModified() > dest.lastModified()) {
-            log("Expanding " + source.getAbsolutePath() + " to "
+        if (srcResource.getLastModified() > dest.lastModified()) {
+            log("Expanding " + srcResource.getName() + " to "
                 + dest.getAbsolutePath());
 
             FileOutputStream out = null;

http://git-wip-us.apache.org/repos/asf/ant/blob/3c2ed137/src/tests/antunit/taskdefs/bunzip2-test.xml
----------------------------------------------------------------------
diff --git a/src/tests/antunit/taskdefs/bunzip2-test.xml b/src/tests/antunit/taskdefs/bunzip2-test.xml
index a9ca423..fcf05d9 100644
--- a/src/tests/antunit/taskdefs/bunzip2-test.xml
+++ b/src/tests/antunit/taskdefs/bunzip2-test.xml
@@ -18,11 +18,33 @@
 <project default="antunit" xmlns:au="antlib:org.apache.ant.antunit">
   <import file="../antunit-base.xml" />
 
-  <target name="testExpandArchiveWithMultipleStreams">
+  <target name="setup">
     <mkdir dir="${output}"/>
+  </target>
+
+  <target name="testExpandArchiveWithMultipleStreams" depends="setup">
     <bunzip2  src="bzip2/multiple.bz2" dest="${output}"/>
     <au:assertFilesMatch expected="bzip2/expected"
                          actual="${output}/multiple"/>
   </target>
 
-</project>
\ No newline at end of file
+  <target name="testWithNonFileResourceToFile" depends="setup">
+    <bunzip2 dest="${output}/greeting.txt">
+      <url url="http://ant.apache.org/webtest/bunzip2/greeting.txt.bz2"/>
+    </bunzip2>
+    <get src="http://ant.apache.org/webtest/gunzip/greeting.txt"
+         dest="${output}/orig.greeting.txt"/>
+    <au:assertFilesMatch expected="${output}/orig.greeting.txt"
+                         actual="${output}/greeting.txt"/>
+  </target>
+
+  <target name="testWithNonFileResourceToDir" depends="setup">
+    <bunzip2 dest="${output}">
+      <url url="http://ant.apache.org/webtest/bunzip2/greeting.txt.bz2"/>
+    </bunzip2>
+    <get src="http://ant.apache.org/webtest/gunzip/greeting.txt"
+         dest="${output}/orig.greeting.txt"/>
+    <au:assertFilesMatch expected="${output}/orig.greeting.txt"
+                         actual="${output}/greeting.txt"/>
+  </target>
+</project>