ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Jar.java ManifestTask.java
Date Sat, 22 Mar 2003 09:53:16 GMT
conor       2003/03/22 01:53:16

  Modified:    docs/manual/CoreTasks Tag: ANT_15_BRANCH jar.html
                        manifest.html
               src/main/org/apache/tools/ant/taskdefs Tag: ANT_15_BRANCH
                        Jar.java ManifestTask.java
  Log:
  Merge
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.16.2.7  +5 -0      ant/docs/manual/CoreTasks/jar.html
  
  Index: jar.html
  ===================================================================
  RCS file: /home/cvs/ant/docs/manual/CoreTasks/jar.html,v
  retrieving revision 1.16.2.6
  retrieving revision 1.16.2.7
  diff -u -w -u -r1.16.2.6 -r1.16.2.7
  --- jar.html	19 Feb 2003 08:13:58 -0000	1.16.2.6
  +++ jar.html	22 Mar 2003 09:53:15 -0000	1.16.2.7
  @@ -144,6 +144,11 @@
       <td valign="top">whether to create an <A HREF="http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#JAR%20Index">index
list</A> to speed up classloading.  This is a JDK 1.3+ specific feature.  Defaults to
false. </td>
       <td valign="top" align="center">No</td>
     </tr>
  +  <tr>
  +    <td valign="top">manifestencoding</td>
  +    <td valign="top">The encoding used to read the JAR manifest, when a manifest
file is specified.</td>
  +    <td valign="top" align="center">No, defaults to the platform encoding.</td>
  +  </tr>
   </table>
   
   <h3>Nested elements</h3>
  
  
  
  1.4.2.3   +5 -0      ant/docs/manual/CoreTasks/manifest.html
  
  Index: manifest.html
  ===================================================================
  RCS file: /home/cvs/ant/docs/manual/CoreTasks/manifest.html,v
  retrieving revision 1.4.2.2
  retrieving revision 1.4.2.3
  diff -u -w -u -r1.4.2.2 -r1.4.2.3
  --- manifest.html	4 Sep 2002 11:21:12 -0000	1.4.2.2
  +++ manifest.html	22 Mar 2003 09:53:15 -0000	1.4.2.3
  @@ -39,6 +39,11 @@
       <td valign="top">One of "update" or "replace", default is "replace".</td>
       <td valign="top" align="center">No</td>
     </tr>
  +  <tr>
  +    <td valign="top">encoding</td>
  +    <td valign="top">The encoding used to read the existing manifest when updating.</td>
  +    <td valign="top" align="center">No, defaults to UTF-8 encoding.</td>
  +  </tr>
   </table>
   
   <h3>Nested elements</h3>
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.51.2.18 +45 -7     ant/src/main/org/apache/tools/ant/taskdefs/Jar.java
  
  Index: Jar.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Jar.java,v
  retrieving revision 1.51.2.17
  retrieving revision 1.51.2.18
  diff -u -w -u -r1.51.2.17 -r1.51.2.18
  --- Jar.java	12 Mar 2003 11:29:10 -0000	1.51.2.17
  +++ Jar.java	22 Mar 2003 09:53:15 -0000	1.51.2.18
  @@ -61,6 +61,7 @@
   import java.io.FileInputStream;
   import java.io.IOException;
   import java.io.InputStream;
  +import java.io.UnsupportedEncodingException;
   import java.io.InputStreamReader;
   import java.io.OutputStreamWriter;
   import java.io.PrintWriter;
  @@ -129,6 +130,9 @@
       /** the manifest specified by the 'manifest' attribute **/
       private Manifest manifest;
   
  +    /** The encoding to use when reading in a manifest file */
  +    private String manifestEncoding;
  +    
       /**
        * The file found from the 'manifest' attribute.  This can be
        * either the location of a manifest, or the name of a jar added
  @@ -178,6 +182,14 @@
       }
   
       /**
  +     * Set whether or not to create an index list for classes.
  +     * This may speed up classloading in some cases.
  +     */
  +    public void setManifestEncoding(String manifestEncoding) {
  +        this.manifestEncoding = manifestEncoding;
  +    }
  +
  +    /**
        * Allows the manifest for the archive file to be provided inline
        * in the build file rather than in an external file.
        *
  @@ -217,8 +229,15 @@
           InputStreamReader isr = null;
           try {
               fis = new FileInputStream(manifestFile);
  -            isr = new InputStreamReader(fis, "UTF-8");
  +            if (manifestEncoding == null) {
  +                isr = new InputStreamReader(fis);
  +            } else {
  +                isr = new InputStreamReader(fis, manifestEncoding);
  +            }
               newManifest = getManifest(isr);
  +        } catch (UnsupportedEncodingException e) {
  +            throw new BuildException("Unsupported encoding while reading manifest: "
  +                                     + e.getMessage(), e);
           } catch (IOException e) {
               throw new BuildException("Unable to read manifest file: "
                                        + manifestFile
  @@ -470,11 +489,22 @@
               // If this is the same name specified in 'manifest', this
               // is the manifest to use
               log("Found manifest " + file, Project.MSG_VERBOSE);
  +            try {
               if (is != null) {
  -                manifest = getManifest(new InputStreamReader(is, "UTF-8"));
  +                    InputStreamReader isr;
  +                    if (manifestEncoding == null) {
  +                        isr = new InputStreamReader(is);
  +                    } else {
  +                        isr = new InputStreamReader(is, manifestEncoding);
  +                    }
  +                    manifest = getManifest(isr);
               } else {
                   manifest = getManifest(file);
               }
  +            } catch (UnsupportedEncodingException e) {
  +                throw new BuildException("Unsupported encoding while reading " 
  +                    + "manifest: " + e.getMessage(), e);
  +            }
           } else if (filesetManifestConfig != null &&
                      !filesetManifestConfig.getValue().equals("skip")) {
               // we add this to our group of fileset manifests
  @@ -484,8 +514,13 @@
               try {
                   Manifest newManifest = null;
                   if (is != null) {
  -                    newManifest 
  -                        = getManifest(new InputStreamReader(is, "UTF-8"));
  +                    InputStreamReader isr;
  +                    if (manifestEncoding == null) {
  +                        isr = new InputStreamReader(is);
  +                    } else {
  +                        isr = new InputStreamReader(is, manifestEncoding);
  +                    }
  +                    newManifest = getManifest(isr);
                   } else {
                       newManifest = getManifest(file);
                   }
  @@ -495,6 +530,9 @@
                   } else {
                       filesetManifest.merge(newManifest);
                   }
  +            } catch (UnsupportedEncodingException e) {
  +                throw new BuildException("Unsupported encoding while reading " 
  +                    + "manifest: " + e.getMessage(), e);
               } catch (ManifestException e) {
                   log("Manifest in file " + file + " is invalid: "
                       + e.getMessage(), Project.MSG_ERR);
  
  
  
  1.1.2.4   +18 -1     ant/src/main/org/apache/tools/ant/taskdefs/ManifestTask.java
  
  Index: ManifestTask.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/ManifestTask.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -w -u -r1.1.2.3 -r1.1.2.4
  --- ManifestTask.java	16 Feb 2003 03:24:43 -0000	1.1.2.3
  +++ ManifestTask.java	22 Mar 2003 09:53:15 -0000	1.1.2.4
  @@ -98,6 +98,11 @@
       private Mode mode;
   
       /**
  +     * The encoding of the manifest file
  +     */
  +    private String encoding;
  +    
  +    /**
        * Helper class for Manifest's mode attribute.
        */
       public static class Mode extends EnumeratedAttribute {
  @@ -150,6 +155,14 @@
       }
   
       /**
  +     * The encoding to use for reading in an existing manifest file
  +     * @param encoding the maniofets file encoding.
  +     */
  +    public void setEncoding(String encoding) {
  +        this.encoding = encoding;
  +    }
  +
  +    /**
        * Update policy: either "update" or "replace"; default is "replace".
        * @param m the mode value - update or replace.
        */
  @@ -176,7 +189,11 @@
               InputStreamReader isr = null;
               try {
                   fis = new FileInputStream(manifestFile);
  +                if (encoding == null) {
                   isr = new InputStreamReader(fis, "UTF-8");
  +                } else {
  +                    isr = new InputStreamReader(fis, encoding);
  +                }
                   current = new Manifest(isr);
               } catch (ManifestException m) {
                   error = new BuildException("Existing manifest " + manifestFile
  
  
  

Mime
View raw message