use of aQute.lib.fileset.FileSet in project bnd by bndtools.
the class Tool method doJavadoc.
public Jar doJavadoc(Map<String, String> options, boolean exportsOnly) throws Exception {
if (!hasSources())
return new Jar("javadoc");
IO.mkdirs(javadoc);
List<String> args = new ArrayList<>();
args.add("-quiet");
args.add("-protected");
args.add(String.format("%s '%s'", "-d", fileName(javadoc)));
args.add("-charset 'UTF-8'");
args.add(String.format("%s '%s'", "-sourcepath", fileName(sources)));
Properties pp = new UTF8Properties();
pp.putAll(options);
String name = manifest.getBundleName();
if (name == null)
name = manifest.getBundleSymbolicName().getKey();
String version = manifest.getBundleVersion();
if (version == null)
version = Version.LOWEST.toString();
String bundleDescription = manifest.getBundleDescription();
if (bundleDescription != null && !Strings.trim(bundleDescription).isEmpty()) {
printOverview(name, version, bundleDescription);
}
set(pp, "-doctitle", name);
set(pp, "-windowtitle", name);
set(pp, "-header", manifest.getBundleVendor());
set(pp, "-bottom", manifest.getBundleCopyright());
set(pp, "-footer", manifest.getBundleDocURL());
args.add("-tag 'Immutable:t:\"Immutable\"'");
args.add("-tag 'ThreadSafe:t:\"ThreadSafe\"'");
args.add("-tag 'NotThreadSafe:t:\"NotThreadSafe\"'");
args.add("-tag 'GuardedBy:mf:\"Guarded By:\"'");
args.add("-tag 'security:m:\"Required Permissions\"'");
args.add("-tag 'noimplement:t:\"Consumers of this API must not implement this interface\"'");
for (Enumeration<?> e = pp.propertyNames(); e.hasMoreElements(); ) {
String key = (String) e.nextElement();
String value = pp.getProperty(key);
if (key.startsWith("-")) {
//
// Allow people to add the same command multiple times
// by suffixing it with '.' something
//
int n = key.lastIndexOf('.');
if (n > 0) {
key = key.substring(0, n);
}
args.add(String.format("%s '%s'", key, escape(value)));
}
}
FileSet set = new FileSet(sources, "**.java");
for (File f : set.getFiles()) {
args.add(String.format("'%s'", fileName(f)));
}
if (exportsOnly) {
Parameters exports = manifest.getExportPackage();
for (String packageName : exports.keySet()) {
args.add(String.format("'%s'", packageName));
}
}
StringBuilder sb = new StringBuilder();
for (String arg : args) {
sb.append(arg);
sb.append('\n');
}
IO.store(sb, javadocOptions);
Command command = new Command();
command.add(getProperty("javadoc", "javadoc"));
command.add("@" + fileName(javadocOptions));
StringBuilder out = new StringBuilder();
StringBuilder err = new StringBuilder();
int result = command.execute(out, err);
if (result != 0) {
warning("Error during execution of javadoc command: %s\n******************\n%s", out, err);
}
return new Jar(javadoc);
}
Aggregations