use of org.gradle.nativeplatform.tasks.CreateStaticLibrary in project gradle by gradle.
the class NativeBasePlugin method addTasksForComponentWithStaticLibrary.
private void addTasksForComponentWithStaticLibrary(final TaskContainer tasks, final DirectoryProperty buildDirectory, SoftwareComponentContainer components) {
components.withType(ConfigurableComponentWithStaticLibrary.class, library -> {
final Names names = library.getNames();
// Add a create task
final TaskProvider<CreateStaticLibrary> createTask = tasks.register(names.getTaskName("create"), CreateStaticLibrary.class, task -> {
task.source(library.getObjects());
final PlatformToolProvider toolProvider = library.getPlatformToolProvider();
Provider<RegularFile> linktimeFile = buildDirectory.file(library.getBaseName().map(baseName -> toolProvider.getStaticLibraryName("lib/" + names.getDirName() + baseName)));
task.getOutputFile().set(linktimeFile);
task.getTargetPlatform().set(library.getNativePlatform());
task.getToolChain().set(library.getToolChain());
});
// Wire the task into the library model
library.getLinkFile().set(createTask.flatMap(task -> task.getBinaryFile()));
library.getLinkFileProducer().set(createTask);
library.getCreateTask().set(createTask);
library.getOutputs().from(library.getLinkFile());
});
}
Aggregations