use of org.gradle.api.artifacts.component.LibraryComponentSelector in project gradle by gradle.
the class LocalLibraryDependencyResolver method resolve.
@Override
public void resolve(DependencyMetadata dependency, final BuildableComponentIdResolveResult result) {
if (dependency.getSelector() instanceof LibraryComponentSelector) {
LibraryComponentSelector selector = (LibraryComponentSelector) dependency.getSelector();
resolveLibraryAndChooseBinary(result, selector);
}
}
use of org.gradle.api.artifacts.component.LibraryComponentSelector in project gradle by gradle.
the class DefaultComponentSelectorConverter method getSelector.
@Override
public ModuleVersionSelector getSelector(ComponentSelector selector) {
if (selector instanceof ModuleComponentSelector) {
return DefaultModuleVersionSelector.newSelector((ModuleComponentSelector) selector);
}
if (selector instanceof ProjectComponentSelector) {
ProjectComponentSelector projectSelector = (ProjectComponentSelector) selector;
ProjectComponentIdentifier projectId = componentIdentifierFactory.createProjectComponentIdentifier(projectSelector);
LocalComponentMetadata projectComponent = localComponentRegistry.getComponent(projectId);
if (projectComponent != null) {
ModuleVersionIdentifier moduleVersionId = projectComponent.getModuleVersionId();
return DefaultModuleVersionSelector.newSelector(moduleVersionId.getModule(), moduleVersionId.getVersion());
}
}
if (selector instanceof LibraryComponentSelector) {
LibraryComponentSelector libraryComponentSelector = (LibraryComponentSelector) selector;
String libraryName = GUtil.elvis(libraryComponentSelector.getLibraryName(), "");
return DefaultModuleVersionSelector.newSelector(DefaultModuleIdentifier.newId(libraryComponentSelector.getProjectPath(), libraryName), "undefined");
}
return UNKNOWN_MODULE_VERSION_SELECTOR;
}
use of org.gradle.api.artifacts.component.LibraryComponentSelector in project gradle by gradle.
the class LocalLibraryDependencyResolver method resolve.
@Override
public void resolve(DependencyMetadata dependency, ResolvedVersionConstraint versionConstraint, final BuildableComponentIdResolveResult result) {
if (dependency.getSelector() instanceof LibraryComponentSelector) {
LibraryComponentSelector selector = (LibraryComponentSelector) dependency.getSelector();
resolveLibraryAndChooseBinary(result, selector);
}
}
use of org.gradle.api.artifacts.component.LibraryComponentSelector in project gradle by gradle.
the class LocalLibraryDependencyResolver method resolve.
@Override
public void resolve(DependencyMetadata dependency, VersionSelector acceptor, VersionSelector rejector, BuildableComponentIdResolveResult result) {
if (dependency.getSelector() instanceof LibraryComponentSelector) {
LibraryComponentSelector selector = (LibraryComponentSelector) dependency.getSelector();
resolveLibraryAndChooseBinary(result, selector);
}
}
use of org.gradle.api.artifacts.component.LibraryComponentSelector in project gradle by gradle.
the class ComponentSelectorSerializer method write.
@Override
public void write(Encoder encoder, ComponentSelector value) throws IOException {
if (value == null) {
throw new IllegalArgumentException("Provided component selector may not be null");
}
Implementation implementation = resolveImplementation(value);
encoder.writeByte(implementation.getId());
if (implementation == Implementation.MODULE) {
ModuleComponentSelector moduleComponentSelector = (ModuleComponentSelector) value;
encoder.writeString(moduleComponentSelector.getGroup());
encoder.writeString(moduleComponentSelector.getModule());
VersionConstraint versionConstraint = moduleComponentSelector.getVersionConstraint();
writeVersionConstraint(encoder, versionConstraint);
writeAttributes(encoder, moduleComponentSelector.getAttributes());
writeCapabilities(encoder, moduleComponentSelector.getRequestedCapabilities());
} else if (implementation == Implementation.ROOT_PROJECT) {
DefaultProjectComponentSelector projectComponentSelector = (DefaultProjectComponentSelector) value;
buildIdentifierSerializer.write(encoder, projectComponentSelector.getBuildIdentifier());
encoder.writeString(projectComponentSelector.getProjectName());
writeAttributes(encoder, projectComponentSelector.getAttributes());
writeCapabilities(encoder, projectComponentSelector.getRequestedCapabilities());
} else if (implementation == Implementation.ROOT_BUILD_PROJECT) {
DefaultProjectComponentSelector projectComponentSelector = (DefaultProjectComponentSelector) value;
buildIdentifierSerializer.write(encoder, projectComponentSelector.getBuildIdentifier());
encoder.writeString(projectComponentSelector.getProjectPath());
writeAttributes(encoder, projectComponentSelector.getAttributes());
writeCapabilities(encoder, projectComponentSelector.getRequestedCapabilities());
} else if (implementation == Implementation.OTHER_BUILD_ROOT_PROJECT) {
DefaultProjectComponentSelector projectComponentSelector = (DefaultProjectComponentSelector) value;
buildIdentifierSerializer.write(encoder, projectComponentSelector.getBuildIdentifier());
encoder.writeString(projectComponentSelector.getIdentityPath().getPath());
writeAttributes(encoder, projectComponentSelector.getAttributes());
writeCapabilities(encoder, projectComponentSelector.getRequestedCapabilities());
} else if (implementation == Implementation.OTHER_BUILD_PROJECT) {
DefaultProjectComponentSelector projectComponentSelector = (DefaultProjectComponentSelector) value;
buildIdentifierSerializer.write(encoder, projectComponentSelector.getBuildIdentifier());
encoder.writeString(projectComponentSelector.getIdentityPath().getPath());
encoder.writeString(projectComponentSelector.getProjectPath());
writeAttributes(encoder, projectComponentSelector.getAttributes());
writeCapabilities(encoder, projectComponentSelector.getRequestedCapabilities());
} else if (implementation == Implementation.LIBRARY) {
LibraryComponentSelector libraryComponentSelector = (LibraryComponentSelector) value;
encoder.writeString(libraryComponentSelector.getProjectPath());
encoder.writeNullableString(libraryComponentSelector.getLibraryName());
encoder.writeNullableString(libraryComponentSelector.getVariant());
} else {
throw new IllegalStateException("Unsupported implementation type: " + implementation);
}
}
Aggregations