bodewig     01/01/31 05:10:47

  Modified:    .        WHATSNEW
               docs     index.html
               src/main/org/apache/tools/ant/taskdefs Zip.java
  Log:
  Make <fileset> inside <zip> a plain FileSet and add <zipfileset>.
  
  Revision  Changes    Path
  1.70      +3 -1      jakarta-ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
  retrieving revision 1.69
  retrieving revision 1.70
  diff -u -r1.69 -r1.70
  --- WHATSNEW  2001/01/24 12:53:37     1.69
  +++ WHATSNEW  2001/01/31 13:10:39     1.70
  @@ -23,7 +23,7 @@
   
   * Added output attribute to <java>.
   
  -* Added nested prefixedfileset element to <war>
  +* Added nested zipfileset element to <zip>
   
   * Changed <sql> so that printing is at the task level rather than 
     the statement level.
  @@ -100,6 +100,8 @@
     name foo.
     
   * Handle build files in directories whose name contained a "#" character
  +
  +* <junit> can now log to files whose name contains a comma as well. 
   
   Changes from Ant 1.1 to Ant 1.2
   ===============================
  
  
  
  1.198     +15 -12    jakarta-ant/docs/index.html
  
  Index: index.html
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/docs/index.html,v
  retrieving revision 1.197
  retrieving revision 1.198
  diff -u -r1.197 -r1.198
  --- index.html        2001/01/30 00:22:28     1.197
  +++ index.html        2001/01/31 13:10:42     1.198
  @@ -34,7 +34,7 @@
   
   <center>
   <p>Version: @VERSION@<br>
  -$Id: index.html,v 1.197 2001/01/30 00:22:28 donaldp Exp $</p>
  +$Id: index.html,v 1.198 2001/01/31 13:10:42 bodewig Exp $</p>
   </center>
   
   <hr>
  @@ -2970,7 +2970,7 @@
   If <code>fail</code>, the JAR is not created and the build is halted with an 
error.
   <p>(The Jar task is a shortcut for specifying the manifest file of a JAR 
file. 
   The same thing can be accomplished by using the <i>fullpath</i>
  -attribute of a fileset in a Zip task. The one difference is that if the
  +attribute of a zipfileset in a Zip task. The one difference is that if the
   <i>manifest</i> attribute is not specified, the Jar task will 
   include an empty one for you.)</p>
   </p>
  @@ -5211,8 +5211,8 @@
   <code>WEB-INF</code> directories of the Web Application Archive.
   <p>(The War task is a shortcut for specifying the particular layout of a WAR 
file. 
   The same thing can be accomplished by using the <i>prefix</i> and 
<i>fullpath</i>
  -attributes of filesets in a Zip or Jar task.)</p>
  -<p>The extended fileset attributes from the zip task (<i>prefix</i>, 
<i>fullpath</i>, and <i>src</i>) are available for all filesets used in the War 
task.</p>
  +attributes of zipfilesets in a Zip or Jar task.)</p>
  +<p>The extended zipfileset element from the zip task (with attributes 
<i>prefix</i>, <i>fullpath</i>, and <i>src</i>) is available in the War 
task.</p>
   
   <h3>Parameters</h3>
   <table border="1" cellpadding="2" cellspacing="0">
  @@ -5318,8 +5318,8 @@
       &lt;exclude name=&quot;jdbc1.jar&quot;/&gt;
     &lt;/lib&gt;
     &lt;classes dir=&quot;build/main&quot;/&gt;
  -  &lt;fileset dir=&quot;src/graphics/images/gifs&quot; 
  -           prefix="images"/&gt;
  +  &lt;zipfileset dir=&quot;src/graphics/images/gifs&quot; 
  +              prefix="images"/&gt;
   &lt;/war&gt;
   </pre>
   will consist of
  @@ -5362,7 +5362,7 @@
   (with <code>basedir</code> set, and optional attributes like 
<code>includes</code>
   and optional subelements like <code>&lt;include&gt;</code>); explicit nested
   <code>&lt;fileset&gt;</code> elements so long as at least one fileset total 
is specified. The ZIP file will
  -only reflect the relative paths of files <i>within</i> each fileset.  A 
fileset has additional attributes that are available in the context of the Zip 
task and its derivatives (described below). </p>
  +only reflect the relative paths of files <i>within</i> each fileset. The Zip 
task and its derivatives know a special form of a fileset named zipfileset that 
has additional attributes (described below). </p>
   <p>The <code>whenempty</code> parameter controls what happens when no files 
match.
   If <code>skip</code> (the default), the ZIP is not created and a warning is 
issued.
   If <code>fail</code>, the ZIP is not created and the build is halted with an 
error.
  @@ -5428,8 +5428,11 @@
   </table>
   <h3>Parameters specified as nested elements</h3>
   <h4>fileset</h4>
  -The zip task supports any number of nested <a 
href="#fileset"><code>&lt;fileset&gt;</code></a> elements to specify the files 
to be included in the archive.  A <code>&lt;fileset&gt;</code> has three 
additional attributes when
  -used in the context of the <code>&lt;zip&gt;</code> task: <i>prefix</i>, 
<i>fullpath</i>, and <i>src</i>.  The 
  +<p>The zip task supports any number of nested <a
  +href="#fileset"><code>&lt;fileset&gt;</code></a> elements to specify
  +the files to be included in the archive.</p>
  +<h4>zipfileset</h4>
  +<p>A <code>&lt;zipfileset&gt;</code> has three additional attributes: 
<i>prefix</i>, <i>fullpath</i>, and <i>src</i>.  The 
   <i>prefix</i> and <i>fullpath</i> attributes modify the location of the 
files when they are placed 
   inside the archive. If the <i>prefix</i> attribute is set, all files in the 
fileset are prefixed
   with that path in the archive. If the <i>fullpath</i> attribute is set, the 
file described by the fileset is placed at that 
  @@ -5465,9 +5468,9 @@
   current directory. <code>ChangeLog.txt</code> will be added to the top of 
the ZIP file, just as if
   it had been located at <code>htdocs/manual/ChangeLog.txt</code>.</p>
   <pre>  &lt;zip zipfile=&quot;${dist}/manual.zip&quot;&gt;
  -    &lt;fileset dir=&quot;htdocs/manual&quot; 
prefix=&quot;docs/user-guide&quot;/&gt;
  -    &lt;fileset dir=&quot;.&quot; includes=&quot;ChangeLog27.txt&quot; 
fullpath=&quot;docs/ChangeLog.txt&quot;/&gt;
  -    &lt;fileset src=&quot;examples.zip&quot; includes=&quot;**/*.html&quot; 
prefix=&quot;docs/examples&quot;/&gt;
  +    &lt;zipfileset dir=&quot;htdocs/manual&quot; 
prefix=&quot;docs/user-guide&quot;/&gt;
  +    &lt;zipfileset dir=&quot;.&quot; includes=&quot;ChangeLog27.txt&quot; 
fullpath=&quot;docs/ChangeLog.txt&quot;/&gt;
  +    &lt;zipfileset src=&quot;examples.zip&quot; 
includes=&quot;**/*.html&quot; prefix=&quot;docs/examples&quot;/&gt;
     &lt;/zip&gt;</pre>
   <p>zips all files in the <code>htdocs/manual</code> directory into the 
<code>docs/user-guide</code> directory
   in the archive, adds the file <code>ChangeLog27.txt</code> in the
  
  
  
  1.29      +21 -13    
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Zip.java
  
  Index: Zip.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Zip.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- Zip.java  2001/01/30 10:56:05     1.28
  +++ Zip.java  2001/01/31 13:10:46     1.29
  @@ -109,15 +109,14 @@
       /**
        * Adds a set of files (nested fileset attribute).
        */
  -    public void addFileset(ZipFileSet set) {
  +    public void addFileset(FileSet set) {
           filesets.addElement(set);
       }
   
       /**
        * @deprecated addPrefixedfileset is deprecated; replaced by ZipFileSet
        */
  -    public void addPrefixedfileset(ZipFileSet set) {
  -        log("WARNING: PrefixedFileSets are deprecated; use the fileset tag 
instead.");
  +    public void addZipfileset(ZipFileSet set) {
           filesets.addElement(set);
       }
   
  @@ -498,22 +497,30 @@
       }
   
       /**
  -     * Iterate over the given Vector of zipfilesets and add
  +     * Iterate over the given Vector of (zip)filesets and add
        * all files to the ZipOutputStream using the given prefix.
        */
       protected void addFiles(Vector filesets, ZipOutputStream zOut)
           throws IOException {
           // Add each fileset in the Vector.
           for (int i = 0; i<filesets.size(); i++) {
  -            ZipFileSet fs = (ZipFileSet) filesets.elementAt(i);
  +            FileSet fs = (FileSet) filesets.elementAt(i);
               DirectoryScanner ds = fs.getDirectoryScanner(project);
  -            String prefix = fs.getPrefix();
  +
  +            String prefix = "";
  +            String fullpath = "";
  +            if (fs instanceof ZipFileSet) {
  +                ZipFileSet zfs = (ZipFileSet) fs;
  +                prefix = zfs.getPrefix();
  +                fullpath = zfs.getFullpath();
  +            }
  +            
               if (prefix.length() > 0 
                   && !prefix.endsWith("/")
                   && !prefix.endsWith("\\")) {
                   prefix += "/";
               }
  -            String fullpath = fs.getFullpath();
  +
               // Need to manually add either fullpath's parent directory, or 
               // the prefix directory, to the archive. 
               if (prefix.length() > 0) {
  @@ -523,12 +530,13 @@
                   addParentDirs(null, fullpath, zOut, "");
               }
   
  -            if (fs.getSrc() != null) {
  -              addZipEntries(fs, ds, zOut, prefix);
  -             } else {
  -               // Add the fileset.
  -                 addFiles(ds, zOut, prefix, fullpath);
  -             }
  +            if (fs instanceof ZipFileSet
  +                && ((ZipFileSet) fs).getSrc() != null) {
  +                addZipEntries((ZipFileSet) fs, ds, zOut, prefix);
  +            } else {
  +                // Add the fileset.
  +                addFiles(ds, zOut, prefix, fullpath);
  +            }
           }
       }
   
  
  
  

Reply via email to