Search in sources :

Example 1 with JavadocExecHandleBuilder

use of org.gradle.external.javadoc.internal.JavadocExecHandleBuilder in project gradle by gradle.

the class JavadocGenerator method execute.

@Override
public WorkResult execute(JavadocSpec spec) {
    JavadocExecHandleBuilder javadocExecHandleBuilder = new JavadocExecHandleBuilder(execActionFactory);
    javadocExecHandleBuilder.setExecutable(spec.getExecutable());
    javadocExecHandleBuilder.execDirectory(spec.getWorkingDir()).options(spec.getOptions()).optionsFile(spec.getOptionsFile());
    ExecAction execAction = javadocExecHandleBuilder.getExecHandle();
    if (spec.isIgnoreFailures()) {
        execAction.setIgnoreExitValue(true);
    }
    try {
        execAction.execute();
    } catch (ExecException e) {
        LOG.info("Problems generating Javadoc." + "\n  Command line issued: " + execAction.getCommandLine() + "\n  Generated Javadoc options file has following contents:\n------\n{}------", GFileUtils.readFileQuietly(spec.getOptionsFile()));
        throw new GradleException(String.format("Javadoc generation failed. Generated Javadoc options file (useful for troubleshooting): '%s'", spec.getOptionsFile()), e);
    }
    return new SimpleWorkResult(true);
}
Also used : ExecAction(org.gradle.process.internal.ExecAction) JavadocExecHandleBuilder(org.gradle.external.javadoc.internal.JavadocExecHandleBuilder) ExecException(org.gradle.process.internal.ExecException) GradleException(org.gradle.api.GradleException) SimpleWorkResult(org.gradle.api.internal.tasks.SimpleWorkResult)

Aggregations

GradleException (org.gradle.api.GradleException)1 SimpleWorkResult (org.gradle.api.internal.tasks.SimpleWorkResult)1 JavadocExecHandleBuilder (org.gradle.external.javadoc.internal.JavadocExecHandleBuilder)1 ExecAction (org.gradle.process.internal.ExecAction)1 ExecException (org.gradle.process.internal.ExecException)1