bodewig     2005/03/17 01:11:11

  Modified:    docs/manual/CoreTasks Tag: ANT_16_BRANCH javadoc.html
               src/main/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH
                        Javadoc.java
  Log:
  merge
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.26.2.5  +13 -2     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.4
  retrieving revision 1.26.2.5
  diff -u -r1.26.2.4 -r1.26.2.5
  --- javadoc.html      19 Nov 2004 09:10:00 -0000      1.26.2.4
  +++ javadoc.html      17 Mar 2005 09:11:11 -0000      1.26.2.5
  @@ -550,7 +550,9 @@
     </tr>
     <tr>
       <td valign="top">href</td>
  -    <td valign="top">The URL for the external documentation you wish to link 
to</td>
  +    <td valign="top">The URL for the external documentation you wish
  +    to link to.  This can be an absolute URL, or a relative file
  +    name.</td>
       <td align="center" valign="top">Yes</td>
     </tr>
     <tr>
  @@ -565,6 +567,15 @@
                        the external documentation</td>
       <td align="center" valign="top">Only if the offline attribute is 
true</td>
     </tr>
  +  <tr>
  +    <td valign="top">resolveLink</td>
  +    <td valign="top">If the link attribute is a relative file name,
  +    Ant will first try to locate the file relative to the current
  +    project's basedir and if it finds a file there use an absolute URL
  +    for the link attribute, otherwise it will pass the file name
  +    verbatim to the javadoc command.</td>
  +    <td align="center" valign="top">No, default is false.</td>
  +  </tr>
   </table>
   
   <h4><a name="groupelement">group</a></h4>
  @@ -779,7 +790,7 @@
     &lt/javadoc&gt;</pre>
   
   <hr>
  -<p align="center">Copyright &copy; 2000-2004 The Apache Software Foundation. 
All rights
  +<p align="center">Copyright &copy; 2000-2005 The Apache Software Foundation. 
All rights
   Reserved.</p>
   
   </body>
  
  
  
  No                   revision
  No                   revision
  1.124.2.6 +40 -4     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.5
  retrieving revision 1.124.2.6
  diff -u -r1.124.2.5 -r1.124.2.6
  --- Javadoc.java      9 Mar 2004 17:01:33 -0000       1.124.2.5
  +++ Javadoc.java      17 Mar 2005 09:11:11 -0000      1.124.2.6
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2000-2004 The Apache Software Foundation
  + * Copyright  2000-2005 The Apache Software Foundation
    *
    *  Licensed under the Apache License, Version 2.0 (the "License");
    *  you may not use this file except in compliance with the License.
  @@ -1197,6 +1197,7 @@
           private String href;
           private boolean offline = false;
           private File packagelistLoc;
  +        private boolean resolveLink = false;
   
           public LinkArgument() {
           }
  @@ -1224,6 +1225,24 @@
           public boolean isLinkOffline() {
               return offline;
           }
  +
  +        /**
  +         * Sets whether Ant should resolve the link attribute relative
  +         * to the current basedir.
  +         * @param resolve a <code>boolean</code> value
  +         */
  +        public void setResolveLink(boolean resolve) {
  +            this.resolveLink = resolve;
  +        }
  +
  +        /**
  +         * should Ant resolve the link attribute relative to the
  +         * current basedir?
  +         */
  +        public boolean shouldResolveLink() {
  +            return resolveLink;
  +        }
  +
       }
   
       /**
  @@ -1696,11 +1715,28 @@
                           log("No href was given for the link - skipping",
                               Project.MSG_VERBOSE);
                           continue;
  -                    } else {
  +                    }
  +                    String link = null;
  +                    if (la.shouldResolveLink()) {
  +                        File hrefAsFile = 
  +                            getProject().resolveFile(la.getHref());
  +                        if (hrefAsFile.exists()) {
  +                            try {
  +                                link = FILE_UTILS.getFileURL(hrefAsFile)
  +                                    .toExternalForm();
  +                            } catch (MalformedURLException ex) {
  +                                // should be impossible
  +                                log("Warning: link location was invalid " 
  +                                    + hrefAsFile, Project.MSG_WARN);
  +                            }
  +                        }
  +                    }
  +                    if (link == null) {
                           // is the href a valid URL
                           try {
                               URL base = new URL("file://.");
                               new URL(base, la.getHref());
  +                            link = la.getHref();
                           } catch (MalformedURLException mue) {
                               // ok - just skip
                               log("Link href \"" + la.getHref()
  @@ -1728,7 +1764,7 @@
                                   toExecute.createArgument()
                                       .setValue("-linkoffline");
                                   toExecute.createArgument()
  -                                    .setValue(la.getHref());
  +                                    .setValue(link);
                                   toExecute.createArgument()
                                       .setValue(packageListURL);
                               } catch (MalformedURLException ex) {
  @@ -1742,7 +1778,7 @@
                           }
                       } else {
                           toExecute.createArgument().setValue("-link");
  -                        toExecute.createArgument().setValue(la.getHref());
  +                        toExecute.createArgument().setValue(link);
                       }
                   }
               }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to