use of org.gradle.external.javadoc.StandardJavadocDocletOptions in project gradle by gradle.
the class Javadoc method generate.
@TaskAction
protected void generate() {
final File destinationDir = getDestinationDir();
StandardJavadocDocletOptions options = new StandardJavadocDocletOptions((StandardJavadocDocletOptions) getOptions());
if (options.getDestinationDirectory() == null) {
options.destinationDirectory(destinationDir);
}
options.classpath(new ArrayList<File>(getClasspath().getFiles()));
if (!GUtil.isTrue(options.getWindowTitle()) && GUtil.isTrue(getTitle())) {
options.windowTitle(getTitle());
}
if (!GUtil.isTrue(options.getDocTitle()) && GUtil.isTrue(getTitle())) {
options.setDocTitle(getTitle());
}
String maxMemory = getMaxMemory();
if (maxMemory != null) {
final List<String> jFlags = options.getJFlags();
final Iterator<String> jFlagsIt = jFlags.iterator();
boolean containsXmx = false;
while (!containsXmx && jFlagsIt.hasNext()) {
final String jFlag = jFlagsIt.next();
if (jFlag.startsWith("-Xmx")) {
containsXmx = true;
}
}
if (!containsXmx) {
options.jFlags("-Xmx" + maxMemory);
}
}
List<String> sourceNames = new ArrayList<String>();
for (File sourceFile : getSource()) {
sourceNames.add(sourceFile.getAbsolutePath());
}
options.setSourceNames(sourceNames);
executeExternalJavadoc(options);
}
Aggregations