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 2017/05/08 08:06:35 UTC

[1/2] ant-antlibs-compress git commit: add support for writing Snappy without framing

Repository: ant-antlibs-compress
Updated Branches:
  refs/heads/compress-1.14 5de99d936 -> 35e432fcb


add support for writing Snappy without framing


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

Branch: refs/heads/compress-1.14
Commit: a46461e43f153af101caf3a8ac43edb3d9c2cb55
Parents: 5de99d9
Author: Stefan Bodewig <bo...@apache.org>
Authored: Mon May 8 10:02:54 2017 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Mon May 8 10:02:54 2017 +0200

----------------------------------------------------------------------
 docs/pack.html                                         |  7 +++++--
 .../org/apache/ant/compress/taskdefs/PackBase.java     |  7 +++++++
 src/main/org/apache/ant/compress/taskdefs/Snappy.java  | 13 +++++++++++++
 src/tests/antunit/unsnappy-test.xml                    | 11 +++++++++++
 4 files changed, 36 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/a46461e4/docs/pack.html
----------------------------------------------------------------------
diff --git a/docs/pack.html b/docs/pack.html
index 0a8700d..39e9b10 100644
--- a/docs/pack.html
+++ b/docs/pack.html
@@ -236,8 +236,11 @@
     <tr>
       <td valign="top">framed</td>
       <td valign="top">Whether to use
-      the <a href="https://github.com/google/snappy/blob/master/framing_format.txt">framing
-     format</a>.</td>
+        the <a href="https://github.com/google/snappy/blob/master/framing_format.txt">framing
+        format</a>.<br/>  When setting this to false only resources of
+        known (uncompressed) size can be compressed (for example
+        files).
+      </td>
       <td align="center" valign="top">No, defaults to true.</td>
     </tr>
   </table>

http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/a46461e4/src/main/org/apache/ant/compress/taskdefs/PackBase.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/taskdefs/PackBase.java b/src/main/org/apache/ant/compress/taskdefs/PackBase.java
index 9c5d6de..4f63b91 100644
--- a/src/main/org/apache/ant/compress/taskdefs/PackBase.java
+++ b/src/main/org/apache/ant/compress/taskdefs/PackBase.java
@@ -232,6 +232,13 @@ public abstract class PackBase extends Task {
         }
     }
 
+    /**
+     * @since Apache Compress Antlib 1.5
+     */
+    protected final Resource getSrc() {
+        return src;
+    }
+
     public static interface ResourceWrapper {
         CommonsCompressCompressorResource wrap(Resource dest);
     }

http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/a46461e4/src/main/org/apache/ant/compress/taskdefs/Snappy.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/taskdefs/Snappy.java b/src/main/org/apache/ant/compress/taskdefs/Snappy.java
index 76528e4..f41e2e8 100644
--- a/src/main/org/apache/ant/compress/taskdefs/Snappy.java
+++ b/src/main/org/apache/ant/compress/taskdefs/Snappy.java
@@ -18,9 +18,14 @@
 
 package org.apache.ant.compress.taskdefs;
 
+import java.io.IOException;
+import java.io.OutputStream;
+
 import org.apache.ant.compress.resources.SnappyResource;
 import org.apache.ant.compress.resources.CommonsCompressCompressorResource;
 import org.apache.ant.compress.util.SnappyStreamFactory;
+import org.apache.commons.compress.compressors.CompressorOutputStream;
+import org.apache.commons.compress.compressors.snappy.SnappyCompressorOutputStream;
 import org.apache.tools.ant.types.Resource;
 
 /**
@@ -51,5 +56,13 @@ public final class Snappy extends PackBase {
     }
 
     private class InnerSnappyStreamFactory extends SnappyStreamFactory {
+        @Override
+        public CompressorOutputStream getCompressorStream(OutputStream stream)
+            throws IOException {
+            if (isFramed() || getSrc() == null || getSrc().getSize() < 0) {
+                return super.getCompressorStream(stream);
+            }
+            return new SnappyCompressorOutputStream(stream, getSrc().getSize());
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/a46461e4/src/tests/antunit/unsnappy-test.xml
----------------------------------------------------------------------
diff --git a/src/tests/antunit/unsnappy-test.xml b/src/tests/antunit/unsnappy-test.xml
index d8970a8..c8b0ff0 100644
--- a/src/tests/antunit/unsnappy-test.xml
+++ b/src/tests/antunit/unsnappy-test.xml
@@ -47,6 +47,17 @@
                          actual="${output}/asf-logo.gif"/>
   </target>
 
+  <target name="testSnappyTaskWithoutFraming" depends="setUp">
+    <cmp:snappy src="../resources/asf-logo.gif"
+                destfile="${output}/asf-logo.gif.sz"
+                framed="false"/>
+    <cmp:unsnappy src="${output}/asf-logo.gif.sz"
+                  dest="${output}/asf-logo.gif"
+                  framed="false"/>
+    <au:assertFilesMatch expected="../resources/asf-logo.gif"
+                         actual="${output}/asf-logo.gif"/>
+  </target>
+
   <target name="testNativeSnappy" depends="setUp">
     <cmp:unsnappy src="../resources/asf-logo.gif.sz"
                 dest="${output}/asf-logo.gif" />


[2/2] ant-antlibs-compress git commit: can re-enable test when using Compress 1.14

Posted by bo...@apache.org.
can re-enable test when using Compress 1.14


Project: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/commit/35e432fc
Tree: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/tree/35e432fc
Diff: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/diff/35e432fc

Branch: refs/heads/compress-1.14
Commit: 35e432fcb87427f9912e553038cd8343023b0797
Parents: a46461e
Author: Stefan Bodewig <bo...@apache.org>
Authored: Mon May 8 10:04:27 2017 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Mon May 8 10:04:27 2017 +0200

----------------------------------------------------------------------
 src/tests/antunit/lzma-test.xml | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/35e432fc/src/tests/antunit/lzma-test.xml
----------------------------------------------------------------------
diff --git a/src/tests/antunit/lzma-test.xml b/src/tests/antunit/lzma-test.xml
index ce2721c..0811369 100644
--- a/src/tests/antunit/lzma-test.xml
+++ b/src/tests/antunit/lzma-test.xml
@@ -87,9 +87,7 @@
     <au:assertLogContains text="Nothing to do: asf-logo.gif.lzma is up to date."/>
   </target>
 
-  <!-- re-enable once we upgrade to CC 1.14, see
-       https://issues.apache.org/jira/browse/COMPRESS-393 -->
-  <target name="XtestNestedTask" depends="setUp">
+  <target name="testNestedTask" depends="setUp">
     <cmp:lzma destfile="${output}/asf-logo.tar.lzma">
       <cmp:tar>
         <cmp:cpiofileset src="../resources/asf-logo.gif.bin.cpio"