|
|
@@ -257,7 +257,8 @@ public class Javadoc extends Task { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @see java.lang.Object#toString |
|
|
|
* Return a string rep for this object. |
|
|
|
* @return the package name. |
|
|
|
*/ |
|
|
|
public String toString() { |
|
|
|
return getName(); |
|
|
@@ -341,7 +342,7 @@ public class Javadoc extends Task { |
|
|
|
*/ |
|
|
|
public static class AccessType extends EnumeratedAttribute { |
|
|
|
/** |
|
|
|
* @see EnumeratedAttribute#getValues(). |
|
|
|
* @return the allowed values for the access type. |
|
|
|
*/ |
|
|
|
public String[] getValues() { |
|
|
|
// Protected first so if any GUI tool offers a default |
|
|
@@ -359,9 +360,18 @@ public class Javadoc extends Task { |
|
|
|
*/ |
|
|
|
public class ResourceCollectionContainer { |
|
|
|
private ArrayList rcs = new ArrayList(); |
|
|
|
/** |
|
|
|
* Add a resource collection to the container. |
|
|
|
* @param rc the collection to add. |
|
|
|
*/ |
|
|
|
public void add(ResourceCollection rc) { |
|
|
|
rcs.add(rc); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Get an iterator on the collection. |
|
|
|
* @return an iterator. |
|
|
|
*/ |
|
|
|
private Iterator iterator() { |
|
|
|
return rcs.iterator(); |
|
|
|
} |
|
|
@@ -1227,6 +1237,7 @@ public class Javadoc extends Task { |
|
|
|
/** |
|
|
|
* should Ant resolve the link attribute relative to the |
|
|
|
* current basedir? |
|
|
|
* @return the resolveLink attribute. |
|
|
|
*/ |
|
|
|
public boolean shouldResolveLink() { |
|
|
|
return resolveLink; |
|
|
@@ -1507,10 +1518,11 @@ public class Javadoc extends Task { |
|
|
|
public void setSource(String source) { |
|
|
|
this.source = source; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Sets the actual executable command to invoke, instead of the binary |
|
|
|
* <code>javadoc</code> found in Ant's JDK. |
|
|
|
* @param executable the command to invoke. |
|
|
|
* @since Ant 1.6.3 |
|
|
|
*/ |
|
|
|
public void setExecutable(String executable) { |
|
|
@@ -1547,6 +1559,7 @@ public class Javadoc extends Task { |
|
|
|
* Adds a container for resource collections. |
|
|
|
* |
|
|
|
* <p>All included files will be added as sourcefiles.</p> |
|
|
|
* @return the source files to configure. |
|
|
|
* @since 1.7 |
|
|
|
*/ |
|
|
|
public ResourceCollectionContainer createSourceFiles() { |
|
|
@@ -1586,6 +1599,7 @@ public class Javadoc extends Task { |
|
|
|
/** |
|
|
|
* If set to true, Ant will also accept packages that only hold |
|
|
|
* package.html files but no Java sources. |
|
|
|
* @param b a <code>boolean</code> value. |
|
|
|
* @since Ant 1.6.3 |
|
|
|
*/ |
|
|
|
public void setIncludeNoSourcePackages(boolean b) { |
|
|
@@ -1598,15 +1612,16 @@ public class Javadoc extends Task { |
|
|
|
*/ |
|
|
|
public void execute() throws BuildException { |
|
|
|
if ("javadoc2".equals(getTaskType())) { |
|
|
|
log("Warning: the task name <javadoc2> is deprecated. Use <javadoc> instead.", Project.MSG_WARN); |
|
|
|
log("Warning: the task name <javadoc2> is deprecated. Use <javadoc> instead.", |
|
|
|
Project.MSG_WARN); |
|
|
|
} |
|
|
|
|
|
|
|
// 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); |
|
|
|
boolean javadoc5 = javadoc4 && |
|
|
|
!JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_4); |
|
|
|
!JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2) |
|
|
|
&& !JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3); |
|
|
|
boolean javadoc5 = javadoc4 |
|
|
|
&& !JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_4); |
|
|
|
|
|
|
|
Vector packagesToDoc = new Vector(); |
|
|
|
Path sourceDirs = new Path(getProject()); |
|
|
@@ -1746,7 +1761,7 @@ public class Javadoc extends Task { |
|
|
|
} |
|
|
|
String link = null; |
|
|
|
if (la.shouldResolveLink()) { |
|
|
|
File hrefAsFile = |
|
|
|
File hrefAsFile = |
|
|
|
getProject().resolveFile(la.getHref()); |
|
|
|
if (hrefAsFile.exists()) { |
|
|
|
try { |
|
|
@@ -1754,7 +1769,7 @@ public class Javadoc extends Task { |
|
|
|
.toExternalForm(); |
|
|
|
} catch (MalformedURLException ex) { |
|
|
|
// should be impossible |
|
|
|
log("Warning: link location was invalid " |
|
|
|
log("Warning: link location was invalid " |
|
|
|
+ hrefAsFile, Project.MSG_WARN); |
|
|
|
} |
|
|
|
} |
|
|
@@ -1778,7 +1793,7 @@ public class Javadoc extends Task { |
|
|
|
File packageListLocation = la.getPackagelistLoc(); |
|
|
|
if (packageListLocation == null) { |
|
|
|
throw new BuildException("The package list" |
|
|
|
+ " location for link " |
|
|
|
+ " location for link " |
|
|
|
+ la.getHref() |
|
|
|
+ " must be provided " |
|
|
|
+ "because the link is " |
|
|
@@ -1874,7 +1889,7 @@ public class Javadoc extends Task { |
|
|
|
// The tag element is used as a |
|
|
|
// fileset. Parse all the files and create |
|
|
|
// -tag arguments. |
|
|
|
DirectoryScanner tagDefScanner = |
|
|
|
DirectoryScanner tagDefScanner = |
|
|
|
ta.getDirectoryScanner(getProject()); |
|
|
|
String[] files = tagDefScanner.getIncludedFiles(); |
|
|
|
for (int i = 0; i < files.length; i++) { |
|
|
@@ -1916,7 +1931,7 @@ public class Javadoc extends Task { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
String sourceArg = source != null ? source |
|
|
|
String sourceArg = source != null ? source |
|
|
|
: getProject().getProperty(MagicNames.BUILD_JAVAC_SOURCE); |
|
|
|
if (sourceArg != null) { |
|
|
|
toExecute.createArgument().setValue("-source"); |
|
|
@@ -2008,7 +2023,8 @@ public class Javadoc extends Task { |
|
|
|
SourceFile sf = (SourceFile) e.nextElement(); |
|
|
|
String sourceFileName = sf.getFile().getAbsolutePath(); |
|
|
|
if (useExternalFile) { |
|
|
|
// XXX what is the following doing? should it run if !javadoc4 && executable != null? |
|
|
|
// XXX what is the following doing? |
|
|
|
// should it run if !javadoc4 && executable != null? |
|
|
|
if (javadoc4 && sourceFileName.indexOf(" ") > -1) { |
|
|
|
String name = sourceFileName; |
|
|
|
if (File.separatorChar == '\\') { |
|
|
@@ -2163,7 +2179,7 @@ public class Javadoc extends Task { |
|
|
|
} |
|
|
|
return buf.toString(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Add the files matched by the nested source files to the Vector |
|
|
|
* as SourceFile instances. |
|
|
@@ -2269,7 +2285,7 @@ public class Javadoc extends Task { |
|
|
|
String[] files = pd.list(new FilenameFilter () { |
|
|
|
public boolean accept(File dir1, String name) { |
|
|
|
return name.endsWith(".java") |
|
|
|
|| (includeNoSourcePackages |
|
|
|
|| (includeNoSourcePackages |
|
|
|
&& name.equals("package.html")); |
|
|
|
} |
|
|
|
}); |
|
|
|