ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r799705 - in /ant/sandbox/antlibs/compress/trunk/src: main/org/apache/ant/compress/ main/org/apache/ant/compress/taskdefs/ tests/antunit/ tests/resources/
Date Fri, 31 Jul 2009 19:15:44 GMT
Author: bodewig
Date: Fri Jul 31 19:15:44 2009
New Revision: 799705

URL: http://svn.apache.org/viewvc?rev=799705&view=rev
Log:
minimal unzip task

Added:
    ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Unzip.java
      - copied, changed from r799691, ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Untar.java
    ant/sandbox/antlibs/compress/trunk/src/tests/antunit/unzip-test.xml   (contents, props
changed)
      - copied, changed from r799691, ant/sandbox/antlibs/compress/trunk/src/tests/antunit/untar-test.xml
    ant/sandbox/antlibs/compress/trunk/src/tests/resources/asf-logo.gif.zip   (props changed)
      - copied unchanged from r799678, ant/core/trunk/src/etc/testcases/taskdefs/expected/asf-logo.gif.zip
Modified:
    ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml
    ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Untar.java

Modified: ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml
URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml?rev=799705&r1=799704&r2=799705&view=diff
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml (original)
+++ ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml Fri Jul
31 19:15:44 2009
@@ -28,4 +28,8 @@
     name="untar"
     classname="org.apache.ant.compress.taskdefs.Untar"
     />
+  <taskdef
+    name="unzip"
+    classname="org.apache.ant.compress.taskdefs.Unzip"
+    />
 </antlib>

Modified: ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Untar.java
URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Untar.java?rev=799705&r1=799704&r2=799705&view=diff
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Untar.java
(original)
+++ ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Untar.java
Fri Jul 31 19:15:44 2009
@@ -37,7 +37,6 @@
     }
 
     protected Date getLastModified(ArchiveEntry entry) {
-        /* TODO - revisit */
         return ((TarArchiveEntry) entry).getModTime();
     }
 

Copied: ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Unzip.java
(from r799691, ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Untar.java)
URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Unzip.java?p2=ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Unzip.java&p1=ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Untar.java&r1=799691&r2=799705&rev=799705&view=diff
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Untar.java
(original)
+++ ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Unzip.java
Fri Jul 31 19:15:44 2009
@@ -24,21 +24,20 @@
 
 import org.apache.commons.compress.archivers.ArchiveEntry;
 import org.apache.commons.compress.archivers.ArchiveInputStream;
-import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
-import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
+import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
+import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream;
 
 /**
- * Untar a file.
+ * Unzip a file.
  */
-public class Untar extends ExpandBase {
+public class Unzip extends ExpandBase {
     protected ArchiveInputStream getArchiveStream(InputStream is)
         throws IOException {
-        return new TarArchiveInputStream(is);
+        return new ZipArchiveInputStream(is);
     }
 
     protected Date getLastModified(ArchiveEntry entry) {
-        /* TODO - revisit */
-        return ((TarArchiveEntry) entry).getModTime();
+        return new Date(((ZipArchiveEntry) entry).getTime());
     }
 
 }

Copied: ant/sandbox/antlibs/compress/trunk/src/tests/antunit/unzip-test.xml (from r799691,
ant/sandbox/antlibs/compress/trunk/src/tests/antunit/untar-test.xml)
URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/tests/antunit/unzip-test.xml?p2=ant/sandbox/antlibs/compress/trunk/src/tests/antunit/unzip-test.xml&p1=ant/sandbox/antlibs/compress/trunk/src/tests/antunit/untar-test.xml&r1=799691&r2=799705&rev=799705&view=diff
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/src/tests/antunit/untar-test.xml (original)
+++ ant/sandbox/antlibs/compress/trunk/src/tests/antunit/unzip-test.xml Fri Jul 31 19:15:44
2009
@@ -26,11 +26,11 @@
     <mkdir dir="${input}"/>
   </target>
 
-  <target name="testAgainstCoreTarTask" depends="setUp">
-    <tar destfile="${input}/test.tar">
+  <target name="testAgainstCoreZipTask" depends="setUp">
+    <zip destfile="${input}/test.zip">
       <fileset dir="."/>
-    </tar>
-    <cmp:untar src="${input}/test.tar" dest="${output}"/>
+    </zip>
+    <cmp:unzip src="${input}/test.zip" dest="${output}"/>
     <au:assertFileExists file="${output}/untar-test.xml"/>
     <au:assertFilesMatch
        actual="${output}/untar-test.xml"
@@ -39,7 +39,7 @@
   </target>
 
   <target name="testAgainstNativeTar" depends="setUp">
-    <cmp:untar src="../resources/asf-logo.gif.tar" dest="${output}" />
+    <cmp:unzip src="../resources/asf-logo.gif.zip" dest="${output}" />
     <au:assertFileExists file="${output}/asf-logo.gif"/>
     <au:assertFilesMatch
        actual="${output}/asf-logo.gif"
@@ -49,13 +49,13 @@
 
   <target name="testResourceCollection" depends="setUp">
     <zip destfile="${input}/test.zip">
-      <fileset dir="../resources" includes="*.tar"/>
+      <fileset dir="../resources" includes="*.zip"/>
     </zip>
-    <cmp:untar dest="${output}">
+    <cmp:unzip dest="${output}">
       <zipfileset src="${input}/test.zip">
-        <include name="*.tar"/>
+        <include name="*.zip"/>
       </zipfileset>
-    </cmp:untar>
+    </cmp:unzip>
     <au:assertFileExists file="${output}/asf-logo.gif"/>
     <au:assertFilesMatch
        actual="${output}/asf-logo.gif"

Propchange: ant/sandbox/antlibs/compress/trunk/src/tests/antunit/unzip-test.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/sandbox/antlibs/compress/trunk/src/tests/antunit/unzip-test.xml
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: ant/sandbox/antlibs/compress/trunk/src/tests/resources/asf-logo.gif.zip
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: ant/sandbox/antlibs/compress/trunk/src/tests/resources/asf-logo.gif.zip
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



Mime
View raw message