use of org.gradle.api.internal.tasks.compile.HasCompileOptions in project gradle by gradle.
the class DefaultJvmLanguageSourceDirectoryBuilder method build.
void build() {
if (taskBuilder == null) {
throw new IllegalStateException("You must specify the task which will contribute classes from this source directory");
}
SourceDirectorySet langSrcDir = project.getObjects().sourceDirectorySet(name, description == null ? "Sources for " + name : description);
langSrcDir.srcDir("src/" + sourceSet.getName() + "/" + name);
DefaultCompileTaskDetails details = createTaskDetails(langSrcDir);
JvmPluginsHelper.configureOutputDirectoryForSourceSet(sourceSet, langSrcDir, project, details.task, details.task.map(task -> {
if (task instanceof HasCompileOptions) {
return ((HasCompileOptions) task).getOptions();
}
throw new UnsupportedOperationException("Unsupported compile task " + task.getClass().getName());
}), Cast.uncheckedCast(details.mapping));
if (includeInAllJava) {
sourceSet.getAllJava().source(langSrcDir);
}
sourceSet.getAllSource().source(langSrcDir);
project.getTasks().named(JavaPlugin.CLASSES_TASK_NAME).configure(classes -> classes.dependsOn(details.task));
}
Aggregations