Search in sources :

Example 1 with CreateStaticLibrary

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());
    });
}
Also used : ComponentWithNames(org.gradle.language.nativeplatform.internal.ComponentWithNames) Names(org.gradle.language.nativeplatform.internal.Names) ConfigurableComponentWithRuntimeUsage(org.gradle.language.nativeplatform.internal.ConfigurableComponentWithRuntimeUsage) ConfigurableComponentWithSharedLibrary(org.gradle.language.nativeplatform.internal.ConfigurableComponentWithSharedLibrary) ComponentWithVariants(org.gradle.api.component.ComponentWithVariants) LinkSharedLibrary(org.gradle.nativeplatform.tasks.LinkSharedLibrary) ComponentWithBinaries(org.gradle.language.ComponentWithBinaries) Task(org.gradle.api.Task) Provider(org.gradle.api.provider.Provider) PublishingExtension(org.gradle.api.publish.PublishingExtension) ModuleVersionIdentifier(org.gradle.api.artifacts.ModuleVersionIdentifier) ConfigurationContainer(org.gradle.api.artifacts.ConfigurationContainer) MultipleCandidatesDetails(org.gradle.api.attributes.MultipleCandidatesDetails) TaskProvider(org.gradle.api.tasks.TaskProvider) TargetMachineFactory(org.gradle.nativeplatform.TargetMachineFactory) Linkage(org.gradle.nativeplatform.Linkage) ExtensionContainer(org.gradle.api.plugins.ExtensionContainer) UnzipTransform(org.gradle.api.internal.artifacts.transform.UnzipTransform) Incubating(org.gradle.api.Incubating) SoftwareComponentContainer(org.gradle.api.component.SoftwareComponentContainer) PlatformToolProvider(org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider) Project(org.gradle.api.Project) TargetMachine(org.gradle.nativeplatform.TargetMachine) ComponentWithNames(org.gradle.language.nativeplatform.internal.ComponentWithNames) Set(java.util.Set) MutableMavenProjectIdentity(org.gradle.api.publish.maven.internal.publisher.MutableMavenProjectIdentity) DIRECTORY_TYPE(org.gradle.api.artifacts.type.ArtifactTypeDefinition.DIRECTORY_TYPE) AttributeDisambiguationRule(org.gradle.api.attributes.AttributeDisambiguationRule) TaskContainer(org.gradle.api.tasks.TaskContainer) AbstractLinkTask(org.gradle.nativeplatform.tasks.AbstractLinkTask) ArtifactTypeDefinition(org.gradle.api.artifacts.type.ArtifactTypeDefinition) Names(org.gradle.language.nativeplatform.internal.Names) SoftwareComponent(org.gradle.api.component.SoftwareComponent) NativeToolChain(org.gradle.nativeplatform.toolchain.NativeToolChain) MavenPublicationInternal(org.gradle.api.publish.maven.internal.publication.MavenPublicationInternal) CreateStaticLibrary(org.gradle.nativeplatform.tasks.CreateStaticLibrary) ZIP_TYPE(org.gradle.api.artifacts.type.ArtifactTypeDefinition.ZIP_TYPE) ConfigurableComponentWithStaticLibrary(org.gradle.language.nativeplatform.internal.ConfigurableComponentWithStaticLibrary) StripSymbols(org.gradle.nativeplatform.tasks.StripSymbols) PublishableComponent(org.gradle.api.component.PublishableComponent) Callable(java.util.concurrent.Callable) MavenPublication(org.gradle.api.publish.maven.MavenPublication) NativePlatform(org.gradle.nativeplatform.platform.NativePlatform) FileCollection(org.gradle.api.file.FileCollection) ProductionComponent(org.gradle.language.ProductionComponent) ExtractSymbols(org.gradle.nativeplatform.tasks.ExtractSymbols) LinkExecutable(org.gradle.nativeplatform.tasks.LinkExecutable) Inject(javax.inject.Inject) Configuration(org.gradle.api.artifacts.Configuration) LifecycleBasePlugin(org.gradle.language.base.plugins.LifecycleBasePlugin) DependencyHandler(org.gradle.api.artifacts.dsl.DependencyHandler) AttributeContainer(org.gradle.api.attributes.AttributeContainer) DefaultTargetMachineFactory(org.gradle.nativeplatform.internal.DefaultTargetMachineFactory) Attribute(org.gradle.api.attributes.Attribute) DirectoryProperty(org.gradle.api.file.DirectoryProperty) DomainObjectSet(org.gradle.api.DomainObjectSet) Usage(org.gradle.api.attributes.Usage) ConfigurableComponentWithLinkUsage(org.gradle.language.nativeplatform.internal.ConfigurableComponentWithLinkUsage) ConfigurableComponentWithExecutable(org.gradle.language.nativeplatform.internal.ConfigurableComponentWithExecutable) PublicationAwareComponent(org.gradle.language.nativeplatform.internal.PublicationAwareComponent) InstallExecutable(org.gradle.nativeplatform.tasks.InstallExecutable) ComponentWithTargetMachines(org.gradle.language.ComponentWithTargetMachines) Cast(org.gradle.internal.Cast) LINKAGE_ATTRIBUTE(org.gradle.language.cpp.CppBinary.LINKAGE_ATTRIBUTE) ObjectFactory(org.gradle.api.model.ObjectFactory) RegularFile(org.gradle.api.file.RegularFile) ComponentWithOutputs(org.gradle.language.ComponentWithOutputs) Collections(java.util.Collections) Plugin(org.gradle.api.Plugin) RegularFile(org.gradle.api.file.RegularFile) CreateStaticLibrary(org.gradle.nativeplatform.tasks.CreateStaticLibrary) PlatformToolProvider(org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider)

Aggregations

Collections (java.util.Collections)1 Set (java.util.Set)1 Callable (java.util.concurrent.Callable)1 Inject (javax.inject.Inject)1 DomainObjectSet (org.gradle.api.DomainObjectSet)1 Incubating (org.gradle.api.Incubating)1 Plugin (org.gradle.api.Plugin)1 Project (org.gradle.api.Project)1 Task (org.gradle.api.Task)1 Configuration (org.gradle.api.artifacts.Configuration)1 ConfigurationContainer (org.gradle.api.artifacts.ConfigurationContainer)1 ModuleVersionIdentifier (org.gradle.api.artifacts.ModuleVersionIdentifier)1 DependencyHandler (org.gradle.api.artifacts.dsl.DependencyHandler)1 ArtifactTypeDefinition (org.gradle.api.artifacts.type.ArtifactTypeDefinition)1 DIRECTORY_TYPE (org.gradle.api.artifacts.type.ArtifactTypeDefinition.DIRECTORY_TYPE)1 ZIP_TYPE (org.gradle.api.artifacts.type.ArtifactTypeDefinition.ZIP_TYPE)1 Attribute (org.gradle.api.attributes.Attribute)1 AttributeContainer (org.gradle.api.attributes.AttributeContainer)1 AttributeDisambiguationRule (org.gradle.api.attributes.AttributeDisambiguationRule)1 MultipleCandidatesDetails (org.gradle.api.attributes.MultipleCandidatesDetails)1