Author: bodewig
Date: Fri Nov 28 08:05:23 2008
New Revision: 721525
URL: http://svn.apache.org/viewvc?rev=721525&view=rev
Log:
document <archives>. PR 46257.
Modified:
ant/core/trunk/WHATSNEW
ant/core/trunk/docs/manual/CoreTasks/zip.html
ant/core/trunk/docs/manual/CoreTypes/resources.html
ant/core/trunk/src/tests/antunit/types/resources/archives-test.xml
Modified: ant/core/trunk/WHATSNEW
URL:
http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=721525&r1=721524&r2=721525&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Fri Nov 28 08:05:23 2008
@@ -575,6 +575,12 @@
processing in Xerces, for example.
Bugzilla Report 36653.
+ * a new resource collection <archives> can be used to specify
+ collections of ZIP and TAR archives as source and extracts them on
+ the fly. This is a generalization of the <zipgroupfileset> found
+ as nested element of <zip> and friends.
+ Bugzilla Report 46257.
+
Changes from Ant 1.7.0 TO Ant 1.7.1
=============================================
Modified: ant/core/trunk/docs/manual/CoreTasks/zip.html
URL:
http://svn.apache.org/viewvc/ant/core/trunk/docs/manual/CoreTasks/zip.html?rev=721525&r1=721524&r2=721525&view=diff
==============================================================================
--- ant/core/trunk/docs/manual/CoreTasks/zip.html (original)
+++ ant/core/trunk/docs/manual/CoreTasks/zip.html Fri Nov 28 08:05:23 2008
@@ -314,6 +314,22 @@
</pre>
<p>
<p>zips all files in the <code>htdocs/manual</code> directory into the
<code>docs/user-guide</code> directory in the archive and includes all the
files in any file that maches <code>examples*.zip</code>, such as all files
within <code>examples1.zip</code> or <code>examples_for_brian.zip</code>.
+The same can be achieved with
+<pre>
+ <zip destfile="${dist}/manual.zip">
+ <mappedresources>
+ <fileset dir="htdocs/manual"/>
+ <globmapper from="*" to="docs/user-guide/*"/>
+ </mappedresources>
+ <archives>
+ <zips>
+ <fileset dir="." includes="examples*.zip"/>
+ </zips>
+ </archives>
+ </zip>
+</pre>
+
+The next example
<pre>
<zip dest="release.zip">
@@ -321,7 +337,7 @@
</zip>
</pre>
-<p>Re-packages a TAR archive as a ZIP archive. If Unix file
+<p>re-packages a TAR archive as a ZIP archive. If Unix file
permissions have been stored as part of the TAR file, they will be
retained in the resulting ZIP archive.</p>
Modified: ant/core/trunk/docs/manual/CoreTypes/resources.html
URL:
http://svn.apache.org/viewvc/ant/core/trunk/docs/manual/CoreTypes/resources.html?rev=721525&r1=721524&r2=721525&view=diff
==============================================================================
--- ant/core/trunk/docs/manual/CoreTypes/resources.html (original)
+++ ant/core/trunk/docs/manual/CoreTypes/resources.html Fri Nov 28 08:05:23 2008
@@ -349,6 +349,9 @@
<li><a href="#mappedresources">mappedresources</a> - generic
resource collection wrapper that maps the names of the nested
resources using a <a href="mapper.html">mapper</a>.</li>
+ <li><a href="#archives">archives</a> - wraps around different
+ resource collections and treats the nested resources as ZIP or TAR
+ archives that will be extracted on the fly.</li>
</ul>
<h4><a name="resources">resources</a></h4>
<p>A generic resource collection, designed for use with
@@ -1075,5 +1078,50 @@
</pre>
</blockquote>
+<h4><a name="archives">archives</a></h4>
+
+<p>This resource collection accepts an arbitrary number of nested
+ resources and assumes that all those resources must be either ZIP or
+ TAR archives. The resources returned
+ by <code><archives></code> are the contents of the nested
+ archives.</p>
+
+<p>This resource collection is a generalization
+ of <a href="../CoreTasks/zip.html#zipgroupfileset">zipgroupfileset</a>
+ which is only supported by the zip family of tasks.</p>
+
+<p><em>archives</em> doesn't support any attributes.</p>
+
+<blockquote>
+ <h4>Parameters specified as nested elements</h4>
+
+ <p><code><archives></code> has two nested
+ elements <code><zips></code> and
+ <code>&ls;tars></code> that are <a href="#union">unions</a>
+ themselves, i.e. they accept arbitrary many resource(collection)s
+ as nested elements.</p>
+
+ <p>The nested resources of <zips> are treated as ZIP archives,
+ the nested resources of <tars> as TAR archives.</p>
+
+ <h4>Examples</h4>
+
+ <p>Copies all files from all jars that are on the classpath
+ to <code>${target}</code>.</p>
+
+ <pre>
+ <copy todir="${target}">
+ <archives>
+ <zips>
+ <restrict>
+ <path path="${java.class.path}"/>
+ <name name="*.jar"/>
+ </restrict>
+ </zips>
+ </archives>
+ </copy>
+ </pre>
+</blockquote>
+
</body>
</html>
Modified: ant/core/trunk/src/tests/antunit/types/resources/archives-test.xml
URL:
http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/types/resources/archives-test.xml?rev=721525&r1=721524&r2=721525&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/types/resources/archives-test.xml
(original)
+++ ant/core/trunk/src/tests/antunit/types/resources/archives-test.xml Fri Nov
28 08:05:23 2008
@@ -93,4 +93,44 @@
</au:expectfailure>
</target>
+ <!-- works but takes a veeeeeery long time -->
+ <target name="XtestResourcesManualExample">
+ <mkdir dir="${output}"/>
+ <copy todir="${output}">
+ <archives>
+ <zips>
+ <restrict>
+ <path path="${java.class.path}"/>
+ <name name="*.jar"/>
+ </restrict>
+ </zips>
+ </archives>
+ </copy>
+ <au:assertFileExists
+ file="${output}/org/apache/tools/ant/launch/Launcher.class"/>
+ </target>
+
+ <target name="testZipManualExample">
+ <mkdir dir="${output}/control"/>
+ <mkdir dir="${input}/htdocs/manual"/>
+ <touch file="${input}/htdocs/manual/foo.txt"/>
+ <zip destfile="${input}/examples-a.zip">
+ <fileset dir="." includes="*.xml"/>
+ </zip>
+ <zip destfile="${output}/manual.zip">
+ <mappedresources>
+ <fileset dir="${input}/htdocs/manual"/>
+ <globmapper from="*" to="docs/user-guide/*"/>
+ </mappedresources>
+ <archives>
+ <zips>
+ <fileset dir="${input}" includes="examples*.zip"/>
+ </zips>
+ </archives>
+ </zip>
+ <unzip src="${output}/manual.zip" dest="${output}/control"/>
+ <au:assertFileExists file="${output}/control/archives-test.xml"/>
+ <au:assertFileExists file="${output}/control/docs/user-guide/foo.txt"/>
+ </target>
+
</project>