tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@hyperreal.org
Subject cvs commit: jakarta-tools/ant/src/main/org/apache/tools/ant/taskdefs Zip.java
Date Tue, 30 Nov 1999 22:26:52 GMT
jons        99/11/30 14:26:51

  Modified:    ant/src/main/org/apache/tools/ant/taskdefs Zip.java
  Log:
  nice feature to have * be read.
  
  Revision  Changes    Path
  1.3       +39 -13    jakarta-tools/ant/src/main/org/apache/tools/ant/taskdefs/Zip.java
  
  Index: Zip.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tools/ant/src/main/org/apache/tools/ant/taskdefs/Zip.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Zip.java	1999/11/29 09:40:44	1.2
  +++ Zip.java	1999/11/30 22:26:50	1.3
  @@ -66,7 +66,7 @@
    * Same as the Jar task, but creates .zip files without the MANIFEST 
    * stuff that .jar files have.
    *
  - * @author duncan@x180.com
  + * @author James Davidson <a href="mailto:duncan@x180.com">duncan@x180.com</a>
    * @author Jon S. Stevens <a href="mailto:jon@clearink.com">jon@clearink.com</a>
    */
   
  @@ -77,20 +77,43 @@
       private Vector items = new Vector();
       private File manifest;    
       private Vector ignoreList = new Vector();
  +    private boolean allItems = false;
       
  +    /**
  +        This is the name/location of where to 
  +        create the .zip file.
  +    */
       public void setZipfile(String zipFilename) {
  -    zipFile = project.resolveFile(zipFilename);
  +        zipFile = project.resolveFile(zipFilename);
       }
  -
  +    /**
  +        This is the base directory to look in for 
  +        things to zip.
  +    */
       public void setBasedir(String baseDirname) {
  -    baseDir = project.resolveFile(baseDirname);
  +        baseDir = project.resolveFile(baseDirname);
       }
   
  +    /**
  +        Set this to be the items in the base directory 
  +        that you want to include in the zip archive. 
  +        (ie: items="foo, bar, ack.html, f.java").
  +        You can also specify "*" for the items (ie: items="*") 
  +        and it will include all the items in the base directory.
  +        Do not try to have items="*, foo". Also note that 
  +        you can specify items to ignore with setIgnore and they 
  +        will still be ignored if you choose "*". Sometimes 
  +        ignore lists are easier than include lists. ;-)
  +    */
       public void setItems(String itemString) {
  -    StringTokenizer tok = new StringTokenizer(itemString, ",", false);
  -    while (tok.hasMoreTokens()) {
  -        items.addElement(tok.nextToken().trim());
  -    }
  +        if ( itemString.equals("*") ) {
  +            allItems = true;
  +        } else {
  +            StringTokenizer tok = new StringTokenizer(itemString, ",", false);
  +            while (tok.hasMoreTokens()) {
  +                items.addElement(tok.nextToken().trim());
  +            }
  +        }
       }
       /**
           List of filenames and directory names to not 
  @@ -123,6 +146,13 @@
               ZipOutputStream zOut = new ZipOutputStream(new FileOutputStream(zipFile));
               zOut.setMethod(ZipOutputStream.DEFLATED);
               
  +            if ( allItems ) {
  +                String[] lst = baseDir.list();
  +                for (int i=0;i<lst.length;i++) {
  +                    items.addElement(lst[i]);
  +                }
  +            }
  +
               // add items
               Enumeration e = items.elements();
               while (e.hasMoreElements()) {
  @@ -190,8 +220,4 @@
           zipFile(fIn, zOut, vPath);
           fIn.close();
       }
  -}
  -
  -
  -
  -
  +}
  \ No newline at end of file
  
  
  

Mime
View raw message