From 6eb8c15ed0134b406f9db1dd6822137b30794039 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Fri, 28 Nov 2008 16:05:23 +0000 Subject: [PATCH] document . PR 46257. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@721525 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 6 +++ docs/manual/CoreTasks/zip.html | 18 ++++++- docs/manual/CoreTypes/resources.html | 48 +++++++++++++++++++ .../antunit/types/resources/archives-test.xml | 40 ++++++++++++++++ 4 files changed, 111 insertions(+), 1 deletion(-) diff --git a/WHATSNEW b/WHATSNEW index 19024bda9..0125397a4 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -575,6 +575,12 @@ Other changes: processing in Xerces, for example. Bugzilla Report 36653. + * a new resource collection 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 found + as nested element of and friends. + Bugzilla Report 46257. + Changes from Ant 1.7.0 TO Ant 1.7.1 ============================================= diff --git a/docs/manual/CoreTasks/zip.html b/docs/manual/CoreTasks/zip.html index f2e18a80c..0e4d05d8b 100644 --- a/docs/manual/CoreTasks/zip.html +++ b/docs/manual/CoreTasks/zip.html @@ -314,6 +314,22 @@ The code

zips all files in the htdocs/manual directory into the docs/user-guide directory in the archive and includes all the files in any file that maches examples*.zip, such as all files within examples1.zip or examples_for_brian.zip. +The same can be achieved with +

+  <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>
+
+ +The next example
 <zip dest="release.zip">
@@ -321,7 +337,7 @@ The code
 </zip>
 
-

Re-packages a TAR archive as a ZIP archive. If Unix file +

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.

diff --git a/docs/manual/CoreTypes/resources.html b/docs/manual/CoreTypes/resources.html index 06c5e9334..cd763ffce 100644 --- a/docs/manual/CoreTypes/resources.html +++ b/docs/manual/CoreTypes/resources.html @@ -349,6 +349,9 @@ Ant's "legacy" datatypes have been modified to behave as Resource Collections:
  • mappedresources - generic resource collection wrapper that maps the names of the nested resources using a mapper.
  • +
  • archives - wraps around different + resource collections and treats the nested resources as ZIP or TAR + archives that will be extracted on the fly.
  • resources

    A generic resource collection, designed for use with @@ -1075,5 +1078,50 @@ larger collection. Since Ant 1.7.1.

    +

    archives

    + +

    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 <archives> are the contents of the nested + archives.

    + +

    This resource collection is a generalization + of zipgroupfileset + which is only supported by the zip family of tasks.

    + +

    archives doesn't support any attributes.

    + +
    +

    Parameters specified as nested elements

    + +

    <archives> has two nested + elements <zips> and + &ls;tars> that are unions + themselves, i.e. they accept arbitrary many resource(collection)s + as nested elements.

    + +

    The nested resources of <zips> are treated as ZIP archives, + the nested resources of <tars> as TAR archives.

    + +

    Examples

    + +

    Copies all files from all jars that are on the classpath + to ${target}.

    + +
    +    <copy todir="${target}">
    +      <archives>
    +        <zips>
    +          <restrict>
    +            <path path="${java.class.path}"/>
    +            <name name="*.jar"/>
    +          </restrict>
    +        </zips>
    +      </archives>
    +    </copy>
    +  
    +
    + diff --git a/src/tests/antunit/types/resources/archives-test.xml b/src/tests/antunit/types/resources/archives-test.xml index 1b5b0b4ca..a7f58d2b2 100644 --- a/src/tests/antunit/types/resources/archives-test.xml +++ b/src/tests/antunit/types/resources/archives-test.xml @@ -93,4 +93,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +