Methods Summary |
---|
private void | addArgIf(boolean b, java.lang.String arg)Utility method to add an argument to the command line conditionally
based on the given flag.
if (b) {
cmd.createArgument().setValue(arg);
}
|
private void | addArgIfNotEmpty(java.lang.String key, java.lang.String value)Utility method to add a Javadoc argument.
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);
}
|
public void | addBottom(org.apache.tools.ant.taskdefs.Javadoc$Html text)Set the text to be placed at the bottom of each output file.
bottom = text;
|
public void | addDoctitle(org.apache.tools.ant.taskdefs.Javadoc$Html text)Add a document title to use for the overview page.
doctitle = text;
|
public void | addExcludePackage(org.apache.tools.ant.taskdefs.Javadoc$PackageName pn)Add a package to be excluded from the Javadoc run.
excludePackageNames.addElement(pn);
|
public void | addFileset(org.apache.tools.ant.types.FileSet fs)Adds a fileset.
All included files will be added as sourcefiles. The task
will automatically add
includes="**/*.java" to the
fileset.
createSourceFiles().add(fs);
|
public void | addFooter(org.apache.tools.ant.taskdefs.Javadoc$Html text)Set the footer text to be placed at the bottom of each output file.
footer = text;
|
public void | addHeader(org.apache.tools.ant.taskdefs.Javadoc$Html text)Set the header text to be placed at the top of each output file.
header = text;
|
public void | addPackage(org.apache.tools.ant.taskdefs.Javadoc$PackageName pn)Add a single package to be processed.
If the package name ends with ".*" the Javadoc task
will find and process all subpackages.
packageNames.addElement(pn);
|
public void | addPackageset(org.apache.tools.ant.types.DirSet packageSet)Adds a packageset.
All included directories will be translated into package
names be converting the directory separator into dots.
packageSets.addElement(packageSet);
|
public void | addSource(org.apache.tools.ant.taskdefs.Javadoc$SourceFile sf)Add a single source file.
sourceFiles.addElement(sf);
|
private void | addSourceFiles(java.util.Vector sf)Add the files matched by the nested source files to the Vector
as SourceFile instances.
Iterator e = nestedSourceFiles.iterator();
while (e.hasNext()) {
ResourceCollection rc = (ResourceCollection) e.next();
if (!rc.isFilesystemOnly()) {
throw new BuildException("only file system based resources are"
+ " supported by javadoc");
}
if (rc instanceof FileSet) {
FileSet fs = (FileSet) rc;
if (!fs.hasPatterns() && !fs.hasSelectors()) {
fs = (FileSet) fs.clone();
fs.createInclude().setName("**/*.java");
if (includeNoSourcePackages) {
fs.createInclude().setName("**/package.html");
}
}
}
Iterator iter = rc.iterator();
while (iter.hasNext()) {
sf.addElement(new SourceFile(((FileResource) iter.next())
.getFile()));
}
}
|
public void | addTaglet(org.apache.tools.ant.taskdefs.Javadoc$ExtensionInfo tagletInfo)Add a taglet
tags.addElement(tagletInfo);
|
public Commandline.Argument | createArg()Adds a command-line argument.
return cmd.createArgument();
|
public org.apache.tools.ant.types.Path | createBootclasspath()Create a Path to be configured with the boot classpath
if (bootclasspath == null) {
bootclasspath = new Path(getProject());
}
return bootclasspath.createPath();
|
public org.apache.tools.ant.types.Path | createClasspath()Create a Path to be configured with the classpath to use
if (classpath == null) {
classpath = new Path(getProject());
}
return classpath.createPath();
|
public org.apache.tools.ant.taskdefs.Javadoc$DocletInfo | createDoclet()Create a doclet to be used in the documentation generation.
if (doclet == null) {
doclet = new DocletInfo();
}
return doclet;
|
public org.apache.tools.ant.taskdefs.Javadoc$GroupArgument | createGroup()Separates packages on the overview page into whatever
groups you specify, one group per table.
GroupArgument ga = new GroupArgument();
groups.addElement(ga);
return ga;
|
public org.apache.tools.ant.taskdefs.Javadoc$LinkArgument | createLink()Create link to Javadoc output at the given URL.
LinkArgument la = new LinkArgument();
links.addElement(la);
return la;
|
public org.apache.tools.ant.taskdefs.Javadoc$ResourceCollectionContainer | createSourceFiles()Adds a container for resource collections.
All included files will be added as sourcefiles.
return nestedSourceFiles;
|
public org.apache.tools.ant.types.Path | createSourcepath()Create a path to be configured with the locations of the source
files.
if (sourcePath == null) {
sourcePath = new Path(getProject());
}
return sourcePath.createPath();
|
public org.apache.tools.ant.taskdefs.Javadoc$TagArgument | createTag()Creates and adds a -tag argument. This is used to specify
custom tags. This argument is only available for Javadoc 1.4,
and will generate a verbose message (and then be ignored)
when run on Java versions below 1.4.
TagArgument ta = new TagArgument();
tags.addElement (ta);
return ta;
|
public void | execute()Execute the task.
if ("javadoc2".equals(getTaskType())) {
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);
Vector packagesToDoc = new Vector();
Path sourceDirs = new Path(getProject());
if (packageList != null && sourcePath == null) {
String msg = "sourcePath attribute must be set when "
+ "specifying packagelist.";
throw new BuildException(msg);
}
if (sourcePath != null) {
sourceDirs.addExisting(sourcePath);
}
parsePackages(packagesToDoc, sourceDirs);
if (packagesToDoc.size() != 0 && sourceDirs.size() == 0) {
String msg = "sourcePath attribute must be set when "
+ "specifying package names.";
throw new BuildException(msg);
}
Vector sourceFilesToDoc = (Vector) sourceFiles.clone();
addSourceFiles(sourceFilesToDoc);
if (packageList == null && packagesToDoc.size() == 0
&& sourceFilesToDoc.size() == 0) {
throw new BuildException("No source files and no packages have "
+ "been specified.");
}
log("Generating Javadoc", Project.MSG_INFO);
Commandline toExecute = (Commandline) cmd.clone();
if (executable != null) {
toExecute.setExecutable(executable);
} else {
toExecute.setExecutable(JavaEnvUtils.getJdkExecutable("javadoc"));
}
// ------------------------------------------ general Javadoc arguments
if (doctitle != null) {
toExecute.createArgument().setValue("-doctitle");
toExecute.createArgument().setValue(expand(doctitle.getText()));
}
if (header != null) {
toExecute.createArgument().setValue("-header");
toExecute.createArgument().setValue(expand(header.getText()));
}
if (footer != null) {
toExecute.createArgument().setValue("-footer");
toExecute.createArgument().setValue(expand(footer.getText()));
}
if (bottom != null) {
toExecute.createArgument().setValue("-bottom");
toExecute.createArgument().setValue(expand(bottom.getText()));
}
if (classpath == null) {
classpath = (new Path(getProject())).concatSystemClasspath("last");
} else {
classpath = classpath.concatSystemClasspath("ignore");
}
if (classpath.size() > 0) {
toExecute.createArgument().setValue("-classpath");
toExecute.createArgument().setPath(classpath);
}
if (sourceDirs.size() > 0) {
toExecute.createArgument().setValue("-sourcepath");
toExecute.createArgument().setPath(sourceDirs);
}
if (version && doclet == null) {
toExecute.createArgument().setValue("-version");
}
if (author && doclet == null) {
toExecute.createArgument().setValue("-author");
}
if (doclet == null && destDir == null) {
throw new BuildException("destdir attribute must be set!");
}
// ---------------------------- javadoc2 arguments for default doclet
if (doclet != null) {
if (doclet.getName() == null) {
throw new BuildException("The doclet name must be "
+ "specified.", getLocation());
} else {
toExecute.createArgument().setValue("-doclet");
toExecute.createArgument().setValue(doclet.getName());
if (doclet.getPath() != null) {
Path docletPath
= doclet.getPath().concatSystemClasspath("ignore");
if (docletPath.size() != 0) {
toExecute.createArgument().setValue("-docletpath");
toExecute.createArgument().setPath(docletPath);
}
}
for (Enumeration e = doclet.getParams();
e.hasMoreElements();) {
DocletParam param = (DocletParam) e.nextElement();
if (param.getName() == null) {
throw new BuildException("Doclet parameters must "
+ "have a name");
}
toExecute.createArgument().setValue(param.getName());
if (param.getValue() != null) {
toExecute.createArgument()
.setValue(param.getValue());
}
}
}
}
Path bcp = new Path(getProject());
if (bootclasspath != null) {
bcp.append(bootclasspath);
}
bcp = bcp.concatSystemBootClasspath("ignore");
if (bcp.size() > 0) {
toExecute.createArgument().setValue("-bootclasspath");
toExecute.createArgument().setPath(bcp);
}
// add the links arguments
if (links.size() != 0) {
for (Enumeration e = links.elements(); e.hasMoreElements();) {
LinkArgument la = (LinkArgument) e.nextElement();
if (la.getHref() == null || la.getHref().length() == 0) {
log("No href was given for the link - skipping",
Project.MSG_VERBOSE);
continue;
}
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()
+ "\" is not a valid url - skipping link",
Project.MSG_WARN);
continue;
}
}
if (la.isLinkOffline()) {
File packageListLocation = la.getPackagelistLoc();
if (packageListLocation == null) {
throw new BuildException("The package list"
+ " location for link "
+ la.getHref()
+ " must be provided "
+ "because the link is "
+ "offline");
}
File packageListFile =
new File(packageListLocation, "package-list");
if (packageListFile.exists()) {
try {
String packageListURL =
FILE_UTILS.getFileURL(packageListLocation)
.toExternalForm();
toExecute.createArgument()
.setValue("-linkoffline");
toExecute.createArgument()
.setValue(link);
toExecute.createArgument()
.setValue(packageListURL);
} catch (MalformedURLException ex) {
log("Warning: Package list location was "
+ "invalid " + packageListLocation,
Project.MSG_WARN);
}
} else {
log("Warning: No package list was found at "
+ packageListLocation, Project.MSG_VERBOSE);
}
} else {
toExecute.createArgument().setValue("-link");
toExecute.createArgument().setValue(link);
}
}
}
// add the single group arguments
// Javadoc 1.2 rules:
// Multiple -group args allowed.
// Each arg includes 3 strings: -group [name] [packagelist].
// Elements in [packagelist] are colon-delimited.
// An element in [packagelist] may end with the * wildcard.
// Ant javadoc task rules for group attribute:
// Args are comma-delimited.
// Each arg is 2 space-delimited strings.
// E.g., group="XSLT_Packages org.apache.xalan.xslt*,
// XPath_Packages org.apache.xalan.xpath*"
if (group != null) {
StringTokenizer tok = new StringTokenizer(group, ",", false);
while (tok.hasMoreTokens()) {
String grp = tok.nextToken().trim();
int space = grp.indexOf(" ");
if (space > 0) {
String name = grp.substring(0, space);
String pkgList = grp.substring(space + 1);
toExecute.createArgument().setValue("-group");
toExecute.createArgument().setValue(name);
toExecute.createArgument().setValue(pkgList);
}
}
}
// add the group arguments
if (groups.size() != 0) {
for (Enumeration e = groups.elements(); e.hasMoreElements();) {
GroupArgument ga = (GroupArgument) e.nextElement();
String title = ga.getTitle();
String packages = ga.getPackages();
if (title == null || packages == null) {
throw new BuildException("The title and packages must "
+ "be specified for group "
+ "elements.");
}
toExecute.createArgument().setValue("-group");
toExecute.createArgument().setValue(expand(title));
toExecute.createArgument().setValue(packages);
}
}
// Javadoc 1.4 parameters
if (javadoc4 || executable != null) {
for (Enumeration e = tags.elements(); e.hasMoreElements();) {
Object element = e.nextElement();
if (element instanceof TagArgument) {
TagArgument ta = (TagArgument) element;
File tagDir = ta.getDir(getProject());
if (tagDir == null) {
// The tag element is not used as a fileset,
// but specifies the tag directly.
toExecute.createArgument().setValue ("-tag");
toExecute.createArgument()
.setValue (ta.getParameter());
} else {
// The tag element is used as a
// fileset. Parse all the files and create
// -tag arguments.
DirectoryScanner tagDefScanner =
ta.getDirectoryScanner(getProject());
String[] files = tagDefScanner.getIncludedFiles();
for (int i = 0; i < files.length; i++) {
File tagDefFile = new File(tagDir, files[i]);
try {
BufferedReader in
= new BufferedReader(
new FileReader(tagDefFile)
);
String line = null;
while ((line = in.readLine()) != null) {
toExecute.createArgument()
.setValue("-tag");
toExecute.createArgument()
.setValue(line);
}
in.close();
} catch (IOException ioe) {
throw new BuildException("Couldn't read "
+ " tag file from "
+ tagDefFile.getAbsolutePath(), ioe);
}
}
}
} else {
ExtensionInfo tagletInfo = (ExtensionInfo) element;
toExecute.createArgument().setValue("-taglet");
toExecute.createArgument().setValue(tagletInfo
.getName());
if (tagletInfo.getPath() != null) {
Path tagletPath = tagletInfo.getPath()
.concatSystemClasspath("ignore");
if (tagletPath.size() != 0) {
toExecute.createArgument()
.setValue("-tagletpath");
toExecute.createArgument().setPath(tagletPath);
}
}
}
}
String sourceArg = source != null ? source
: getProject().getProperty(MagicNames.BUILD_JAVAC_SOURCE);
if (sourceArg != null) {
toExecute.createArgument().setValue("-source");
toExecute.createArgument().setValue(sourceArg);
}
if (linksource && doclet == null) {
toExecute.createArgument().setValue("-linksource");
}
if (breakiterator && (doclet == null || javadoc5)) {
toExecute.createArgument().setValue("-breakiterator");
}
if (noqualifier != null && doclet == null) {
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);
}
}
// If using an external file, write the command line options to it
if (useExternalFile && javadoc4) {
writeExternalArgs(toExecute);
}
File tmpList = null;
PrintWriter srcListWriter = null;
try {
/**
* Write sourcefiles and package names to a temporary file
* if requested.
*/
if (useExternalFile) {
if (tmpList == null) {
tmpList = FILE_UTILS.createTempFile("javadoc", "", null);
tmpList.deleteOnExit();
toExecute.createArgument()
.setValue("@" + tmpList.getAbsolutePath());
}
srcListWriter = new PrintWriter(
new FileWriter(tmpList.getAbsolutePath(),
true));
}
Enumeration e = packagesToDoc.elements();
while (e.hasMoreElements()) {
String packageName = (String) e.nextElement();
if (useExternalFile) {
srcListWriter.println(packageName);
} else {
toExecute.createArgument().setValue(packageName);
}
}
e = sourceFilesToDoc.elements();
while (e.hasMoreElements()) {
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?
if (javadoc4 && sourceFileName.indexOf(" ") > -1) {
String name = sourceFileName;
if (File.separatorChar == '\\") {
name = sourceFileName.replace(File.separatorChar, '/");
}
srcListWriter.println("\"" + name + "\"");
} else {
srcListWriter.println(sourceFileName);
}
} else {
toExecute.createArgument().setValue(sourceFileName);
}
}
} catch (IOException e) {
tmpList.delete();
throw new BuildException("Error creating temporary file",
e, getLocation());
} finally {
if (srcListWriter != null) {
srcListWriter.close();
}
}
if (packageList != null) {
toExecute.createArgument().setValue("@" + packageList);
}
log(toExecute.describeCommand(), Project.MSG_VERBOSE);
log("Javadoc execution", Project.MSG_INFO);
JavadocOutputStream out = new JavadocOutputStream(Project.MSG_INFO);
JavadocOutputStream err = new JavadocOutputStream(Project.MSG_WARN);
Execute exe = new Execute(new PumpStreamHandler(out, err));
exe.setAntRun(getProject());
/*
* No reason to change the working directory as all filenames and
* path components have been resolved already.
*
* Avoid problems with command line length in some environments.
*/
exe.setWorkingDirectory(null);
try {
exe.setCommandline(toExecute.getCommandline());
int ret = exe.execute();
if (ret != 0 && failOnError) {
throw new BuildException("Javadoc returned " + ret,
getLocation());
}
} catch (IOException e) {
throw new BuildException("Javadoc failed: " + e, e, getLocation());
} finally {
if (tmpList != null) {
tmpList.delete();
tmpList = null;
}
out.logFlush();
err.logFlush();
try {
out.close();
err.close();
} catch (IOException e) {
// ignore
}
}
|
protected java.lang.String | expand(java.lang.String content)Convenience method to expand properties.
return getProject().replaceProperties(content);
|
private void | parsePackages(java.util.Vector pn, org.apache.tools.ant.types.Path sp)Add the directories matched by the nested dirsets to the Vector
and the base directories of the dirsets to the Path. It also
handles the packages and excludepackages attributes and
elements.
Vector addedPackages = new Vector();
Vector dirSets = (Vector) packageSets.clone();
// for each sourcePath entry, add a directoryset with includes
// taken from packagenames attribute and nested package
// elements and excludes taken from excludepackages attribute
// and nested excludepackage elements
if (sourcePath != null) {
PatternSet ps = new PatternSet();
if (packageNames.size() > 0) {
Enumeration e = packageNames.elements();
while (e.hasMoreElements()) {
PackageName p = (PackageName) e.nextElement();
String pkg = p.getName().replace('.", '/");
if (pkg.endsWith("*")) {
pkg += "*";
}
ps.createInclude().setName(pkg);
}
} else {
ps.createInclude().setName("**");
}
Enumeration e = excludePackageNames.elements();
while (e.hasMoreElements()) {
PackageName p = (PackageName) e.nextElement();
String pkg = p.getName().replace('.", '/");
if (pkg.endsWith("*")) {
pkg += "*";
}
ps.createExclude().setName(pkg);
}
String[] pathElements = sourcePath.list();
for (int i = 0; i < pathElements.length; i++) {
File dir = new File(pathElements[i]);
if (dir.isDirectory()) {
DirSet ds = new DirSet();
ds.setDefaultexcludes(useDefaultExcludes);
ds.setDir(dir);
ds.createPatternSet().addConfiguredPatternset(ps);
dirSets.addElement(ds);
} else {
log("Skipping " + pathElements[i]
+ " since it is no directory.", Project.MSG_WARN);
}
}
}
Enumeration e = dirSets.elements();
while (e.hasMoreElements()) {
DirSet ds = (DirSet) e.nextElement();
File baseDir = ds.getDir(getProject());
log("scanning " + baseDir + " for packages.", Project.MSG_DEBUG);
DirectoryScanner dsc = ds.getDirectoryScanner(getProject());
String[] dirs = dsc.getIncludedDirectories();
boolean containsPackages = false;
for (int i = 0; i < dirs.length; i++) {
// are there any java files in this directory?
File pd = new File(baseDir, dirs[i]);
String[] files = pd.list(new FilenameFilter () {
public boolean accept(File dir1, String name) {
return name.endsWith(".java")
|| (includeNoSourcePackages
&& name.equals("package.html"));
}
});
if (files.length > 0) {
if ("".equals(dirs[i])) {
log(baseDir
+ " contains source files in the default package,"
+ " you must specify them as source files"
+ " not packages.",
Project.MSG_WARN);
} else {
containsPackages = true;
String packageName =
dirs[i].replace(File.separatorChar, '.");
if (!addedPackages.contains(packageName)) {
addedPackages.addElement(packageName);
pn.addElement(packageName);
}
}
}
}
if (containsPackages) {
// We don't need to care for duplicates here,
// Path.list does it for us.
sp.createPathElement().setLocation(baseDir);
} else {
log(baseDir + " doesn\'t contain any packages, dropping it.",
Project.MSG_VERBOSE);
}
}
|
private java.lang.String | quoteString(java.lang.String str)Quote a string to place in a @ file.
if (str.indexOf(' ") == -1
&& str.indexOf('\'") == -1
&& str.indexOf('"") == -1) {
return str;
}
if (str.indexOf('\'") == -1) {
return quoteString(str, '\'");
} else {
return quoteString(str, '"");
}
|
private java.lang.String | quoteString(java.lang.String str, char delim)
StringBuffer buf = new StringBuffer(str.length() * 2);
buf.append(delim);
if (str.indexOf('\\") != -1) {
str = replace(str, '\\", "\\\\");
}
if (str.indexOf(delim) != -1) {
str = replace(str, delim, "\\" + delim);
}
buf.append(str);
buf.append(delim);
return buf.toString();
|
private java.lang.String | replace(java.lang.String str, char fromChar, java.lang.String toString)
StringBuffer buf = new StringBuffer(str.length() * 2);
for (int i = 0; i < str.length(); ++i) {
char ch = str.charAt(i);
if (ch == fromChar) {
buf.append(toString);
} else {
buf.append(ch);
}
}
return buf.toString();
|
public void | setAccess(org.apache.tools.ant.taskdefs.Javadoc$AccessType at)Set the scope to be processed. This is an alternative to the
use of the setPublic, setPrivate, etc methods. It gives better build
file control over what scope is processed.
cmd.createArgument().setValue("-" + at.getValue());
|
public void | setAdditionalparam(java.lang.String add)Set an additional parameter on the command line
cmd.createArgument().setLine(add);
|
public void | setAuthor(boolean b)Include the author tag in the generated documentation.
author = b;
|
public void | setBootClasspathRef(org.apache.tools.ant.types.Reference r)Adds a reference to a CLASSPATH defined elsewhere.
createBootclasspath().setRefid(r);
|
public void | setBootclasspath(org.apache.tools.ant.types.Path path)Set the boot classpath to use.
if (bootclasspath == null) {
bootclasspath = path;
} else {
bootclasspath.append(path);
}
|
public void | setBottom(java.lang.String bottom)Set the text to be placed at the bottom of each output file.
Html h = new Html();
h.addText(bottom);
addBottom(h);
|
public void | setBreakiterator(boolean b)Enables the -linksource switch, will be ignored if Javadoc is not
the 1.4 version. Default is false
this.breakiterator = b;
|
public void | setCharset(java.lang.String src)Charset for cross-platform viewing of generated documentation.
this.addArgIfNotEmpty("-charset", src);
|
public void | setClasspath(org.apache.tools.ant.types.Path path)Set the classpath to be used for this Javadoc run.
if (classpath == null) {
classpath = path;
} else {
classpath.append(path);
}
|
public void | setClasspathRef(org.apache.tools.ant.types.Reference r)Adds a reference to a CLASSPATH defined elsewhere.
createClasspath().setRefid(r);
|
public void | setDefaultexcludes(boolean useDefaultExcludes)Sets whether default exclusions should be used or not.
this.useDefaultExcludes = useDefaultExcludes;
|
public void | setDestdir(java.io.File dir)Set the directory where the Javadoc output will be generated.
destDir = dir;
cmd.createArgument().setValue("-d");
cmd.createArgument().setFile(destDir);
|
public void | setDocencoding(java.lang.String enc)Output file encoding name.
cmd.createArgument().setValue("-docencoding");
cmd.createArgument().setValue(enc);
|
public void | setDoclet(java.lang.String docletName)Set the class that starts the doclet used in generating the
documentation.
if (doclet == null) {
doclet = new DocletInfo();
doclet.setProject(getProject());
}
doclet.setName(docletName);
|
public void | setDocletPath(org.apache.tools.ant.types.Path docletPath)Set the classpath used to find the doclet class.
if (doclet == null) {
doclet = new DocletInfo();
doclet.setProject(getProject());
}
doclet.setPath(docletPath);
|
public void | setDocletPathRef(org.apache.tools.ant.types.Reference r)Set the classpath used to find the doclet class by reference.
if (doclet == null) {
doclet = new DocletInfo();
doclet.setProject(getProject());
}
doclet.createPath().setRefid(r);
|
public void | setDoctitle(java.lang.String doctitle)Set the title of the generated overview page.
Html h = new Html();
h.addText(doctitle);
addDoctitle(h);
|
public void | setEncoding(java.lang.String enc)Set the encoding name of the source files,
cmd.createArgument().setValue("-encoding");
cmd.createArgument().setValue(enc);
|
public void | setExcludePackageNames(java.lang.String packages)Set the list of packages to be excluded.
StringTokenizer tok = new StringTokenizer(packages, ",");
while (tok.hasMoreTokens()) {
String p = tok.nextToken();
PackageName pn = new PackageName();
pn.setName(p);
addExcludePackage(pn);
}
|
public void | setExecutable(java.lang.String executable)Sets the actual executable command to invoke, instead of the binary
javadoc found in Ant's JDK.
this.executable = executable;
|
public void | setExtdirs(java.lang.String path)Set the location of the extensions directories.
cmd.createArgument().setValue("-extdirs");
cmd.createArgument().setValue(path);
|
public void | setExtdirs(org.apache.tools.ant.types.Path path)Set the location of the extensions directories.
cmd.createArgument().setValue("-extdirs");
cmd.createArgument().setPath(path);
|
public void | setFailonerror(boolean b)Should the build process fail if Javadoc fails (as indicated by
a non zero return code)?
Default is false.
failOnError = b;
|
public void | setFooter(java.lang.String footer)Set the footer text to be placed at the bottom of each output file.
Html h = new Html();
h.addText(footer);
addFooter(h);
|
public void | setGroup(java.lang.String src)Group specified packages together in overview page.
group = src;
|
public void | setHeader(java.lang.String header)Set the header text to be placed at the top of each output file.
Html h = new Html();
h.addText(header);
addHeader(h);
|
public void | setHelpfile(java.io.File f)Specifies the HTML help file to use.
cmd.createArgument().setValue("-helpfile");
cmd.createArgument().setFile(f);
|
public void | setIncludeNoSourcePackages(boolean b)If set to true, Ant will also accept packages that only hold
package.html files but no Java sources.
this.includeNoSourcePackages = b;
|
public void | setLink(java.lang.String src)Create links to Javadoc output at the given URL.
createLink().setHref(src);
|
public void | setLinkoffline(java.lang.String src)Link to docs at "url" using package list at "url2"
- separate the URLs by using a space character.
LinkArgument le = createLink();
le.setOffline(true);
String linkOfflineError = "The linkoffline attribute must include"
+ " a URL and a package-list file location separated by a"
+ " space";
if (src.trim().length() == 0) {
throw new BuildException(linkOfflineError);
}
StringTokenizer tok = new StringTokenizer(src, " ", false);
le.setHref(tok.nextToken());
if (!tok.hasMoreTokens()) {
throw new BuildException(linkOfflineError);
}
le.setPackagelistLoc(getProject().resolveFile(tok.nextToken()));
|
public void | setLinksource(boolean b)Enables the -linksource switch, will be ignored if Javadoc is not
the 1.4 version. Default is false
this.linksource = b;
|
public void | setLocale(java.lang.String locale)Set the local to use in documentation generation.
// 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");
|
public void | setMaxmemory(java.lang.String max)Set the maximum memory to be used by the javadoc process
cmd.createArgument().setValue("-J-Xmx" + max);
|
public void | setNodeprecated(boolean b)Control deprecation infromation
addArgIf(b, "-nodeprecated");
|
public void | setNodeprecatedlist(boolean b)Control deprecated list generation
addArgIf(b, "-nodeprecatedlist");
|
public void | setNohelp(boolean b)Control generation of help link.
addArgIf(b, "-nohelp");
|
public void | setNoindex(boolean b)Control generation of index.
addArgIf(b, "-noindex");
|
public void | setNonavbar(boolean b)Control generation of the navigation bar.
addArgIf(b, "-nonavbar");
|
public void | setNoqualifier(java.lang.String noqualifier)Enables the -noqualifier switch, will be ignored if Javadoc is not
the 1.4 version.
this.noqualifier = noqualifier;
|
public void | setNotree(boolean b)Control class tree generation.
addArgIf(b, "-notree");
|
public void | setOld(boolean b)Indicate whether Javadoc should produce old style (JDK 1.1)
documentation.
This is not supported by JDK 1.1 and has been phased out in JDK 1.4
old = b;
|
public void | setOverview(java.io.File f)Specify the file containing the overview to be included in the generated
documentation.
cmd.createArgument().setValue("-overview");
cmd.createArgument().setFile(f);
|
public void | setPackage(boolean b)Indicate whether only package, protected and public classes and
members are to be included in the scope processed
addArgIf(b, "-package");
|
public void | setPackageList(java.lang.String src)The name of a file containing the packages to process.
packageList = src;
|
public void | setPackagenames(java.lang.String packages)Set the package names to be processed.
StringTokenizer tok = new StringTokenizer(packages, ",");
while (tok.hasMoreTokens()) {
String p = tok.nextToken();
PackageName pn = new PackageName();
pn.setName(p);
addPackage(pn);
}
|
public void | setPrivate(boolean b)Indicate whether all classes and
members are to be included in the scope processed
addArgIf(b, "-private");
|
public void | setProtected(boolean b)Indicate whether only protected and public classes and members are to
be included in the scope processed
addArgIf(b, "-protected");
|
public void | setPublic(boolean b)Indicate whether only public classes and members are to be included in
the scope processed
addArgIf(b, "-public");
|
public void | setSerialwarn(boolean b)Control warnings about serial tag.
addArgIf(b, "-serialwarn");
|
public void | setSource(java.lang.String source)Enables the -source switch, will be ignored if Javadoc is not
the 1.4 version.
this.source = source;
|
public void | setSourcefiles(java.lang.String src)Set the list of source files to process.
StringTokenizer tok = new StringTokenizer(src, ",");
while (tok.hasMoreTokens()) {
String f = tok.nextToken();
SourceFile sf = new SourceFile();
sf.setFile(getProject().resolveFile(f.trim()));
addSource(sf);
}
|
public void | setSourcepath(org.apache.tools.ant.types.Path src)Specify where to find source file
if (sourcePath == null) {
sourcePath = src;
} else {
sourcePath.append(src);
}
|
public void | setSourcepathRef(org.apache.tools.ant.types.Reference r)Adds a reference to a CLASSPATH defined elsewhere.
createSourcepath().setRefid(r);
|
public void | setSplitindex(boolean b)Generate a split index
addArgIf(b, "-splitindex");
|
public void | setStylesheetfile(java.io.File f)Specifies the CSS stylesheet file to use.
cmd.createArgument().setValue("-stylesheetfile");
cmd.createArgument().setFile(f);
|
public void | setUse(boolean b)Generate the "use" page for each package.
addArgIf(b, "-use");
|
public void | setUseExternalFile(boolean b)Work around command line length limit by using an external file
for the sourcefiles.
useExternalFile = b;
|
public void | setVerbose(boolean b)Run javadoc in verbose mode
addArgIf(b, "-verbose");
|
public void | setVersion(boolean b)Include the version tag in the generated documentation.
this.version = b;
|
public void | setWindowtitle(java.lang.String title)Set the title to be placed in the HTML <title> tag of the
generated documentation.
addArgIfNotEmpty("-windowtitle", title);
|
private void | writeExternalArgs(org.apache.tools.ant.types.Commandline toExecute)
// If using an external file, write the command line options to it
File optionsTmpFile = null;
PrintWriter optionsListWriter = null;
try {
optionsTmpFile = FILE_UTILS.createTempFile(
"javadocOptions", "", null);
optionsTmpFile.deleteOnExit();
String[] listOpt = toExecute.getArguments();
toExecute.clearArgs();
toExecute.createArgument().setValue(
"@" + optionsTmpFile.getAbsolutePath());
optionsListWriter = new PrintWriter(
new FileWriter(optionsTmpFile.getAbsolutePath(), true));
for (int i = 0; i < listOpt.length; i++) {
String string = listOpt[i];
if (string.startsWith("-J-")) {
toExecute.createArgument().setValue(string);
} else {
if (string.startsWith("-")) {
optionsListWriter.print(string);
optionsListWriter.print(" ");
} else {
optionsListWriter.println(quoteString(string));
}
}
}
optionsListWriter.close();
} catch (IOException ex) {
if (optionsTmpFile != null) {
optionsTmpFile.delete();
}
throw new BuildException(
"Error creating or writing temporary file for javadoc options",
ex, getLocation());
} finally {
FILE_UTILS.close(optionsListWriter);
}
|