瀏覽代碼

240234, comment 19 - patch for ajdoc

tags/V162DEV_M1
aclement 16 年之前
父節點
當前提交
84af74fbe9
共有 1 個文件被更改,包括 58 次插入10 次删除
  1. 58
    10
      taskdefs/src/org/aspectj/tools/ant/taskdefs/Ajdoc.java

+ 58
- 10
taskdefs/src/org/aspectj/tools/ant/taskdefs/Ajdoc.java 查看文件

import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.util.Vector;


import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Location; import org.apache.tools.ant.Location;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.taskdefs.Javadoc.AccessType;
import org.apache.tools.ant.taskdefs.Javadoc.Html;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Reference; import org.apache.tools.ant.types.Reference;
import org.aspectj.tools.ajdoc.Main; import org.aspectj.tools.ajdoc.Main;
private Doclet doclet; private Doclet doclet;
private boolean failonerror; private boolean failonerror;
private boolean fork; private boolean fork;
private boolean source14;
private String source;
private Html bottom;
private Vector fileSets = new Vector();
/** reset all to initial values - permit gc if Ajdoc is held */ /** reset all to initial values - permit gc if Ajdoc is held */
public Ajdoc() { public Ajdoc() {
reset(); reset();
doclet = null; doclet = null;
failonerror = false; failonerror = false;
fork = false; fork = false;
source = null;
bottom = null;
} }


protected final boolean setif(boolean b, String flag) { protected final boolean setif(boolean b, String flag) {
} }
public void setSource(String input) { public void setSource(String input) {
source14 = "1.4".equals(input);
source = input;
} }


public void setSourcepath(Path path) { public void setSourcepath(Path path) {
sourcefiles).addAll(strings(list)); sourcefiles).addAll(strings(list));
} }


public void addFileset(FileSet fs) {
fileSets.addElement(fs);
}
private void addFileSets() {
if(sourcefiles == null)
sourcefiles = new ArrayList();
Enumeration e = fileSets.elements();
while (e.hasMoreElements()) {
FileSet fs = (FileSet) e.nextElement();
if (!fs.hasPatterns() && !fs.hasSelectors()) {
fs = (FileSet) fs.clone();
fs.createInclude().setName("**/*.java");
fs.createInclude().setName("**/*.aj");
}
File baseDir = fs.getDir(getProject());
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
String[] files = ds.getIncludedFiles();
for (int i = 0; i < files.length; i++) {
sourcefiles.add((new File(baseDir, files[i])).getAbsolutePath());
}
}
}
public void setPackagenames(String list) { public void setPackagenames(String list) {
(packagenames == null ? (packagenames == null ?
packagenames = new ArrayList() : packagenames = new ArrayList() :
packagenames).addAll(strings(list, true)); packagenames).addAll(strings(list, true));
} }

public void setAccess(AccessType at) {
cmd.createArgument().setValue("-" + at.getValue());
}
public void setPackageList(String packageList) { public void setPackageList(String packageList) {
this.packageList = getProject().resolveFile(packageList); this.packageList = getProject().resolveFile(packageList);
} }
} }


public void setBottom(String bottom) { public void setBottom(String bottom) {
set("-bottom", bottom);
Html html = new Html();
html.addText(bottom);
addBottom(html);
} }


public void addBottom(Html text) {
bottom = text;
}
public void setVerbose(boolean b) { public void setVerbose(boolean b) {
setif(b, "-verbose"); setif(b, "-verbose");
} }
} }


public void execute() throws BuildException { public void execute() throws BuildException {
if (sourcepath == null && argfiles == null) {
if (sourcepath == null && argfiles == null && fileSets.size() == 0) {
throw new BuildException("one of sourcepath or argfiles must be set!", throw new BuildException("one of sourcepath or argfiles must be set!",
getLocation()); getLocation());
} }
cmd.createArgument().setValue("-extdirs"); cmd.createArgument().setValue("-extdirs");
cmd.createArgument().setPath(extdirs); cmd.createArgument().setPath(extdirs);
} }
if (source14) {
if (source != null) {
cmd.createArgument().setValue("-source"); cmd.createArgument().setValue("-source");
cmd.createArgument().setValue("1.4");
cmd.createArgument().setValue(source);
}
if (bottom != null) {
cmd.createArgument().setValue("-bottom");
cmd.createArgument().setValue(getProject().replaceProperties(bottom.getText()));
} }
for (Iterator i = links.iterator(); i.hasNext();) { for (Iterator i = links.iterator(); i.hasNext();) {
} }
} }
} }

addFileSets();
if (sourcefiles != null) { if (sourcefiles != null) {
for (Iterator i = sourcefiles.iterator(); i.hasNext();) { for (Iterator i = sourcefiles.iterator(); i.hasNext();) {
// let ajdoc resolve sourcefiles relative to sourcepath, // let ajdoc resolve sourcefiles relative to sourcepath,

Loading…
取消
儲存