From f0ffaff10c7cd449806b6040a8c8220bcf92c3f7 Mon Sep 17 00:00:00 2001 From: Peter Donald Date: Tue, 16 Jan 2001 13:14:23 +0000 Subject: [PATCH] Added documentation for threcent addition of ZipFileset facilities. Submitted By: Don Ferguson git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268457 13f79535-47bb-0310-9956-ffa450edef68 --- docs/index.html | 50 ++++++++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/docs/index.html b/docs/index.html index 6e389fcc8..7eeea1662 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2943,6 +2943,8 @@ supports all attributes of <fileset> <patternset> elements.

You can also use nested file sets for more flexibility, and specify multiple ones to merge together different trees of files into one JAR. +The extended fileset attributes from the zip task are also available +in the jar task. See the Zip task for more details and examples.

If the manifest is omitted, a simple one will be supplied by Ant. You should not include META-INF/MANIFEST.MF in your set of files. @@ -2952,7 +2954,7 @@ If skip, the JAR is not created and a warning is issued. If fail, the JAR is not created and the build is halted with an error.

(The Jar task is a shortcut for specifying the manifest file of a JAR file. The same thing can be accomplished by using the fullpath -attribute of a prefixedfileset in a Zip task. The one difference is that if the +attribute of a fileset in a Zip task. The one difference is that if the manifest attribute is not specified, the Jar task will include an empty one for you.)

@@ -5138,7 +5140,9 @@ treatment for files that should end up in the WEB-INF directories of the Web Application Archive.

(The War task is a shortcut for specifying the particular layout of a WAR file. The same thing can be accomplished by using the prefix and fullpath -attributes of the prefixedfilesets in a Zip or Jar task.)

+attributes of filesets in a Zip or Jar task.)

+

The extended fileset attributes from the zip task (prefix, fullpath, and src) are available for all filesets used in the War task.

+

Parameters

@@ -5243,8 +5247,8 @@ then the war file myapp.war created with <exclude name="jdbc1.jar"/> </lib> <classes dir="build/main"/> - <prefixedfileset dir="src/graphics/images/gifs" - prefix="images"/> + <fileset dir="src/graphics/images/gifs" + prefix="images"/> </war> will consist of @@ -5287,16 +5291,7 @@ if basedir is set. You may use any mixture of the implicit file set (with basedir set, and optional attributes like includes and optional subelements like <include>); explicit nested <fileset> elements so long as at least one fileset total is specified. The ZIP file will -only reflect the relative paths of files within each fileset.

-

<zip> elements may contain both regular <fileset> elements -and also <prefixedfileset> elements. A <prefixedfileset> is an extended form of a fileset, -which may include one of two special attributes: -prefix or fullpath. These attributes modify the location of the files when they are placed -inside the archive. If the prefix attribute is set, all the files in the prefixedfileset are prefixed -with that path in the archive. If the fullpath attribute is set, the file described by the prefixedfileset is placed at that -exact location in the archive. (The fullpath attribute can only be set for prefixedfilesets that -represent a single file. The prefix and fullpath attributes cannot both be set on the -same prefixedfileset.)

+only reflect the relative paths of files within each fileset. A fileset has additional attributes that are available in the context of the Zip task and its derivatives (described below).

The whenempty parameter controls what happens when no files match. If skip (the default), the ZIP is not created and a warning is issued. If fail, the ZIP is not created and the build is halted with an error. @@ -5360,6 +5355,18 @@ which should be recognized as such by compliant ZIP manipulation tools.

No
+

Parameters specified as nested elements

+

fileset

+The zip task supports any number of nested <fileset> elements to specify the files to be included in the archive. A <fileset> has three additional attributes when +used in the context of the <zip> task: prefix, fullpath, and src. The +prefix and fullpath attributes modify the location of the files when they are placed +inside the archive. If the prefix attribute is set, all files in the fileset are prefixed +with that path in the archive. If the fullpath attribute is set, the file described by the fileset is placed at that +exact location in the archive. (The fullpath attribute can only be set for filesets that represent a single file. The prefix and fullpath attributes cannot both be set on the same fileset.) The src attribute +may be used in place of the dir attribute to specify a zip file whose +contents will be extracted and included in the archive. As with directories, include and exclude patterns may be used to specify a subset of the zip file +for inclusion in the archive. +

Examples

  <zip zipfile="${dist}/manual.zip"
        basedir="htdocs/manual"
@@ -5387,13 +5394,18 @@ are zipped, and files with the name todo.html are excluded.

current directory. ChangeLog.txt will be added to the top of the ZIP file, just as if it had been located at htdocs/manual/ChangeLog.txt.

  <zip zipfile="${dist}/manual.zip">
-    <prefixedfileset dir="htdocs/manual" prefix="docs/user-guide"/>
-    <prefixedfileset dir="." includes="ChangeLog27.txt" fullpath="docs/ChangeLog.txt"/>
+    <fileset dir="htdocs/manual" prefix="docs/user-guide"/>
+    <fileset dir="." includes="ChangeLog27.txt" fullpath="docs/ChangeLog.txt"/>
+    <fileset src="examples.zip" includes="**/*.html" prefix="docs/examples"/>
   </zip>

zips all files in the htdocs/manual directory into the docs/user-guide directory -in the archive, and also adds the file ChangeLog27.txt in the -current directory as docs/ChangeLog.txt. For example, the archive might end up containing two files: -docs/user-guide/html/index.html and docs/ChangeLog.txt

+in the archive, adds the file ChangeLog27.txt in the +current directory as docs/ChangeLog.txt, and includes all the html files in examples.zip under docs/examples. The archive might end up containing the files: +
    docs/user-guide/html/index.html
+    docs/ChangeLog.txt
+    docs/examples/index.html
+
+


Optional tasks