Search in sources :

Example 1 with StandardJavadocDocletOptions

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);
}
Also used : ArrayList(java.util.ArrayList) File(java.io.File) StandardJavadocDocletOptions(org.gradle.external.javadoc.StandardJavadocDocletOptions) TaskAction(org.gradle.api.tasks.TaskAction)

Aggregations

File (java.io.File)1 ArrayList (java.util.ArrayList)1 TaskAction (org.gradle.api.tasks.TaskAction)1 StandardJavadocDocletOptions (org.gradle.external.javadoc.StandardJavadocDocletOptions)1