Search in sources :

Example 1 with DefaultProjectDependencyMetadata

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

the class DefaultDependencyMetadata method withTarget.

@Override
public DependencyMetadata withTarget(ComponentSelector target) {
    if (target instanceof ModuleComponentSelector) {
        ModuleComponentSelector moduleTarget = (ModuleComponentSelector) target;
        ModuleVersionSelector requestedVersion = DefaultModuleVersionSelector.newSelector(moduleTarget.getGroup(), moduleTarget.getModule(), moduleTarget.getVersion());
        if (requestedVersion.equals(requested)) {
            return this;
        }
        return withRequested(requestedVersion);
    } else if (target instanceof ProjectComponentSelector) {
        ProjectComponentSelector projectTarget = (ProjectComponentSelector) target;
        return new DefaultProjectDependencyMetadata(projectTarget, this);
    } else {
        throw new IllegalArgumentException("Unexpected selector provided: " + target);
    }
}
Also used : DefaultProjectDependencyMetadata(org.gradle.internal.component.local.model.DefaultProjectDependencyMetadata) DefaultModuleVersionSelector(org.gradle.api.internal.artifacts.DefaultModuleVersionSelector) ModuleVersionSelector(org.gradle.api.artifacts.ModuleVersionSelector) DefaultModuleComponentSelector(org.gradle.internal.component.external.model.DefaultModuleComponentSelector) ModuleComponentSelector(org.gradle.api.artifacts.component.ModuleComponentSelector) ProjectComponentSelector(org.gradle.api.artifacts.component.ProjectComponentSelector)

Aggregations

ModuleVersionSelector (org.gradle.api.artifacts.ModuleVersionSelector)1 ModuleComponentSelector (org.gradle.api.artifacts.component.ModuleComponentSelector)1 ProjectComponentSelector (org.gradle.api.artifacts.component.ProjectComponentSelector)1 DefaultModuleVersionSelector (org.gradle.api.internal.artifacts.DefaultModuleVersionSelector)1 DefaultModuleComponentSelector (org.gradle.internal.component.external.model.DefaultModuleComponentSelector)1 DefaultProjectDependencyMetadata (org.gradle.internal.component.local.model.DefaultProjectDependencyMetadata)1