add a target for binary distributions that bundle dependencies

git-svn-id: https://svn.apache.org/repos/asf/ant/antlibs/common/trunk@1195451 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/build.xml b/build.xml
index 4f5e6f3..f2ff8df 100644
--- a/build.xml
+++ b/build.xml
@@ -34,6 +34,7 @@
     <property name="build.classes" value="${build}/classes"/>
     <property name="build.testclasses" value="${build}/test-classes"/>
     <property name="build.lib" value="${build}/lib"/>
+    <property name="build.deps" value="${build}/deps"/>
     <property name="build.javarepository"
               value="${build}/java-repository"/>
     <property name="build.javadoc" value="${build}/javadoc"/>
@@ -515,4 +516,61 @@
   </target>
 
   <target name="upload" depends="check-sigs,perform-nexus-upload"/>
+
+  <!-- "fat" binary distributions with dependencies -->
+  <import file="${common.basedir}/fetch.xml"/>
+
+  <target name="fat-distribution"
+          description="creates a complete binary distribution with dependencies"
+          depends="distribution,fetch-dependencies">
+
+    <unzip src="${dist.base.binaries}/${dist.name}-bin.zip"
+           dest="."/>
+
+    <copy todir="${dist.name}">
+      <fileset dir="${build.deps}"/>
+    </copy>
+
+    <zip destfile="${dist.base.binaries}/${dist.name}-bin-withdeps.zip">
+      <zipfileset dir="${dist.name}/.." filemode="755">
+        <include name="${dist.name}/bin/*.pl"/>
+        <include name="${dist.name}/bin/*.py"/>
+      </zipfileset>
+      <fileset dir="${dist.name}/..">
+        <include name="${dist.name}/**"/>
+        <exclude name="${dist.name}/bin/*.pl"/>
+        <exclude name="${dist.name}/bin/*.py"/>
+      </fileset>
+    </zip>
+    <tar longfile="gnu"
+      destfile="${dist.base.binaries}/${dist.name}-bin-withdeps.tar">
+      <tarfileset dir="${dist.name}/.." mode="755" username="ant" group="ant">
+        <include name="${dist.name}/bin/*.pl"/>
+        <include name="${dist.name}/bin/*.py"/>
+      </tarfileset>
+      <tarfileset dir="${dist.name}/.." username="ant" group="ant">
+        <include name="${dist.name}/**"/>
+        <exclude name="${dist.name}/bin/*.pl"/>
+        <exclude name="${dist.name}/bin/*.py"/>
+      </tarfileset>
+    </tar>
+    <gzip destfile="${dist.base.binaries}/${dist.name}-bin-withdeps.tar.gz"
+      src="${dist.base.binaries}/${dist.name}-bin-withdeps.tar"/>
+    <bzip2 destfile="${dist.base.binaries}/${dist.name}-bin-withdeps.tar.bz2"
+      src="${dist.base.binaries}/${dist.name}-bin-withdeps.tar"/>
+    <delete file="${dist.base.binaries}/${dist.name}-bin-withdeps.tar"/>
+
+    <checksums>
+      <fileset dir="${dist.base.binaries}/">
+        <include name="**/*-withdeps*"/>
+        <exclude name="**/*.asc"/>
+        <exclude name="**/*.md5"/>
+        <exclude name="**/*.sha1"/>
+        <exclude name="**/*.sha512"/>
+      </fileset>
+    </checksums>
+
+    <delete dir="${dist.name}"/>
+  </target>
+
 </project>
diff --git a/fetch.xml b/fetch.xml
new file mode 100644
index 0000000..be8b57e
--- /dev/null
+++ b/fetch.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!--
+   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.
+-->
+<project name="fetch" xmlns:ivy="antlib:org.apache.ivy.ant">
+
+  <target name="fetch-dependencies" depends="ivy.xml">
+    <ivy:configure file="${common.basedir}/ivysettings-nexus.xml"/>
+    <ivy:resolve file="${target.ivy.xml}"/>
+    <ivy:retrieve type="jar"
+                  pattern="${build.deps}/[artifact]-[revision].[ext]"/>
+  </target>
+
+</project>
\ No newline at end of file