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);
}
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;
}
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;
}
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();
}
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;
}
Aggregations