{
JavaPluginConvention javaConv = (JavaPluginConvention) project.getConvention().getPlugins().get("java");
SourceSet main = javaConv.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME);
// do the special source moving...
SourceCopyTask task;
// main
{
DelayedFile dir = delayedFile(SOURCES_DIR + "/java");
task = makeTask("sourceMainJava", SourceCopyTask.class);
task.setSource(main.getJava());
task.setOutput(dir);
JavaCompile compile = (JavaCompile) project.getTasks().getByName(main.getCompileJavaTaskName());
compile.dependsOn("sourceMainJava");
compile.setSource(dir);
}
// scala!!!
if (project.getPlugins().hasPlugin("scala"))
{
ScalaSourceSet set = (ScalaSourceSet) new DslObject(main).getConvention().getPlugins().get("scala");
DelayedFile dir = delayedFile(SOURCES_DIR + "/scala");
task = makeTask("sourceMainScala", SourceCopyTask.class);
task.setSource(set.getScala());
task.setOutput(dir);
ScalaCompile compile = (ScalaCompile) project.getTasks().getByName(main.getCompileTaskName("scala"));
compile.dependsOn("sourceMainScala");
compile.setSource(dir);
}
// groovy!!!
if (project.getPlugins().hasPlugin("groovy"))
{
GroovySourceSet set = (GroovySourceSet) new DslObject(main).getConvention().getPlugins().get("groovy");
DelayedFile dir = delayedFile(SOURCES_DIR + "/groovy");
task = makeTask("sourceMainGroovy", SourceCopyTask.class);
task.setSource(set.getGroovy());
task.setOutput(dir);
GroovyCompile compile = (GroovyCompile) project.getTasks().getByName(main.getCompileTaskName("groovy"));
compile.dependsOn("sourceMainGroovy");
compile.setSource(dir);
}