Java 类org.gradle.api.tasks.ScalaSourceSet 实例源码

项目:Reer    文件:ScalaBasePlugin.java   
private static void configureScalaCompile(final Project project, JavaBasePlugin javaPlugin, final SourceSet sourceSet) {
    String taskName = sourceSet.getCompileTaskName("scala");
    final ScalaCompile scalaCompile = project.getTasks().create(taskName, ScalaCompile.class);
    scalaCompile.dependsOn(sourceSet.getCompileJavaTaskName());
    javaPlugin.configureForSourceSet(sourceSet, scalaCompile);
    Convention scalaConvention = (Convention) InvokerHelper.getProperty(sourceSet, "convention");
    ScalaSourceSet scalaSourceSet = scalaConvention.findPlugin(ScalaSourceSet.class);
    scalaCompile.setDescription("Compiles the " + scalaSourceSet.getScala() + ".");
    scalaCompile.setSource(scalaSourceSet.getScala());
    project.getTasks().getByName(sourceSet.getClassesTaskName()).dependsOn(taskName);

    // cannot use convention mapping because the resulting object won't be serializable
    // cannot compute at task execution time because we need association with source set
    project.getGradle().addBuildListener(new BuildAdapter() {
        @Override
        public void projectsEvaluated(Gradle gradle) {
            IncrementalCompileOptions incrementalOptions = scalaCompile.getScalaCompileOptions().getIncrementalOptions();
            if (incrementalOptions.getAnalysisFile() == null) {
                String analysisFilePath = project.getBuildDir().getPath() + "/tmp/scala/compilerAnalysis/" + scalaCompile.getName() + ".analysis";
                incrementalOptions.setAnalysisFile(new File(analysisFilePath));
            }

            if (incrementalOptions.getPublishedCode() == null) {
                Jar jarTask = (Jar) project.getTasks().findByName(sourceSet.getJarTaskName());
                incrementalOptions.setPublishedCode(jarTask == null ? null : jarTask.getArchivePath());
            }
        }
    });
}
项目:Reer    文件:DefaultScalaSourceSet.java   
public ScalaSourceSet scala(Closure configureClosure) {
    return scala(ClosureBackedAction.of(configureClosure));
}
项目:Reer    文件:DefaultScalaSourceSet.java   
@Override
public ScalaSourceSet scala(Action<? super SourceDirectorySet> configureAction) {
    configureAction.execute(getScala());
    return this;
}
项目:Pushjet-Android    文件:DefaultScalaSourceSet.java   
public ScalaSourceSet scala(Closure configureClosure) {
    ConfigureUtil.configure(configureClosure, getScala());
    return this;
}
项目:Pushjet-Android    文件:DefaultScalaSourceSet.java   
public ScalaSourceSet scala(Closure configureClosure) {
    ConfigureUtil.configure(configureClosure, getScala());
    return this;
}