Search in sources :

Example 6 with ComponentSelector

use of org.gradle.api.artifacts.component.ComponentSelector in project gradle by gradle.

the class DependencySubstitutionResolver method resolve.

public void resolve(DependencyMetadata dependency, BuildableComponentIdResolveResult result) {
    ComponentSelector selector = dependency.getSelector();
    DependencySubstitutionInternal details = new DefaultDependencySubstitution(selector, dependency.getRequested());
    try {
        rule.execute(details);
    } catch (Throwable e) {
        result.failed(new ModuleVersionResolveException(selector, e));
        return;
    }
    if (details.isUpdated()) {
        resolver.resolve(dependency.withTarget(details.getTarget()), result);
        result.setSelectionReason(details.getSelectionReason());
        return;
    }
    resolver.resolve(dependency, result);
}
Also used : ComponentSelector(org.gradle.api.artifacts.component.ComponentSelector) ModuleVersionResolveException(org.gradle.internal.resolve.ModuleVersionResolveException) DependencySubstitutionInternal(org.gradle.api.internal.artifacts.DependencySubstitutionInternal)

Example 7 with ComponentSelector

use of org.gradle.api.artifacts.component.ComponentSelector in project gradle by gradle.

the class DefaultIdeDependencyResolver method getUnresolvedIdeRepoFileDependencies.

/**
     * Gets unresolved IDE repository file dependencies.
     *
     * @param configuration Configuration
     * @return Unresolved IDE repositoru file dependencies
     */
public List<UnresolvedIdeRepoFileDependency> getUnresolvedIdeRepoFileDependencies(Configuration configuration) {
    ResolutionResult result = getIncomingResolutionResult(configuration);
    List<UnresolvedDependencyResult> unresolvedDependencies = findAllUnresolvedDependencyResults(result.getRoot().getDependencies());
    List<UnresolvedIdeRepoFileDependency> unresolvedIdeRepoFileDependencies = new ArrayList<UnresolvedIdeRepoFileDependency>();
    for (UnresolvedDependencyResult unresolvedDependencyResult : unresolvedDependencies) {
        Throwable failure = unresolvedDependencyResult.getFailure();
        ComponentSelector componentSelector = unresolvedDependencyResult.getAttempted();
        String displayName = componentSelector.getDisplayName();
        File file = new File(unresolvedFileName(componentSelector));
        unresolvedIdeRepoFileDependencies.add(new UnresolvedIdeRepoFileDependency(file, failure, displayName));
    }
    return unresolvedIdeRepoFileDependencies;
}
Also used : UnresolvedDependencyResult(org.gradle.api.artifacts.result.UnresolvedDependencyResult) ComponentSelector(org.gradle.api.artifacts.component.ComponentSelector) ResolutionResult(org.gradle.api.artifacts.result.ResolutionResult) UnresolvedIdeRepoFileDependency(org.gradle.plugins.ide.internal.resolver.model.UnresolvedIdeRepoFileDependency) ArrayList(java.util.ArrayList) File(java.io.File)

Example 8 with ComponentSelector

use of org.gradle.api.artifacts.component.ComponentSelector in project gradle by gradle.

the class ResolveState method getSelector.

public SelectorState getSelector(DependencyState dependencyState, ModuleIdentifier moduleIdentifier) {
    ComponentSelector requested = dependencyState.getRequested();
    SelectorState resolveState = selectors.get(requested);
    if (resolveState == null) {
        resolveState = new SelectorState(idGenerator.generateId(), dependencyState, idResolver, this, moduleIdentifier);
        selectors.put(requested, resolveState);
    }
    return resolveState;
}
Also used : ComponentSelector(org.gradle.api.artifacts.component.ComponentSelector)

Example 9 with ComponentSelector

use of org.gradle.api.artifacts.component.ComponentSelector in project gradle by gradle.

the class ResolutionFailureCollector method complete.

public Set<UnresolvedDependency> complete() {
    if (failuresByRevisionId.isEmpty()) {
        ImmutableSet.of();
    }
    ImmutableSet.Builder<UnresolvedDependency> builder = ImmutableSet.builder();
    for (Map.Entry<ComponentSelector, BrokenDependency> entry : failuresByRevisionId.entrySet()) {
        Collection<List<ComponentIdentifier>> paths = DependencyGraphPathResolver.calculatePaths(entry.getValue().requiredBy, root);
        ComponentSelector key = entry.getKey();
        ModuleVersionSelector moduleVersionSelector = componentSelectorConverter.getSelector(key);
        builder.add(new DefaultUnresolvedDependency(moduleVersionSelector, entry.getValue().failure.withIncomingPaths(paths)));
    }
    return builder.build();
}
Also used : ModuleVersionSelector(org.gradle.api.artifacts.ModuleVersionSelector) ImmutableSet(com.google.common.collect.ImmutableSet) ComponentSelector(org.gradle.api.artifacts.component.ComponentSelector) UnresolvedDependency(org.gradle.api.artifacts.UnresolvedDependency) DefaultUnresolvedDependency(org.gradle.api.internal.artifacts.ivyservice.DefaultUnresolvedDependency) DefaultUnresolvedDependency(org.gradle.api.internal.artifacts.ivyservice.DefaultUnresolvedDependency) ArrayList(java.util.ArrayList) List(java.util.List) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Example 10 with ComponentSelector

use of org.gradle.api.artifacts.component.ComponentSelector in project gradle by gradle.

the class CachingDependencySubstitutionApplicator method apply.

@Override
public SubstitutionResult apply(DependencyMetadata dependency) {
    ComponentSelector selector = dependency.getSelector();
    SubstitutionResult application = cache.get(selector);
    if (application == null) {
        application = delegate.apply(dependency);
        cache.put(selector, application);
    }
    return application;
}
Also used : ComponentSelector(org.gradle.api.artifacts.component.ComponentSelector)

Aggregations

ComponentSelector (org.gradle.api.artifacts.component.ComponentSelector)21 ModuleComponentSelector (org.gradle.api.artifacts.component.ModuleComponentSelector)9 UnresolvedDependencyResult (org.gradle.api.artifacts.result.UnresolvedDependencyResult)5 ArrayList (java.util.ArrayList)4 List (java.util.List)4 ModuleVersionIdentifier (org.gradle.api.artifacts.ModuleVersionIdentifier)4 DefaultProjectComponentSelector (org.gradle.internal.component.local.model.DefaultProjectComponentSelector)4 File (java.io.File)3 ModuleVersionSelector (org.gradle.api.artifacts.ModuleVersionSelector)3 DependencyResult (org.gradle.api.artifacts.result.DependencyResult)3 ResolvedDependencyResult (org.gradle.api.artifacts.result.ResolvedDependencyResult)3 DefaultModuleComponentSelector (org.gradle.internal.component.external.model.DefaultModuleComponentSelector)3 JarDependency (com.android.builder.dependency.JarDependency)2 LibraryDependency (com.android.builder.dependency.LibraryDependency)2 MavenCoordinates (com.android.builder.model.MavenCoordinates)2 ImmutableList (com.google.common.collect.ImmutableList)2 HashSet (java.util.HashSet)2 UnresolvedDependency (org.gradle.api.artifacts.UnresolvedDependency)2 ComponentIdentifier (org.gradle.api.artifacts.component.ComponentIdentifier)2 ModuleComponentIdentifier (org.gradle.api.artifacts.component.ModuleComponentIdentifier)2