From dev-return-65171-apmail-ant-dev-archive=ant.apache.org@ant.apache.org Thu Mar 17 09:06:26 2005 Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 86628 invoked from network); 17 Mar 2005 09:06:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 17 Mar 2005 09:06:26 -0000 Received: (qmail 6925 invoked by uid 500); 17 Mar 2005 09:06:25 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 6667 invoked by uid 500); 17 Mar 2005 09:06:24 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 6650 invoked by uid 500); 17 Mar 2005 09:06:24 -0000 Received: (qmail 6647 invoked by uid 99); 17 Mar 2005 09:06:24 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Thu, 17 Mar 2005 01:06:23 -0800 Received: (qmail 86560 invoked by uid 1146); 17 Mar 2005 09:06:22 -0000 Date: 17 Mar 2005 09:06:22 -0000 Message-ID: <20050317090622.86559.qmail@minotaur.apache.org> From: bodewig@apache.org To: ant-cvs@apache.org Subject: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Javadoc.java X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N bodewig 2005/03/17 01:06:22 Modified: docs/manual/CoreTasks javadoc.html src/main/org/apache/tools/ant/taskdefs Javadoc.java Log: Optionally resolve the link attribute. PR: 24364 Revision Changes Path 1.31 +12 -1 ant/docs/manual/CoreTasks/javadoc.html Index: javadoc.html =================================================================== RCS file: /home/cvs/ant/docs/manual/CoreTasks/javadoc.html,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- javadoc.html 7 Mar 2005 18:09:09 -0000 1.30 +++ javadoc.html 17 Mar 2005 09:06:22 -0000 1.31 @@ -550,7 +550,9 @@ href - The URL for the external documentation you wish to link to + The URL for the external documentation you wish + to link to. This can be an absolute URL, or a relative file + name. Yes @@ -565,6 +567,15 @@ the external documentation Only if the offline attribute is true + + resolveLink + 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. + No, default is false. +

group

1.136 +39 -3 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.135 retrieving revision 1.136 diff -u -r1.135 -r1.136 --- Javadoc.java 14 Mar 2005 10:03:36 -0000 1.135 +++ Javadoc.java 17 Mar 2005 09:06:22 -0000 1.136 @@ -1200,6 +1200,7 @@ private String href; private boolean offline = false; private File packagelistLoc; + private boolean resolveLink = false; /** Constructor for LinkArguement */ public LinkArgument() { @@ -1253,6 +1254,24 @@ public boolean isLinkOffline() { return offline; } + + /** + * Sets whether Ant should resolve the link attribute relative + * to the current basedir. + * @param resolve a boolean 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; + } + } /** @@ -1756,11 +1775,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() @@ -1790,7 +1826,7 @@ toExecute.createArgument() .setValue("-linkoffline"); toExecute.createArgument() - .setValue(la.getHref()); + .setValue(link); toExecute.createArgument() .setValue(packageListURL); } catch (MalformedURLException ex) { @@ -1804,7 +1840,7 @@ } } else { toExecute.createArgument().setValue("-link"); - toExecute.createArgument().setValue(la.getHref()); + toExecute.createArgument().setValue(link); } } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org