Search in sources :

Example 1 with NativeLibrarySpec

use of org.gradle.nativeplatform.NativeLibrarySpec in project gradle by gradle.

the class ProjectLibraryBinaryLocator method getBinaries.

// Converts the binaries of a project library into regular binary instances
@Nullable
@Override
public DomainObjectSet<NativeLibraryBinary> getBinaries(LibraryIdentifier libraryIdentifier) {
    ModelRegistry projectModel = projectModelResolver.resolveProjectModel(libraryIdentifier.getProjectPath());
    ComponentSpecContainer components = projectModel.find("components", ComponentSpecContainer.class);
    if (components == null) {
        return null;
    }
    String libraryName = libraryIdentifier.getLibraryName();
    NativeLibrarySpec library = components.withType(NativeLibrarySpec.class).get(libraryName);
    if (library == null) {
        return null;
    }
    ModelMap<NativeBinarySpec> projectBinaries = library.getBinaries().withType(NativeBinarySpec.class);
    DomainObjectSet<NativeLibraryBinary> binaries = new DefaultDomainObjectSet<NativeLibraryBinary>(NativeLibraryBinary.class);
    for (NativeBinarySpec nativeBinarySpec : projectBinaries.values()) {
        binaries.add((NativeLibraryBinary) nativeBinarySpec);
    }
    return binaries;
}
Also used : NativeLibraryBinary(org.gradle.nativeplatform.NativeLibraryBinary) ModelRegistry(org.gradle.model.internal.registry.ModelRegistry) NativeBinarySpec(org.gradle.nativeplatform.NativeBinarySpec) ComponentSpecContainer(org.gradle.platform.base.ComponentSpecContainer) NativeLibrarySpec(org.gradle.nativeplatform.NativeLibrarySpec) DefaultDomainObjectSet(org.gradle.api.internal.DefaultDomainObjectSet) Nullable(org.gradle.api.Nullable)

Aggregations

Nullable (org.gradle.api.Nullable)1 DefaultDomainObjectSet (org.gradle.api.internal.DefaultDomainObjectSet)1 ModelRegistry (org.gradle.model.internal.registry.ModelRegistry)1 NativeBinarySpec (org.gradle.nativeplatform.NativeBinarySpec)1 NativeLibraryBinary (org.gradle.nativeplatform.NativeLibraryBinary)1 NativeLibrarySpec (org.gradle.nativeplatform.NativeLibrarySpec)1 ComponentSpecContainer (org.gradle.platform.base.ComponentSpecContainer)1