Search in sources :

Example 1 with DefaultLibraryComponentSelector

use of org.gradle.internal.component.local.model.DefaultLibraryComponentSelector in project gradle by gradle.

the class ComponentSelectorSerializer method read.

@Override
public ComponentSelector read(Decoder decoder) throws IOException {
    byte id = decoder.readByte();
    if (Implementation.ROOT_PROJECT.getId() == id) {
        BuildIdentifier buildIdentifier = buildIdentifierSerializer.read(decoder);
        String projectName = decoder.readString();
        return new DefaultProjectComponentSelector(buildIdentifier, Path.ROOT, Path.ROOT, projectName, readAttributes(decoder), readCapabilities(decoder));
    } else if (Implementation.ROOT_BUILD_PROJECT.getId() == id) {
        BuildIdentifier buildIdentifier = buildIdentifierSerializer.read(decoder);
        Path projectPath = Path.path(decoder.readString());
        return new DefaultProjectComponentSelector(buildIdentifier, projectPath, projectPath, projectPath.getName(), readAttributes(decoder), readCapabilities(decoder));
    } else if (Implementation.OTHER_BUILD_ROOT_PROJECT.getId() == id) {
        BuildIdentifier buildIdentifier = buildIdentifierSerializer.read(decoder);
        Path identityPath = Path.path(decoder.readString());
        return new DefaultProjectComponentSelector(buildIdentifier, identityPath, Path.ROOT, identityPath.getName(), readAttributes(decoder), readCapabilities(decoder));
    } else if (Implementation.OTHER_BUILD_PROJECT.getId() == id) {
        BuildIdentifier buildIdentifier = buildIdentifierSerializer.read(decoder);
        Path identityPath = Path.path(decoder.readString());
        Path projectPath = Path.path(decoder.readString());
        return new DefaultProjectComponentSelector(buildIdentifier, identityPath, projectPath, projectPath.getName(), readAttributes(decoder), readCapabilities(decoder));
    } else if (Implementation.MODULE.getId() == id) {
        return DefaultModuleComponentSelector.newSelector(DefaultModuleIdentifier.newId(decoder.readString(), decoder.readString()), readVersionConstraint(decoder), readAttributes(decoder), readCapabilities(decoder));
    } else if (Implementation.LIBRARY.getId() == id) {
        return new DefaultLibraryComponentSelector(decoder.readString(), decoder.readNullableString(), decoder.readNullableString());
    }
    throw new IllegalArgumentException("Unable to find component selector with id: " + id);
}
Also used : Path(org.gradle.util.Path) DefaultProjectComponentSelector(org.gradle.internal.component.local.model.DefaultProjectComponentSelector) BuildIdentifier(org.gradle.api.artifacts.component.BuildIdentifier) DefaultLibraryComponentSelector(org.gradle.internal.component.local.model.DefaultLibraryComponentSelector)

Example 2 with DefaultLibraryComponentSelector

use of org.gradle.internal.component.local.model.DefaultLibraryComponentSelector in project gradle by gradle.

the class DefaultLibraryLocalComponentMetadata method projectDependencyMetadata.

// TODO: projectDependency should be transformed based on defaultProject (and other context) elsewhere.
private LocalOriginDependencyMetadata projectDependencyMetadata(ProjectDependencySpec projectDependency, String defaultProject, String usageConfigurationName) {
    String projectPath = projectDependency.getProjectPath();
    if (isNullOrEmpty(projectPath)) {
        projectPath = defaultProject;
    }
    String libraryName = projectDependency.getLibraryName();
    ComponentSelector selector = new DefaultLibraryComponentSelector(projectPath, libraryName);
    return dependencyMetadataFor(selector, usageConfigurationName, usageConfigurationName);
}
Also used : ComponentSelector(org.gradle.api.artifacts.component.ComponentSelector) ModuleComponentSelector(org.gradle.api.artifacts.component.ModuleComponentSelector) DefaultLibraryComponentSelector(org.gradle.internal.component.local.model.DefaultLibraryComponentSelector) DefaultModuleComponentSelector(org.gradle.internal.component.external.model.DefaultModuleComponentSelector) DefaultLibraryComponentSelector(org.gradle.internal.component.local.model.DefaultLibraryComponentSelector)

Example 3 with DefaultLibraryComponentSelector

use of org.gradle.internal.component.local.model.DefaultLibraryComponentSelector in project gradle by gradle.

the class DefaultLibraryLocalComponentMetadata method binaryDependencyMetadata.

private LocalOriginDependencyMetadata binaryDependencyMetadata(LibraryBinaryDependencySpec binarySpec, String usageConfigurationName) {
    String projectPath = binarySpec.getProjectPath();
    String libraryName = binarySpec.getLibraryName();
    ComponentSelector selector = new DefaultLibraryComponentSelector(projectPath, libraryName, binarySpec.getVariant());
    return dependencyMetadataFor(selector, usageConfigurationName, usageConfigurationName);
}
Also used : ComponentSelector(org.gradle.api.artifacts.component.ComponentSelector) ModuleComponentSelector(org.gradle.api.artifacts.component.ModuleComponentSelector) DefaultLibraryComponentSelector(org.gradle.internal.component.local.model.DefaultLibraryComponentSelector) DefaultModuleComponentSelector(org.gradle.internal.component.external.model.DefaultModuleComponentSelector) DefaultLibraryComponentSelector(org.gradle.internal.component.local.model.DefaultLibraryComponentSelector)

Aggregations

DefaultLibraryComponentSelector (org.gradle.internal.component.local.model.DefaultLibraryComponentSelector)3 ComponentSelector (org.gradle.api.artifacts.component.ComponentSelector)2 ModuleComponentSelector (org.gradle.api.artifacts.component.ModuleComponentSelector)2 DefaultModuleComponentSelector (org.gradle.internal.component.external.model.DefaultModuleComponentSelector)2 BuildIdentifier (org.gradle.api.artifacts.component.BuildIdentifier)1 DefaultProjectComponentSelector (org.gradle.internal.component.local.model.DefaultProjectComponentSelector)1 Path (org.gradle.util.Path)1