use of org.gradle.nativeplatform.toolchain.internal.NativeToolChainInternal in project gradle by gradle.
the class AbstractLinkTask method createCompiler.
@SuppressWarnings("unchecked")
private Compiler<LinkerSpec> createCompiler() {
NativePlatformInternal targetPlatform = Cast.cast(NativePlatformInternal.class, this.targetPlatform.get());
NativeToolChainInternal toolChain = Cast.cast(NativeToolChainInternal.class, getToolChain().get());
PlatformToolProvider toolProvider = toolChain.select(targetPlatform);
Class<LinkerSpec> linkerSpecType = (Class<LinkerSpec>) createLinkerSpec().getClass();
return toolProvider.newCompiler(linkerSpecType);
}
use of org.gradle.nativeplatform.toolchain.internal.NativeToolChainInternal in project gradle by gradle.
the class ExtractSymbols method createCompiler.
private Compiler<SymbolExtractorSpec> createCompiler() {
NativePlatformInternal targetPlatform = Cast.cast(NativePlatformInternal.class, this.targetPlatform.get());
NativeToolChainInternal toolChain = Cast.cast(NativeToolChainInternal.class, getToolChain().get());
PlatformToolProvider toolProvider = toolChain.select(targetPlatform);
return toolProvider.newCompiler(SymbolExtractorSpec.class);
}
use of org.gradle.nativeplatform.toolchain.internal.NativeToolChainInternal in project gradle by gradle.
the class CreateStaticLibrary method createCompiler.
private Compiler<StaticLibraryArchiverSpec> createCompiler() {
NativePlatformInternal targetPlatform = Cast.cast(NativePlatformInternal.class, this.targetPlatform.get());
NativeToolChainInternal toolChain = Cast.cast(NativeToolChainInternal.class, getToolChain().get());
PlatformToolProvider toolProvider = toolChain.select(targetPlatform);
return toolProvider.newCompiler(StaticLibraryArchiverSpec.class);
}
use of org.gradle.nativeplatform.toolchain.internal.NativeToolChainInternal in project gradle by gradle.
the class CompileTaskConfig method configureCompileTaskCommon.
private void configureCompileTaskCommon(final AbstractNativeCompileTask task, final NativeBinarySpecInternal binary, final LanguageSourceSetInternal sourceSet) {
task.getToolChain().set(binary.getToolChain());
task.getTargetPlatform().set(binary.getTargetPlatform());
task.setPositionIndependentCode(binary instanceof SharedLibraryBinarySpec);
task.includes(((HeaderExportingSourceSet) sourceSet).getExportedHeaders().getSourceDirectories());
task.includes(new Callable<List<FileCollection>>() {
@Override
public List<FileCollection> call() {
Collection<NativeDependencySet> libs = binary.getLibs((DependentSourceSet) sourceSet);
return CollectionUtils.collect(libs, new Transformer<FileCollection, NativeDependencySet>() {
@Override
public FileCollection transform(NativeDependencySet original) {
return original.getIncludeRoots();
}
});
}
});
FileCollectionFactory fileCollectionFactory = ((ProjectInternal) task.getProject()).getServices().get(FileCollectionFactory.class);
task.getSystemIncludes().from(fileCollectionFactory.create(new MinimalFileSet() {
@Override
public Set<File> getFiles() {
PlatformToolProvider platformToolProvider = ((NativeToolChainInternal) binary.getToolChain()).select((NativePlatformInternal) binary.getTargetPlatform());
ToolType toolType = languageTransform.getToolType();
return new LinkedHashSet<File>(platformToolProvider.getSystemLibraries(toolType).getIncludeDirs());
}
@Override
public String getDisplayName() {
return "System includes for " + binary.getToolChain().getDisplayName();
}
}));
for (String toolName : languageTransform.getBinaryTools().keySet()) {
Tool tool = binary.getToolByName(toolName);
if (tool instanceof PreprocessingTool) {
task.setMacros(((PreprocessingTool) tool).getMacros());
}
task.getCompilerArgs().set(tool.getArgs());
}
}
use of org.gradle.nativeplatform.toolchain.internal.NativeToolChainInternal in project gradle by gradle.
the class AssembleTaskConfig method configureAssembleTask.
private void configureAssembleTask(Assemble task, final NativeBinarySpecInternal binary, final LanguageSourceSetInternal sourceSet) {
task.setDescription("Assembles the " + sourceSet + " of " + binary);
task.getToolChain().set(binary.getToolChain());
task.getTargetPlatform().set(binary.getTargetPlatform());
task.source(sourceSet.getSource());
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.ASSEMBLER).getIncludeDirs());
}
@Override
public String getDisplayName() {
return "System includes for " + binary.getToolChain().getDisplayName();
}
}));
final Project project = task.getProject();
task.setObjectFileDir(new File(binary.getNamingScheme().getOutputDirectory(project.getBuildDir(), "objs"), sourceSet.getProjectScopedName()));
Tool assemblerTool = binary.getToolByName("assembler");
task.setAssemblerArgs(assemblerTool.getArgs());
binary.binaryInputs(task.getOutputs().getFiles().getAsFileTree().matching(new PatternSet().include("**/*.obj", "**/*.o")));
}
Aggregations