project.apply(ImmutableMap.of("type", JavaPlugin.class));
configureGroovydoc(project);
}
private void configureGroovydoc(final Project project) {
Groovydoc groovyDoc = project.getTasks().create(GROOVYDOC_TASK_NAME, Groovydoc.class);
groovyDoc.setDescription("Generates Groovydoc API documentation for the main source code.");
groovyDoc.setGroup(JavaBasePlugin.DOCUMENTATION_GROUP);
JavaPluginConvention convention = project.getConvention().getPlugin(JavaPluginConvention.class);
SourceSet sourceSet = convention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME);
groovyDoc.setClasspath(sourceSet.getOutput().plus(sourceSet.getCompileClasspath()));
GroovySourceSet groovySourceSet = new DslObject(sourceSet).getConvention().getPlugin(GroovySourceSet.class);
groovyDoc.setSource(groovySourceSet.getGroovy());
}