27 |
27 |
import org.apache.tools.ant.taskdefs.Delete;
|
28 |
28 |
import org.apache.tools.ant.taskdefs.Expand;
|
29 |
29 |
import org.apache.tools.ant.types.FileSet;
|
|
30 |
import org.apache.tools.ant.types.Path;
|
30 |
31 |
import org.kepler.build.modules.Module;
|
31 |
32 |
import org.kepler.build.modules.ModulesTask;
|
32 |
|
import org.kepler.build.project.RunClasspath;
|
|
33 |
import org.kepler.build.project.CompileClasspath;
|
|
34 |
import org.kepler.build.project.ProjectLocator;
|
33 |
35 |
import org.kepler.build.util.StreamSingleCommandExec;
|
34 |
36 |
|
35 |
37 |
import java.io.BufferedReader;
|
... | ... | |
53 |
55 |
protected boolean full;
|
54 |
56 |
protected List<String> command = new ArrayList<String>();
|
55 |
57 |
protected String sourcepath = "";
|
|
58 |
protected Path classpath = new Path(ProjectLocator.getAntProject());
|
56 |
59 |
|
57 |
60 |
/**
|
58 |
61 |
* set the module to create javadocs for
|
... | ... | |
133 |
136 |
if (moduleName.equals("undefined"))
|
134 |
137 |
{
|
135 |
138 |
addModuleSourcepaths();
|
|
139 |
addModuleCompilepaths();
|
136 |
140 |
// If -Dfull=true is specified, produce and link to documentation for Kepler and Ptolemy as well.
|
137 |
141 |
if (full)
|
138 |
142 |
{
|
... | ... | |
142 |
146 |
// Produce javadoc for only one module.
|
143 |
147 |
else
|
144 |
148 |
{
|
145 |
|
addSourcepath(Module.make(moduleName));
|
|
149 |
Module m = Module.make(moduleName);
|
|
150 |
addSourcepath(m);
|
|
151 |
addCompilepath(m);
|
146 |
152 |
}
|
147 |
153 |
|
148 |
154 |
// Always include build-area, the core/loader needs it.
|
... | ... | |
153 |
159 |
addToCommand("-d " + destDir.getAbsolutePath());
|
154 |
160 |
addToCommand("-sourcepath " + sourcepath);
|
155 |
161 |
|
156 |
|
// FIXME: this is weak, what happens when the jar is updated.
|
157 |
|
// We should switch to the native logger anyway.
|
158 |
|
String commonsLogging = Module.make("util").getLibDir()
|
159 |
|
+ "/jar/commons-logging-1.1.jar";
|
160 |
|
String ant = Module.make("build-area").getLibDir() + "/ant.jar";
|
161 |
|
RunClasspath rcp = new RunClasspath();
|
162 |
|
//CompileClasspath ccp = new CompileClasspath();
|
163 |
|
addToCommand("-classpath " + _ptolemyClassPath() + File.pathSeparator + commonsLogging
|
164 |
|
+ File.pathSeparator + ant);
|
165 |
|
//addToCommand("-classpath " + rcp.toString());
|
|
162 |
addDefaultCompilePath();
|
166 |
163 |
|
|
164 |
addToCommand("-classpath " + classpath.toString());
|
|
165 |
|
167 |
166 |
// Needed for RatingTaglet
|
168 |
167 |
String tasks = Module.make("build-area").getTargetDir()
|
169 |
168 |
+ "/kepler-tasks.jar";
|
170 |
|
addToCommand("-tagletpath " + tasks);
|
|
169 |
addToCommand("-tagletpath " + Module.make("ptolemy").getTargetDir() + "/classes");
|
171 |
170 |
|
172 |
171 |
// FIXME: what about os dependent excludes
|
173 |
172 |
String ptolemyExcludes = _ptolemyExcludes();
|
... | ... | |
177 |
176 |
}
|
178 |
177 |
|
179 |
178 |
specifyPackages("org", "com", "util", "ptolemy");
|
180 |
|
addToCommand("-link http://docs.oracle.com/javase/6/docs/api/");
|
|
179 |
addToCommand("-link http://download.oracle.com/javase/6/docs/api/");
|
181 |
180 |
command.add("-linksource");
|
182 |
181 |
command.add("-author");
|
183 |
182 |
command.add("-breakiterator");
|
... | ... | |
186 |
185 |
addToCommand("-tag Pt.AcceptedRating -tag Pt.ProposedRating ");
|
187 |
186 |
addToCommand("-tag category.name -tag UserLevelDocumentation ");
|
188 |
187 |
addToCommand("-tag created -tag entity.description -tag status");
|
189 |
|
addToCommand("-taglet org.kepler.build.RatingTaglet");
|
|
188 |
addToCommand("-taglet doc.doclets.RatingTaglet");
|
190 |
189 |
command.add("-J-Xmx768m");
|
191 |
190 |
|
192 |
191 |
final StreamSingleCommandExec exec = new StreamSingleCommandExec();
|
... | ... | |
195 |
194 |
}
|
196 |
195 |
|
197 |
196 |
/**
|
|
197 |
* Include default classpath for all javadoc builds.
|
|
198 |
*/
|
|
199 |
protected void addDefaultCompilePath()
|
|
200 |
{
|
|
201 |
classpath.addFileset(_getPtolemyFileSet());
|
|
202 |
classpath.append(new Path(ProjectLocator.getAntProject(),
|
|
203 |
new File(System.getenv().get("JAVA_HOME"),
|
|
204 |
"/lib/tools.jar").getAbsolutePath()));
|
|
205 |
addCompilepath(Module.make("build-area"));
|
|
206 |
}
|
|
207 |
|
|
208 |
/**
|
198 |
209 |
* Expand source in a jar and add it to the set of files for which javadoc is
|
199 |
210 |
* to be produced.
|
200 |
211 |
*
|
... | ... | |
255 |
266 |
}
|
256 |
267 |
|
257 |
268 |
/**
|
258 |
|
* Add the source path from which javadoc should be produced for one module.
|
|
269 |
* Add the compile path from which javadoc should be produced for one module.
|
259 |
270 |
*
|
260 |
271 |
* @param module The module for which javadoc should be produced.
|
261 |
272 |
*/
|
... | ... | |
269 |
280 |
}
|
270 |
281 |
|
271 |
282 |
/**
|
|
283 |
* Add compile paths from which javadoc should be produced for all the modules.
|
|
284 |
*/
|
|
285 |
protected void addModuleCompilepaths()
|
|
286 |
{
|
|
287 |
for (Module module : moduleTree)
|
|
288 |
{
|
|
289 |
addCompilepath(module);
|
|
290 |
}
|
|
291 |
}
|
|
292 |
|
|
293 |
/**
|
|
294 |
* Add the source path from which javadoc should be produced for one module.
|
|
295 |
*
|
|
296 |
* @param module The module for which javadoc should be produced.
|
|
297 |
*/
|
|
298 |
protected void addCompilepath(Module module)
|
|
299 |
{
|
|
300 |
if (!module.getSrc().isDirectory())
|
|
301 |
{
|
|
302 |
return;
|
|
303 |
}
|
|
304 |
CompileClasspath path = new CompileClasspath(module);
|
|
305 |
classpath.append(path);
|
|
306 |
}
|
|
307 |
|
|
308 |
/**
|
272 |
309 |
* Return a File.pathSeparator separated list of Ptolemy jar files.
|
273 |
310 |
*
|
274 |
311 |
* @return a File.pathSeparator separated list of Ptolemy jar files.
|
275 |
312 |
*/
|
276 |
|
private String _ptolemyClassPath()
|
|
313 |
private FileSet _getPtolemyFileSet()
|
277 |
314 |
{
|
278 |
315 |
PtolemyPathGenerator ptolemyPathGenerator = PtolemyPathGenerator
|
279 |
316 |
.getInstance();
|
280 |
317 |
FileSet fileSet = ptolemyPathGenerator.getFileset();
|
281 |
|
return fileSet.toString().replace(";", File.pathSeparator);
|
|
318 |
return fileSet;
|
282 |
319 |
}
|
283 |
320 |
|
284 |
321 |
/**
|