use of org.gradle.nativeplatform.NativeLibraryBinary 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;
}
use of org.gradle.nativeplatform.NativeLibraryBinary in project gradle by gradle.
the class LibraryNativeDependencyResolver method resolve.
@Override
public void resolve(NativeBinaryResolveResult resolution) {
for (NativeBinaryRequirementResolveResult requirementResolution : resolution.getPendingResolutions()) {
DefaultLibraryResolver libraryResolver = new DefaultLibraryResolver(libraryBinaryLocator, requirementResolution.getRequirement(), resolution.getTarget());
NativeLibraryBinary libraryBinary = libraryResolver.resolveLibraryBinary();
requirementResolution.setLibraryBinary(libraryBinary);
requirementResolution.setNativeDependencySet(new DefaultNativeDependencySet(libraryBinary));
}
}
use of org.gradle.nativeplatform.NativeLibraryBinary in project gradle by gradle.
the class NativeDependentBinariesResolutionStrategy method buildState.
private State buildState() {
State state = new State();
List<ProjectInternal> orderedProjects = Ordering.usingToString().sortedCopy(projectRegistry.getAllProjects());
for (ProjectInternal project : orderedProjects) {
if (project.getPlugins().hasPlugin(ComponentModelBasePlugin.class)) {
ModelRegistry modelRegistry = projectModelResolver.resolveProjectModel(project.getPath());
ModelMap<NativeComponentSpec> components = modelRegistry.realize("components", ModelTypes.modelMap(NativeComponentSpec.class));
for (NativeBinarySpecInternal binary : allBinariesOf(components.withType(VariantComponentSpec.class))) {
state.registerBinary(binary);
}
ModelMap<Object> testSuites = modelRegistry.find("testSuites", ModelTypes.modelMap(Object.class));
if (testSuites != null) {
for (NativeBinarySpecInternal binary : allBinariesOf(testSuites.withType(NativeComponentSpec.class).withType(VariantComponentSpec.class))) {
state.registerBinary(binary);
}
}
}
}
for (NativeBinarySpecInternal nativeBinary : state.dependencies.keySet()) {
for (NativeLibraryBinary libraryBinary : nativeBinary.getDependentBinaries()) {
// Skip prebuilt libraries
if (libraryBinary instanceof NativeBinarySpecInternal) {
// Unfortunate cast! see LibraryBinaryLocator
state.dependencies.get(nativeBinary).add((NativeBinarySpecInternal) libraryBinary);
}
}
if (testSupport != null) {
state.dependencies.get(nativeBinary).addAll(testSupport.getTestDependencies(nativeBinary));
}
}
return state;
}
Aggregations