Browse Source

Add a new attribute to javadoc to allow URLs for location of offline links. PR 28881.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@687360 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 17 years ago
parent
commit
a9831bdcaf
3 changed files with 40 additions and 11 deletions
  1. +4
    -0
      WHATSNEW
  2. +6
    -1
      docs/manual/CoreTasks/javadoc.html
  3. +30
    -10
      src/main/org/apache/tools/ant/taskdefs/Javadoc.java

+ 4
- 0
WHATSNEW View File

@@ -274,6 +274,10 @@ Other changes:
expression. expression.
Bugzilla Report 45284 Bugzilla Report 45284


* The package list location for offline links can now be specified as
an URL.
Bugzilla Report 28881

Changes from Ant 1.7.0 TO Ant 1.7.1 Changes from Ant 1.7.0 TO Ant 1.7.1
============================================= =============================================




+ 6
- 1
docs/manual/CoreTasks/javadoc.html View File

@@ -613,7 +613,12 @@ specify multiple occurrences of the arguments.</p>
<td valign="top">packagelistLoc</td> <td valign="top">packagelistLoc</td>
<td valign="top">The location to the directory containing the package-list file for <td valign="top">The location to the directory containing the package-list file for
the external documentation</td> the external documentation</td>
<td align="center" valign="top">Only if the offline attribute is true</td>
<td align="center" valign="top" rowspan="2">One of the two if the offline attribute is true</td>
</tr>
<tr>
<td valign="top">packagelistURL</td>
<td valign="top">The URL of the the directory containing the package-list file for
the external documentation</td>
</tr> </tr>
<tr> <tr>
<td valign="top">resolveLink</td> <td valign="top">resolveLink</td>


+ 30
- 10
src/main/org/apache/tools/ant/taskdefs/Javadoc.java View File

@@ -1181,6 +1181,7 @@ public class Javadoc extends Task {
private String href; private String href;
private boolean offline = false; private boolean offline = false;
private File packagelistLoc; private File packagelistLoc;
private URL packagelistURL;
private boolean resolveLink = false; private boolean resolveLink = false;


/** Constructor for LinkArguement */ /** Constructor for LinkArguement */
@@ -1220,6 +1221,22 @@ public class Javadoc extends Task {
return packagelistLoc; return packagelistLoc;
} }


/**
* Set the packetlist location attribute.
* @param src an <code>URL</code> value
*/
public void setPackagelistURL(URL src) {
packagelistURL = src;
}

/**
* Get the packetList location attribute.
* @return the packetList location attribute.
*/
public URL getPackagelistURL() {
return packagelistURL;
}

/** /**
* Set the offline attribute. * Set the offline attribute.
* @param offline a <code>boolean</code> value * @param offline a <code>boolean</code> value
@@ -1968,7 +1985,9 @@ public class Javadoc extends Task {


if (la.isLinkOffline()) { if (la.isLinkOffline()) {
File packageListLocation = la.getPackagelistLoc(); File packageListLocation = la.getPackagelistLoc();
if (packageListLocation == null) {
URL packageListURL = la.getPackagelistURL();
if (packageListLocation == null
&& packageListURL == null) {
throw new BuildException("The package list" throw new BuildException("The package list"
+ " location for link " + " location for link "
+ la.getHref() + la.getHref()
@@ -1976,19 +1995,13 @@ public class Javadoc extends Task {
+ "because the link is " + "because the link is "
+ "offline"); + "offline");
} }
if (packageListLocation != null) {
File packageListFile = File packageListFile =
new File(packageListLocation, "package-list"); new File(packageListLocation, "package-list");
if (packageListFile.exists()) { if (packageListFile.exists()) {
try { try {
String packageListURL =
FILE_UTILS.getFileURL(packageListLocation)
.toExternalForm();
toExecute.createArgument()
.setValue("-linkoffline");
toExecute.createArgument()
.setValue(link);
toExecute.createArgument()
.setValue(packageListURL);
packageListURL =
FILE_UTILS.getFileURL(packageListLocation);
} catch (MalformedURLException ex) { } catch (MalformedURLException ex) {
log("Warning: Package list location was " log("Warning: Package list location was "
+ "invalid " + packageListLocation, + "invalid " + packageListLocation,
@@ -1998,6 +2011,13 @@ public class Javadoc extends Task {
log("Warning: No package list was found at " log("Warning: No package list was found at "
+ packageListLocation, Project.MSG_VERBOSE); + packageListLocation, Project.MSG_VERBOSE);
} }
}
if (packageListURL != null) {
toExecute.createArgument().setValue("-linkoffline");
toExecute.createArgument().setValue(link);
toExecute.createArgument()
.setValue(packageListURL.toExternalForm());
}
} else { } else {
toExecute.createArgument().setValue("-link"); toExecute.createArgument().setValue("-link");
toExecute.createArgument().setValue(link); toExecute.createArgument().setValue(link);


Loading…
Cancel
Save