Search in sources :

Example 1 with ScalaDoc

use of org.gradle.api.tasks.scala.ScalaDoc in project gradle by gradle.

the class ScalaPlugin method configureScaladoc.

private static void configureScaladoc(final Project project) {
    project.getTasks().withType(ScalaDoc.class, new Action<ScalaDoc>() {

        @Override
        public void execute(ScalaDoc scalaDoc) {
            final SourceSet main = project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().getByName("main");
            scalaDoc.getConventionMapping().map("classpath", new Callable<FileCollection>() {

                @Override
                public FileCollection call() throws Exception {
                    ConfigurableFileCollection files = project.files();
                    files.from(main.getOutput());
                    files.from(main.getCompileClasspath());
                    return files;
                }
            });
            scalaDoc.setSource(InvokerHelper.invokeMethod(main, "getScala", null));
        }
    });
    ScalaDoc scalaDoc = project.getTasks().create(SCALA_DOC_TASK_NAME, ScalaDoc.class);
    scalaDoc.setDescription("Generates Scaladoc for the main source code.");
    scalaDoc.setGroup(JavaBasePlugin.DOCUMENTATION_GROUP);
}
Also used : SourceSet(org.gradle.api.tasks.SourceSet) JavaPluginConvention(org.gradle.api.plugins.JavaPluginConvention) ConfigurableFileCollection(org.gradle.api.file.ConfigurableFileCollection) ScalaDoc(org.gradle.api.tasks.scala.ScalaDoc) Callable(java.util.concurrent.Callable)

Aggregations

Callable (java.util.concurrent.Callable)1 ConfigurableFileCollection (org.gradle.api.file.ConfigurableFileCollection)1 JavaPluginConvention (org.gradle.api.plugins.JavaPluginConvention)1 SourceSet (org.gradle.api.tasks.SourceSet)1 ScalaDoc (org.gradle.api.tasks.scala.ScalaDoc)1