ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgl...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Javadoc.java
Date Wed, 30 Mar 2005 16:56:19 GMT
jglick      2005/03/30 08:56:19

  Modified:    .        Tag: ANT_16_BRANCH WHATSNEW
               docs/manual/CoreTasks Tag: ANT_16_BRANCH javadoc.html
               src/main/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH
                        Javadoc.java
  Log:
  Merge of #30606: 'executable' attr for <javadoc>.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.503.2.211 +2 -0      ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.503.2.210
  retrieving revision 1.503.2.211
  diff -u -r1.503.2.210 -r1.503.2.211
  --- WHATSNEW	29 Mar 2005 21:49:02 -0000	1.503.2.210
  +++ WHATSNEW	30 Mar 2005 16:56:18 -0000	1.503.2.211
  @@ -28,6 +28,8 @@
   Other changes:
   --------------
   
  +* <javadoc> can now take an attribute 'executable'. Bugzilla report 30606.
  +
   * New attribute ignorecontents for <different> selector
   
   * Javadoc fixes for Location, Project, and RuntimeConfigurable
  
  
  
  No                   revision
  No                   revision
  1.26.2.7  +46 -36    ant/docs/manual/CoreTasks/javadoc.html
  
  Index: javadoc.html
  ===================================================================
  RCS file: /home/cvs/ant/docs/manual/CoreTasks/javadoc.html,v
  retrieving revision 1.26.2.6
  retrieving revision 1.26.2.7
  diff -u -r1.26.2.6 -r1.26.2.7
  --- javadoc.html	17 Mar 2005 09:38:59 -0000	1.26.2.6
  +++ javadoc.html	30 Mar 2005 16:56:19 -0000	1.26.2.7
  @@ -19,16 +19,16 @@
   &quot;changed&quot; files, unlike the <a href="javac.html">javac</a>
task. This means
   all packages will be processed each time this task is run. In general, however,
   this task is used much less frequently.</p>
  -<p>This task works seamlessly between different javadoc versions (1.1,
  -1.2 and 1.4), with the obvious restriction that the 1.2 attributes
  -will be ignored if run in a 1.1 VM.</p>
  +<p>This task works seamlessly between different javadoc versions (1.2 and 1.4),
  +with the obvious restriction that the 1.4 attributes
  +will be ignored if run in a 1.2 VM.</p>
   <p>NOTE: since javadoc calls System.exit(), javadoc cannot be run inside the
  -same VM as ant without breaking functionality. For this reason, this task
  +same VM as Ant without breaking functionality. For this reason, this task
   always forks the VM. This overhead is not significant since javadoc is normally a heavy
   application and will be called infrequently.</p>
   <p>NOTE: the packagelist attribute allows you to specify the list of packages to
   document outside of the Ant file. It's a much better practice to include everything
  -inside the build.xml file. This option was added in order to make it easier to
  +inside the <code>build.xml</code> file. This option was added in order to make
it easier to
   migrate from regular makefiles, where you would use this option of javadoc.
   The packages listed in packagelist are not checked, so the task performs even
   if some packages are missing or broken. Use this option if you wish to convert from
  @@ -40,9 +40,11 @@
   versions, you are strongly encouraged to use <a href="javadoc.html">javadoc</a>
   instead.</i></p>
   
  -<p>In the table below, 1.1 means available if your current Java VM is
  -a 1.1 VM, 1.2 for either 1.2 or 1.3 and 1.4+ for any VM of at least version 1.4.  1.2+
  -means any VM of at least version 1.2.</p>
  +<p>In the table below, 1.2 means available if your current Java VM is
  +a 1.2 VM (but not 1.3 or later), 1.4+ for any VM of at least version 1.4, otherwise
  +any VM of at least version 1.2 is acceptable. JDK 1.1 is no longer supported.
  +If you specify the <code>executable</code> attribute it is up to you
  +to ensure that this command supports the attributes you wish to use.</p>
   
   <h3>Parameters</h3>
   <table border="1" cellpadding="2" cellspacing="0">
  @@ -94,7 +96,7 @@
     <tr>
       <td valign="top">packageList</td>
       <td valign="top">The name of a file containing the packages to process</td>
  -    <td align="center" valign="top">1.2+</td>
  +    <td align="center" valign="top">all</td>
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
  @@ -107,7 +109,7 @@
       <td valign="top">Bootclasspath</td>
       <td valign="top">Override location of class files loaded by the bootstrap
         class loader</td>
  -    <td align="center" valign="top">1.2+</td>
  +    <td align="center" valign="top">all</td>
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
  @@ -122,19 +124,19 @@
       <td valign="top">Override location of class files loaded by the
         bootstrap class loader by <a href="../using.html#references">reference</a>
to a
         PATH defined elsewhere.</td>
  -    <td align="center" valign="top">1.2+</td>
  +    <td align="center" valign="top">all</td>
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
       <td valign="top">Extdirs</td>
       <td valign="top">Override location of installed extensions</td>
  -    <td align="center" valign="top">1.2+</td>
  +    <td align="center" valign="top">all</td>
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
       <td valign="top">Overview</td>
       <td valign="top">Read overview documentation from HTML file</td>
  -    <td align="center" valign="top">1.2+</td>
  +    <td align="center" valign="top">all</td>
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
  @@ -177,13 +179,13 @@
     <tr>
       <td valign="top">Verbose</td>
       <td valign="top">Output messages about what Javadoc is doing</td>
  -    <td align="center" valign="top">1.2+</td>
  +    <td align="center" valign="top">all</td>
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
       <td valign="top">Locale</td>
       <td valign="top">Locale to be used, e.g. en_US or en_US_WIN</td>
  -    <td align="center" valign="top">1.2+</td>
  +    <td align="center" valign="top">all</td>
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
  @@ -201,7 +203,7 @@
     <tr>
       <td valign="top">Use</td>
       <td valign="top">Create class and package usage pages</td>
  -    <td align="center" valign="top">1.2+</td>
  +    <td align="center" valign="top">all</td>
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
  @@ -213,44 +215,44 @@
     <tr>
       <td valign="top">Splitindex</td>
       <td valign="top">Split index into one file per letter</td>
  -    <td align="center" valign="top">1.2+</td>
  +    <td align="center" valign="top">all</td>
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
       <td valign="top">Windowtitle</td>
       <td valign="top">Browser window title for the documentation (text)</td>
  -    <td align="center" valign="top">1.2+</td>
  +    <td align="center" valign="top">all</td>
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
       <td valign="top">Doctitle</td>
       <td valign="top">Include title for the package index(first) page (html-code)</td>
  -    <td align="center" valign="top">1.2+</td>
  +    <td align="center" valign="top">all</td>
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
       <td valign="top">Header</td>
       <td valign="top">Include header text for each page (html-code)</td>
  -    <td align="center" valign="top">1.2+</td>
  +    <td align="center" valign="top">all</td>
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
       <td valign="top">Footer</td>
       <td valign="top">Include footer text for each page (html-code)</td>
  -    <td align="center" valign="top">1.2+</td>
  +    <td align="center" valign="top">all</td>
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
       <td valign="top">bottom</td>
       <td valign="top">Include bottom text for each page (html-code)</td>
  -    <td align="center" valign="top">1.2+</td>
  +    <td align="center" valign="top">all</td>
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
       <td valign="top">link</td>
       <td valign="top">Create links to javadoc output at the given URL
       -- see also the nested <code>link</code> element.</td>
  -    <td align="center" valign="top">1.2+</td>
  +    <td align="center" valign="top">all</td>
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
  @@ -258,7 +260,7 @@
       <td valign="top">Link to docs at <code>&lt;url&gt;</code>
using package list at
       <code>&lt;url2&gt;</code> - separate the URLs by using a space
character -- see
       also the nested <code>link</code> element.</td>
  -    <td align="center" valign="top">1.2+</td>
  +    <td align="center" valign="top">all</td>
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
  @@ -267,7 +269,7 @@
       page.  The format is as described <a
       href="#groupattribute">below</a> -- see also the nested
       <code>group</code> element.</td>
  -    <td align="center" valign="top">1.2+</td>
  +    <td align="center" valign="top">all</td>
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
  @@ -279,7 +281,7 @@
     <tr>
       <td valign="top">nodeprecatedlist</td>
       <td valign="top">Do not generate deprecated list</td>
  -    <td align="center" valign="top">1.2+</td>
  +    <td align="center" valign="top">all</td>
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
  @@ -297,38 +299,38 @@
     <tr>
       <td valign="top">nohelp</td>
       <td valign="top">Do not generate help link</td>
  -    <td align="center" valign="top">1.2+</td>
  +    <td align="center" valign="top">all</td>
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
       <td valign="top">nonavbar</td>
       <td valign="top">Do not generate navigation bar</td>
  -    <td align="center" valign="top">1.2+</td>
  +    <td align="center" valign="top">all</td>
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
       <td valign="top">serialwarn</td>
       <td valign="top">Generate warning about @serial tag</td>
  -    <td align="center" valign="top">1.2+</td>
  +    <td align="center" valign="top">all</td>
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
       <td valign="top">helpfile</td>
       <td valign="top">Specifies the HTML help file to use</td>
  -    <td align="center" valign="top">1.2+</td>
  +    <td align="center" valign="top">all</td>
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
       <td valign="top">stylesheetfile</td>
       <td valign="top">Specifies the CSS stylesheet to use</td>
  -    <td align="center" valign="top">1.2+</td>
  +    <td align="center" valign="top">all</td>
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
       <td valign="top">charset</td>
       <td valign="top">Charset for cross-platform viewing of generated
         documentation</td>
  -    <td align="center" valign="top">1.2+</td>
  +    <td align="center" valign="top">all</td>
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
  @@ -342,13 +344,13 @@
       <td valign="top">Specifies the class file that starts the doclet
       used in generating the documentation -- see also the nested
       <code>doclet</code> element.</td>
  -    <td align="center" valign="top">1.2+</td>
  +    <td align="center" valign="top">all</td>
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
       <td valign="top">docletpath</td>
       <td valign="top">Specifies the path to the doclet class file that is specified
with the -doclet option.</td>
  -    <td align="center" valign="top">1.2+</td>
  +    <td align="center" valign="top">all</td>
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
  @@ -356,7 +358,7 @@
       <td valign="top">Specifies the path to the doclet class file that
         is specified with the -doclet option by <a
         href="../using.html#references">reference</a> to a PATH defined elsewhere.</td>
  -    <td align="center" valign="top">1.2+</td>
  +    <td align="center" valign="top">all</td>
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
  @@ -397,7 +399,7 @@
         the package names specified via the packagenames attribute or
         nested package elements.
         (<code>yes</code> | <code>no</code>). Default is no.</td>
  -    <td align="center" valign="top">1.2+</td>
  +    <td align="center" valign="top">all</td>
       <td valign="top" align="center">No</td>
     </tr>
     <tr>
  @@ -692,6 +694,14 @@
       </td>
       <td align="center" valign="top">No</td>
     </tr>
  +  <tr>
  +    <td valign="top">executable</td>
  +    <td valign="top">Specify a particular <code>javadoc</code> executable
  +      to use in place of the default binary (found in the same JDK as Ant is running in).
  +      <em>since Ant 1.6.3</em>.</td>
  +    <td align="center" valign="top">all</td>
  +    <td align="center" valign="top">No</td>
  +  </tr>
   </table>
   
   <h4><a name="tagletelement">taglet</a></h4>
  
  
  
  No                   revision
  No                   revision
  1.124.2.8 +99 -138   ant/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
  
  Index: Javadoc.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Javadoc.java,v
  retrieving revision 1.124.2.7
  retrieving revision 1.124.2.8
  diff -u -r1.124.2.7 -r1.124.2.8
  --- Javadoc.java	17 Mar 2005 09:38:59 -0000	1.124.2.7
  +++ Javadoc.java	30 Mar 2005 16:56:19 -0000	1.124.2.8
  @@ -55,7 +55,6 @@
    *        work.
    *    <LI>there is no control on arguments sanity since they are left
    *        to the javadoc implementation.
  - *    <LI>argument J in javadoc1 is not supported (what is that for anyway?)
    * </UL>
    *
    * <P>If no <CODE>doclet</CODE> is set, then the <CODE>version</CODE>
and
  @@ -348,16 +347,6 @@
       /** The command line built to execute Javadoc. */
       private Commandline cmd = new Commandline();
   
  -    /** Flag which indicates if javadoc from JDK 1.1 is to be used. */
  -    private static boolean javadoc1 =
  -        JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1);
  -
  -    /** Flag which indicates if javadoc from JDK 1.4 is available */
  -    private static boolean javadoc4 =
  -        !JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)
  -            && !JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2)
  -            && !JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3);
  -
       /**
        * Utility method to add an argument to the command line conditionally
        * based on the given flag.
  @@ -372,33 +361,18 @@
       }
   
       /**
  -     * Utility method to add a non JDK1.1 javadoc argument.
  +     * Utility method to add a javadoc argument.
        *
        * @param key the argument name.
        * @param value the argument value.
        */
  -    private void add12ArgIfNotEmpty(String key, String value) {
  -        if (!javadoc1) {
  -            if (value != null && value.length() != 0) {
  -                cmd.createArgument().setValue(key);
  -                cmd.createArgument().setValue(value);
  -            } else {
  -                log("Warning: Leaving out empty argument '" + key + "'",
  -                    Project.MSG_WARN);
  -            }
  -        }
  -    }
  -
  -    /**
  -     * Utility method to add a non-JDK1.1 argument to the command line
  -     * conditionally based on the given flag.
  -     *
  -     * @param b the flag which controls if the argument is added.
  -     * @param arg the argument value.
  -     */
  -    private void add12ArgIf(boolean b, String arg) {
  -        if (!javadoc1 && b) {
  -            cmd.createArgument().setValue(arg);
  +    private void addArgIfNotEmpty(String key, String value) {
  +        if (value != null && value.length() != 0) {
  +            cmd.createArgument().setValue(key);
  +            cmd.createArgument().setValue(value);
  +        } else {
  +            log("Warning: Leaving out empty argument '" + key + "'",
  +                Project.MSG_WARN);
           }
       }
   
  @@ -434,6 +408,8 @@
       private boolean breakiterator = false;
       private String noqualifier;
       private boolean includeNoSourcePackages = false;
  +    private boolean old = false;
  +    private String executable = null;
   
       private Vector fileSets = new Vector();
       private Vector packageSets = new Vector();
  @@ -445,9 +421,7 @@
        * @param b true if an external file is to be used.
        */
       public void setUseExternalFile(boolean b) {
  -        if (!javadoc1) {
  -            useExternalFile = b;
  -        }
  +        useExternalFile = b;
       }
   
       /**
  @@ -468,11 +442,7 @@
        *        JVM conventions (e.g. 128m is 128 Megabytes)
        */
       public void setMaxmemory(String max) {
  -        if (javadoc1) {
  -            cmd.createArgument().setValue("-J-mx" + max);
  -        } else {
  -            cmd.createArgument().setValue("-J-Xmx" + max);
  -        }
  +        cmd.createArgument().setValue("-J-Xmx" + max);
       }
   
       /**
  @@ -624,10 +594,8 @@
        * @param f the file containing the overview.
        */
       public void setOverview(File f) {
  -        if (!javadoc1) {
  -            cmd.createArgument().setValue("-overview");
  -            cmd.createArgument().setFile(f);
  -        }
  +        cmd.createArgument().setValue("-overview");
  +        cmd.createArgument().setFile(f);
       }
   
       /**
  @@ -750,17 +718,7 @@
        * @param b if true attempt to generate old style documentation.
        */
       public void setOld(boolean b) {
  -        if (b) {
  -            if (javadoc1) {
  -                log("Javadoc 1.1 doesn't support the -1.1 switch",
  -                    Project.MSG_WARN);
  -            } else if (javadoc4) {
  -                log("Javadoc 1.4 doesn't support the -1.1 switch anymore",
  -                    Project.MSG_WARN);
  -            } else {
  -                cmd.createArgument().setValue("-1.1");
  -            }
  -        }
  +        old = b;
       }
   
       /**
  @@ -839,10 +797,8 @@
        * @deprecated Use the {@link #setExtdirs(Path)} version.
        */
       public void setExtdirs(String path) {
  -        if (!javadoc1) {
  -            cmd.createArgument().setValue("-extdirs");
  -            cmd.createArgument().setValue(path);
  -        }
  +        cmd.createArgument().setValue("-extdirs");
  +        cmd.createArgument().setValue(path);
       }
   
       /**
  @@ -851,10 +807,8 @@
        * @param path a path containing the extension directories.
        */
       public void setExtdirs(Path path) {
  -        if (!javadoc1) {
  -            cmd.createArgument().setValue("-extdirs");
  -            cmd.createArgument().setPath(path);
  -        }
  +        cmd.createArgument().setValue("-extdirs");
  +        cmd.createArgument().setPath(path);
       }
   
       /**
  @@ -863,7 +817,7 @@
        * @param b true if operation is to be verbose.
        */
       public void setVerbose(boolean b) {
  -        add12ArgIf(b, "-verbose");
  +        addArgIf(b, "-verbose");
       }
   
       /**
  @@ -872,12 +826,10 @@
        * @param locale the locale to use.
        */
       public void setLocale(String locale) {
  -        if (!javadoc1) {
  -            // createArgument(true) is necessary to make sure, -locale
  -            // is the first argument (required in 1.3+).
  -            cmd.createArgument(true).setValue(locale);
  -            cmd.createArgument(true).setValue("-locale");
  -        }
  +        // createArgument(true) is necessary to make sure, -locale
  +        // is the first argument (required in 1.3+).
  +        cmd.createArgument(true).setValue(locale);
  +        cmd.createArgument(true).setValue("-locale");
       }
   
       /**
  @@ -905,7 +857,7 @@
        * @param b true if the use page should be generated.
        */
       public void setUse(boolean b) {
  -        add12ArgIf(b, "-use");
  +        addArgIf(b, "-use");
       }
   
   
  @@ -924,7 +876,7 @@
        * @param b true if the index should be split into a file per letter.
        */
       public void setSplitindex(boolean b) {
  -        add12ArgIf(b, "-splitindex");
  +        addArgIf(b, "-splitindex");
       }
   
       /**
  @@ -934,7 +886,7 @@
        * @param title the window title to use.
        */
       public void setWindowtitle(String title) {
  -        add12ArgIfNotEmpty("-windowtitle", title);
  +        addArgIfNotEmpty("-windowtitle", title);
       }
   
       /**
  @@ -954,9 +906,7 @@
        * @param text the HTML element containing the document title.
        */
       public void addDoctitle(Html text) {
  -        if (!javadoc1) {
  -            doctitle = text;
  -        }
  +        doctitle = text;
       }
   
       /**
  @@ -976,9 +926,7 @@
        * @param text the header text
        */
       public void addHeader(Html text) {
  -        if (!javadoc1) {
  -            header = text;
  -        }
  +        header = text;
       }
   
       /**
  @@ -998,9 +946,7 @@
        * @param text the footer text.
        */
       public void addFooter(Html text) {
  -        if (!javadoc1) {
  -            footer = text;
  -        }
  +        footer = text;
       }
   
       /**
  @@ -1020,9 +966,7 @@
        * @param text the bottom text.
        */
       public void addBottom(Html text) {
  -        if (!javadoc1) {
  -            bottom = text;
  -        }
  +        bottom = text;
       }
   
       /**
  @@ -1032,7 +976,7 @@
        * @param src the offline link specification (url and package list)
        */
       public void setLinkoffline(String src) {
  -        if (!javadoc1) {
  +        if (/*1.2+*/true) {
               LinkArgument le = createLink();
               le.setOffline(true);
               String linkOfflineError = "The linkoffline attribute must include"
  @@ -1066,9 +1010,7 @@
        * Create links to javadoc output at the given URL.
        */
       public void setLink(String src) {
  -        if (!javadoc1) {
  -            createLink().setHref(src);
  -        }
  +        createLink().setHref(src);
       }
   
       /**
  @@ -1086,7 +1028,7 @@
        * @param b if true, do not generate deprecated list.
        */
       public void setNodeprecatedlist(boolean b) {
  -        add12ArgIf(b, "-nodeprecatedlist");
  +        addArgIf(b, "-nodeprecatedlist");
       }
   
       /**
  @@ -1113,7 +1055,7 @@
        * @param b if true, do not generate help link
        */
       public void setNohelp(boolean b) {
  -        add12ArgIf(b, "-nohelp");
  +        addArgIf(b, "-nohelp");
       }
   
       /**
  @@ -1122,7 +1064,7 @@
        * @param b if true, do not generate navigation bar.
        */
       public void setNonavbar(boolean b) {
  -        add12ArgIf(b, "-nonavbar");
  +        addArgIf(b, "-nonavbar");
       }
   
       /**
  @@ -1131,7 +1073,7 @@
        * @param b if true, generate warning about the serial tag.
        */
       public void setSerialwarn(boolean b) {
  -        add12ArgIf(b, "-serialwarn");
  +        addArgIf(b, "-serialwarn");
       }
   
       /**
  @@ -1140,10 +1082,8 @@
        * @param f the file with the CSS to use.
        */
       public void setStylesheetfile(File f) {
  -        if (!javadoc1) {
  -            cmd.createArgument().setValue("-stylesheetfile");
  -            cmd.createArgument().setFile(f);
  -        }
  +        cmd.createArgument().setValue("-stylesheetfile");
  +        cmd.createArgument().setFile(f);
       }
   
       /**
  @@ -1152,10 +1092,8 @@
        * @param f the file containing help content.
        */
       public void setHelpfile(File f) {
  -        if (!javadoc1) {
  -            cmd.createArgument().setValue("-helpfile");
  -            cmd.createArgument().setFile(f);
  -        }
  +        cmd.createArgument().setValue("-helpfile");
  +        cmd.createArgument().setFile(f);
       }
   
       /**
  @@ -1174,9 +1112,7 @@
        * @param src the file containing the package list.
        */
       public void setPackageList(String src) {
  -        if (!javadoc1) {
  -            packageList = src;
  -        }
  +        packageList = src;
       }
   
       /**
  @@ -1253,10 +1189,6 @@
        * when run on Java versions below 1.4.
        */
       public TagArgument createTag() {
  -        if (!javadoc4) {
  -            log ("-tag option not supported on JavaDoc < 1.4",
  -                 Project.MSG_VERBOSE);
  -        }
           TagArgument ta = new TagArgument();
           tags.addElement (ta);
           return ta;
  @@ -1478,7 +1410,7 @@
        * Charset for cross-platform viewing of generated documentation.
        */
       public void setCharset(String src) {
  -        this.add12ArgIfNotEmpty("-charset", src);
  +        this.addArgIfNotEmpty("-charset", src);
       }
   
       /**
  @@ -1498,12 +1430,17 @@
        * @since Ant 1.5
        */
       public void setSource(String source) {
  -        if (!javadoc4) {
  -            log ("-source option not supported on JavaDoc < 1.4",
  -                 Project.MSG_VERBOSE);
  -        }
           this.source = source;
       }
  +    
  +    /**
  +     * Sets the actual executable command to invoke, instead of the binary
  +     * <code>javadoc</code> found in Ant's JDK.
  +     * @since Ant 1.6.3
  +     */
  +    public void setExecutable(String executable) {
  +        this.executable = executable;
  +    }
   
       /**
        * Adds a packageset.
  @@ -1538,10 +1475,6 @@
        * @since Ant 1.6
        */
       public void setLinksource(boolean b) {
  -        if (!javadoc4) {
  -            log ("-linksource option not supported on JavaDoc < 1.4",
  -                 Project.MSG_VERBOSE);
  -        }
           this.linksource = b;
       }
   
  @@ -1552,10 +1485,6 @@
        * @since Ant 1.6
        */
       public void setBreakiterator(boolean b) {
  -        if (!javadoc4) {
  -            log ("-breakiterator option not supported on JavaDoc < 1.4",
  -                 Project.MSG_VERBOSE);
  -        }
           this.breakiterator = b;
       }
   
  @@ -1566,10 +1495,6 @@
        * @since Ant 1.6
        */
       public void setNoqualifier(String noqualifier) {
  -        if (!javadoc4) {
  -            log ("-noqualifier option not supported on JavaDoc < 1.4",
  -                 Project.MSG_VERBOSE);
  -        }
           this.noqualifier = noqualifier;
       }
   
  @@ -1587,6 +1512,11 @@
               log("!! javadoc2 is deprecated. Use javadoc instead. !!");
           }
   
  +        // Whether *this VM* is 1.4+ (but also check executable != null).
  +        boolean javadoc4 =
  +            !JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2) &&
  +            !JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3);
  +
           Vector packagesToDoc = new Vector();
           Path sourceDirs = new Path(getProject());
   
  @@ -1620,7 +1550,11 @@
           log("Generating Javadoc", Project.MSG_INFO);
   
           Commandline toExecute = (Commandline) cmd.clone();
  -        toExecute.setExecutable(JavaEnvUtils.getJdkExecutable("javadoc"));
  +        if (executable != null) {
  +            toExecute.setExecutable(executable);
  +        } else {
  +            toExecute.setExecutable(JavaEnvUtils.getJdkExecutable("javadoc"));
  +        }
   
           // ------------------------------------------ general javadoc arguments
           if (doctitle != null) {
  @@ -1646,7 +1580,7 @@
               classpath = classpath.concatSystemClasspath("ignore");
           }
   
  -        if (!javadoc1) {
  +        if (/*1.2+*/true) {
               if (classpath.size() > 0) {
                   toExecute.createArgument().setValue("-classpath");
                   toExecute.createArgument().setPath(classpath);
  @@ -1655,12 +1589,6 @@
                   toExecute.createArgument().setValue("-sourcepath");
                   toExecute.createArgument().setPath(sourceDirs);
               }
  -        } else {
  -            sourceDirs.append(classpath);
  -            if (sourceDirs.size() > 0) {
  -                toExecute.createArgument().setValue("-classpath");
  -                toExecute.createArgument().setPath(sourceDirs);
  -            }
           }
   
           if (version && doclet == null) {
  @@ -1670,7 +1598,7 @@
               toExecute.createArgument().setValue("-author");
           }
   
  -        if (javadoc1 || doclet == null) {
  +        if (doclet == null) {
               if (destDir == null) {
                   String msg = "destDir attribute must be set!";
                   throw new BuildException(msg);
  @@ -1679,7 +1607,7 @@
   
           // ---------------------------- javadoc2 arguments for default doclet
   
  -        if (!javadoc1) {
  +        if (/*1.2+*/true) {
               if (doclet != null) {
                   if (doclet.getName() == null) {
                       throw new BuildException("The doclet name must be "
  @@ -1838,7 +1766,7 @@
               }
   
               // JavaDoc 1.4 parameters
  -            if (javadoc4) {
  +            if (javadoc4 || executable != null) {
                   for (Enumeration e = tags.elements(); e.hasMoreElements();) {
                       Object element = e.nextElement();
                       if (element instanceof TagArgument) {
  @@ -1904,6 +1832,39 @@
                       toExecute.createArgument().setValue("-noqualifier");
                       toExecute.createArgument().setValue(noqualifier);
                   }
  +            } else {
  +                // Not 1.4+.
  +                if (!tags.isEmpty()) {
  +                    log("-tag and -taglet options not supported on Javadoc < 1.4",
  +                        Project.MSG_VERBOSE);
  +                }
  +                if (source != null) {
  +                    log("-source option not supported on JavaDoc < 1.4",
  +                        Project.MSG_VERBOSE);
  +                }
  +                if (linksource) {
  +                    log("-linksource option not supported on JavaDoc < 1.4",
  +                        Project.MSG_VERBOSE);
  +                }
  +                if (breakiterator) {
  +                    log("-breakiterator option not supported on JavaDoc < 1.4",
  +                        Project.MSG_VERBOSE);
  +                }
  +                if (noqualifier != null) {
  +                    log("-noqualifier option not supported on JavaDoc < 1.4",
  +                        Project.MSG_VERBOSE);
  +                }
  +            }
  +            // Javadoc 1.2/1.3 parameters:
  +            if (!javadoc4 || executable != null) {
  +                if (old) {
  +                    toExecute.createArgument().setValue("-1.1");
  +                }
  +            } else {
  +                if (old) {
  +                    log("Javadoc 1.4 doesn't support the -1.1 switch anymore",
  +                        Project.MSG_WARN);
  +                }
               }
   
           }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message