use of org.gradle.language.base.internal.LanguageSourceSetInternal in project gradle by gradle.
the class WindowsResourcesCompileTaskConfig method configureResourceCompileTask.
private void configureResourceCompileTask(WindowsResourceCompile task, final NativeBinarySpecInternal binary, final WindowsResourceSet sourceSet) {
task.setDescription("Compiles resources of the " + sourceSet + " of " + binary);
task.getToolChain().set(binary.getToolChain());
task.getTargetPlatform().set(binary.getTargetPlatform());
task.includes(sourceSet.getExportedHeaders().getSourceDirectories());
FileCollectionFactory fileCollectionFactory = ((ProjectInternal) task.getProject()).getServices().get(FileCollectionFactory.class);
task.includes(fileCollectionFactory.create(new MinimalFileSet() {
@Override
public Set<File> getFiles() {
PlatformToolProvider platformToolProvider = ((NativeToolChainInternal) binary.getToolChain()).select((NativePlatformInternal) binary.getTargetPlatform());
return new LinkedHashSet<File>(platformToolProvider.getSystemLibraries(ToolType.WINDOW_RESOURCES_COMPILER).getIncludeDirs());
}
@Override
public String getDisplayName() {
return "System includes for " + binary.getToolChain().getDisplayName();
}
}));
task.source(sourceSet.getSource());
final Project project = task.getProject();
task.setOutputDir(new File(binary.getNamingScheme().getOutputDirectory(project.getBuildDir(), "objs"), ((LanguageSourceSetInternal) sourceSet).getProjectScopedName()));
PreprocessingTool rcCompiler = (PreprocessingTool) binary.getToolByName("rcCompiler");
task.setMacros(rcCompiler.getMacros());
task.getCompilerArgs().set(rcCompiler.getArgs());
FileTree resourceOutputs = task.getOutputs().getFiles().getAsFileTree().matching(new PatternSet().include("**/*.res"));
binary.binaryInputs(resourceOutputs);
if (binary instanceof StaticLibraryBinarySpecInternal) {
((StaticLibraryBinarySpecInternal) binary).additionalLinkFiles(resourceOutputs);
}
}
use of org.gradle.language.base.internal.LanguageSourceSetInternal in project gradle by gradle.
the class BinarySourceTransformations method createTasksFor.
public void createTasksFor(BinarySpecInternal binary) {
Set<LanguageSourceSetInternal> sourceSetsToCompile = getSourcesToCompile(binary);
for (LanguageTransform<?, ?> languageTransform : prioritizedTransforms) {
if (!languageTransform.applyToBinary(binary)) {
continue;
}
LanguageSourceSetInternal sourceSetToCompile;
while ((sourceSetToCompile = findSourceFor(languageTransform, sourceSetsToCompile)) != null) {
sourceSetsToCompile.remove(sourceSetToCompile);
final SourceTransformTaskConfig taskConfig = languageTransform.getTransformTask();
String taskName = getTransformTaskName(languageTransform, taskConfig, binary, sourceSetToCompile);
Task task = tasks.create(taskName, taskConfig.getTaskType());
taskConfig.configureTask(task, binary, sourceSetToCompile, serviceRegistry);
task.dependsOn(sourceSetToCompile);
binary.getTasks().add(task);
if (binary.hasCodependentSources() && taskConfig instanceof JointCompileTaskConfig) {
JointCompileTaskConfig jointCompileTaskConfig = (JointCompileTaskConfig) taskConfig;
Iterator<LanguageSourceSetInternal> candidateSourceSets = sourceSetsToCompile.iterator();
while (candidateSourceSets.hasNext()) {
LanguageSourceSetInternal candidate = candidateSourceSets.next();
if (jointCompileTaskConfig.canTransform(candidate)) {
jointCompileTaskConfig.configureAdditionalTransform(task, candidate);
candidateSourceSets.remove();
}
}
}
}
}
// Should really fail here if sourcesToCompile is not empty: no transform for this source set in this binary
}
Aggregations