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/01/10 19:56:30 UTC

ant git commit: infrastructure for XZ compression support - PR 60350

Repository: ant
Updated Branches:
  refs/heads/master 193f24672 -> d1e64cc7f


infrastructure for XZ compression support - PR 60350


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

Branch: refs/heads/master
Commit: d1e64cc7fe5eef61094dbb643096cada4b880f72
Parents: 193f246
Author: Stefan Bodewig <bo...@apache.org>
Authored: Tue Jan 10 20:55:45 2017 +0100
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Tue Jan 10 20:55:45 2017 +0100

----------------------------------------------------------------------
 build.xml                                       | 13 ++++
 fetch.xml                                       |  6 +-
 lib/libraries.properties                        |  1 +
 release/ivy.xml                                 |  6 ++
 src/etc/poms/ant-xz/pom.xml                     | 70 ++++++++++++++++++++
 src/etc/poms/ant/pom.xml                        |  1 +
 src/etc/poms/pom.xml                            |  1 +
 .../tools/ant/taskdefs/defaults.properties      |  1 +
 .../tools/ant/taskdefs/optional/xz/Xz.java      | 67 +++++++++++++++++++
 9 files changed, 165 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/d1e64cc7/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index 43917ea..a0d4fc3 100644
--- a/build.xml
+++ b/build.xml
@@ -292,6 +292,12 @@
     <filename name="${optional.package}/Xalan2TraceSupport*"/>
   </selector>
 
+  <selector id="needs.xz">
+      <or>
+         <filename name="${optional.package}/xz/Xz*"/>
+      </or>
+  </selector>
+
   <selector id="ant.launcher">
     <filename name="${ant.package}/launch/"/>
   </selector>
@@ -318,6 +324,7 @@
         <selector refid="needs.junit4"/>
         <selector refid="needs.netrexx"/>
         <selector refid="needs.swing"/>
+        <selector refid="needs.xz"/>
         <selector refid="ant.launcher"/>
       </or>
     </not>
@@ -505,6 +512,9 @@
     <available property="jsch.present"
       classname="com.jcraft.jsch.Session"
       classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
+    <available property="xz.present"
+      classname="org.tukaani.xz.XZOutputStream"
+      classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
 
     <property name="build.compiler" value="modern"/>
 
@@ -592,6 +602,7 @@
             <selector refid="needs.jdepend" unless="jdepend.present"/>
             <selector refid="needs.swing" unless="swing.present"/>
             <selector refid="needs.jsch" unless="jsch.present"/>
+            <selector refid="needs.xz" unless="xz.present"/>
             <selector refid="needs.xmlschema" unless="xmlschema.present"/>
             <selector refid="needs.apache-xalan2"
                       unless="recent.xalan2.present"/>
@@ -764,6 +775,7 @@
     <optional-jar dep="jsch"/>
     <optional-jar dep="jdepend"/>
     <optional-jar dep="apache-xalan2"/>
+    <optional-jar dep="xz"/>
 
   </target>
 
@@ -857,6 +869,7 @@
     <optional-src-jar dep="jsch"/>
     <optional-src-jar dep="jdepend"/>
     <optional-src-jar dep="apache-xalan2"/>
+    <optional-src-jar dep="xz"/>
 
   </target>
 

http://git-wip-us.apache.org/repos/asf/ant/blob/d1e64cc7/fetch.xml
----------------------------------------------------------------------
diff --git a/fetch.xml b/fetch.xml
index 1515fbf..1610d41 100644
--- a/fetch.xml
+++ b/fetch.xml
@@ -334,8 +334,12 @@ Set -Ddest=LOCATION on the command line
     <get src="ftp://ftp.software.ibm.com/software/awdtools/netrexx/NetRexx.zip" dest="${temp.dir}/NetRexx.zip" skipexisting="true"/>
   </target>
 
+  <target name="xz" depends="init" description="loads XZ for Java">
+    <f2 project="org.tukaani" archive="xz"/>
+  </target>
+
   <target name="all"
     description="load all the libraries (except jython)"
-    depends="ivy,logging,junit,xml,networking,regexp,antlr,bcel,jdepend,bsf,debugging,script,javamail,jspc,jai,netrexx" />
+    depends="ivy,logging,junit,xml,networking,regexp,antlr,bcel,jdepend,bsf,debugging,script,javamail,jspc,jai,netrexx,xz" />
 
 </project>

http://git-wip-us.apache.org/repos/asf/ant/blob/d1e64cc7/lib/libraries.properties
----------------------------------------------------------------------
diff --git a/lib/libraries.properties b/lib/libraries.properties
index 4b498a9..21961f3 100644
--- a/lib/libraries.properties
+++ b/lib/libraries.properties
@@ -61,6 +61,7 @@ which.version=1.0
 xalan.version=2.7.2
 xml-resolver.version=1.2
 mail.version=1.4
+xz.version=1.6
 #paired
 jacl.version=1.2.6
 tcljava.version=${jacl.version}

http://git-wip-us.apache.org/repos/asf/ant/blob/d1e64cc7/release/ivy.xml
----------------------------------------------------------------------
diff --git a/release/ivy.xml b/release/ivy.xml
index 1b26cf9..cdfd7f1 100644
--- a/release/ivy.xml
+++ b/release/ivy.xml
@@ -158,6 +158,12 @@
     <artifact name="ant-testutil" type="jar.asc" ext="jar.asc"/>
     <artifact name="ant-testutil" type="source" ext="jar" e:classifier="sources" />
     <artifact name="ant-testutil" type="source.asc" ext="jar.asc" e:classifier="sources" />
+    <artifact name="ant-xz" type="pom" ext="pom"/>
+    <artifact name="ant-xz" type="pom.asc" ext="pom.asc"/>
+    <artifact name="ant-xz" type="jar" ext="jar"/>
+    <artifact name="ant-xz" type="jar.asc" ext="jar.asc"/>
+    <artifact name="ant-xz" type="source" ext="jar" e:classifier="sources" />
+    <artifact name="ant-xz" type="source.asc" ext="jar.asc" e:classifier="sources" />
   </publications>
   <dependencies/> 
 </ivy-module>

http://git-wip-us.apache.org/repos/asf/ant/blob/d1e64cc7/src/etc/poms/ant-xz/pom.xml
----------------------------------------------------------------------
diff --git a/src/etc/poms/ant-xz/pom.xml b/src/etc/poms/ant-xz/pom.xml
new file mode 100644
index 0000000..4aedaa5
--- /dev/null
+++ b/src/etc/poms/ant-xz/pom.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<!--
+  This POM has been created manually by the Ant Development Team.
+  Please contact us if you are not satisfied with the data contained in this POM.
+  URL : http://ant.apache.org
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <groupId>org.apache.ant</groupId>
+    <artifactId>ant-parent</artifactId>
+    <relativePath>../pom.xml</relativePath>
+    <version>1.10.1-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <url>http://ant.apache.org/</url>
+  <groupId>org.apache.ant</groupId>
+  <artifactId>ant-xz</artifactId>
+  <version>1.10.1-SNAPSHOT</version>
+  <name>Apache Ant + XZ for Java</name>
+  <description>contains the xz compression support</description>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.ant</groupId>
+      <artifactId>ant</artifactId>
+      <version>1.10.1-SNAPSHOT</version>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.tukaani</groupId>
+      <artifactId>xz</artifactId>
+      <version>1.6</version>
+      <scope>compile</scope>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <includes>
+            <include>org/apache/tools/ant/taskdefs/optional/xz/*</include>
+          </includes>
+        </configuration>
+      </plugin>
+    </plugins>
+    <sourceDirectory>../../../../src/main</sourceDirectory>
+    <testSourceDirectory>../../../../src/testcases</testSourceDirectory>
+    <outputDirectory>../../../../target/${project.artifactId}/classes</outputDirectory>
+    <testOutputDirectory>../../../../target/${project.artifactId}/testcases</testOutputDirectory>
+    <directory>../../../../target/${project.artifactId}</directory>
+  </build>
+</project>

http://git-wip-us.apache.org/repos/asf/ant/blob/d1e64cc7/src/etc/poms/ant/pom.xml
----------------------------------------------------------------------
diff --git a/src/etc/poms/ant/pom.xml b/src/etc/poms/ant/pom.xml
index dd08f8a..de566c4 100644
--- a/src/etc/poms/ant/pom.xml
+++ b/src/etc/poms/ant/pom.xml
@@ -122,6 +122,7 @@
             <exclude>org/apache/tools/ant/taskdefs/optional/NetRexxC*</exclude>
             <exclude>org/apache/tools/ant/taskdefs/optional/Xalan2TraceSupport*</exclude>
             <exclude>org/apache/tools/ant/taskdefs/optional/jdepend/*</exclude>
+            <exclude>org/apache/tools/ant/taskdefs/optional/xz/*</exclude>
           </excludes>
           <testExcludes>
             <exclude>org/apache/tools/ant/filters/util/JavaClassHelper*</exclude>

http://git-wip-us.apache.org/repos/asf/ant/blob/d1e64cc7/src/etc/poms/pom.xml
----------------------------------------------------------------------
diff --git a/src/etc/poms/pom.xml b/src/etc/poms/pom.xml
index f5e6acb..33b731e 100644
--- a/src/etc/poms/pom.xml
+++ b/src/etc/poms/pom.xml
@@ -102,6 +102,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
     <module>ant-netrexx</module>
     <module>ant-swing</module>
     <module>ant-testutil</module>
+    <module>ant-xz</module>
   </modules>
   <dependencies>
      <dependency>

http://git-wip-us.apache.org/repos/asf/ant/blob/d1e64cc7/src/main/org/apache/tools/ant/taskdefs/defaults.properties
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/defaults.properties b/src/main/org/apache/tools/ant/taskdefs/defaults.properties
index 06507a3..69b29b4 100644
--- a/src/main/org/apache/tools/ant/taskdefs/defaults.properties
+++ b/src/main/org/apache/tools/ant/taskdefs/defaults.properties
@@ -115,6 +115,7 @@ war=org.apache.tools.ant.taskdefs.War
 whichresource=org.apache.tools.ant.taskdefs.WhichResource
 xmlproperty=org.apache.tools.ant.taskdefs.XmlProperty
 xslt=org.apache.tools.ant.taskdefs.XSLTProcess
+xz=org.apache.tools.ant.taskdefs.optional.xz.Xz
 zip=org.apache.tools.ant.taskdefs.Zip
 
 # optional tasks

http://git-wip-us.apache.org/repos/asf/ant/blob/d1e64cc7/src/main/org/apache/tools/ant/taskdefs/optional/xz/Xz.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/xz/Xz.java b/src/main/org/apache/tools/ant/taskdefs/optional/xz/Xz.java
new file mode 100644
index 0000000..d88f910
--- /dev/null
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/xz/Xz.java
@@ -0,0 +1,67 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.tools.ant.taskdefs.optional.xz;
+
+import java.io.BufferedOutputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.util.FileUtils;
+import org.apache.tools.ant.taskdefs.Pack;
+import org.tukaani.xz.LZMA2Options;
+import org.tukaani.xz.XZOutputStream;
+
+/**
+ * Compresses a file with the XZ algorithm. Normally used to compress
+ * non-compressed archives such as TAR files.
+ *
+ * @since Ant 1.10.1
+ *
+ * @ant.task category="packaging"
+ */
+
+public class Xz extends Pack {
+    /**
+     * Compress the zipFile.
+     */
+    protected void pack() {
+        XZOutputStream zOut = null;
+        try {
+            zOut = new XZOutputStream(new FileOutputStream(zipFile),
+                                      new LZMA2Options());
+            zipResource(getSrcResource(), zOut);
+        } catch (IOException ioe) {
+            String msg = "Problem creating xz " + ioe.getMessage();
+            throw new BuildException(msg, ioe, getLocation());
+        } finally {
+            FileUtils.close(zOut);
+        }
+    }
+
+    /**
+     * Whether this task can deal with non-file resources.
+     *
+     * <p>This implementation always returns true only.</p>
+     * @return true
+     */
+    protected boolean supportsNonFileResources() {
+        return true;
+    }
+}