org.gradle.api.artifacts.result.ResolvedDependencyResult Java Examples
The following examples show how to use
org.gradle.api.artifacts.result.ResolvedDependencyResult.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DependencyOrder.java From pygradle with Apache License 2.0 | 6 votes |
/** * Traverses the dependency tree post-order and collects dependencies. * <p> * The recursive post-order traversal returns the root of the (sub)tree. * This allows the post-order adding into the set of dependencies as we * return from the recursive calls. The set of seen dependencies ensures * ensures that the cycles in Ivy metadata do not cause cycles in our * recursive calls. * * @param root the root of the dependency (sub)tree * @param seen the input set of already seen dependencies * @param dependencies the output set of dependencies in post-order * @return the root itself */ public static ResolvedComponentResult postOrderDependencies( ResolvedComponentResult root, Set<ComponentIdentifier> seen, Set<ResolvedComponentResult> dependencies) { for (DependencyResult d : root.getDependencies()) { if (!(d instanceof ResolvedDependencyResult)) { throw new GradleException("Unresolved dependency found for " + d.toString()); } ResolvedComponentResult component = ((ResolvedDependencyResult) d).getSelected(); ComponentIdentifier id = component.getId(); if (!seen.contains(id)) { seen.add(id); dependencies.add(postOrderDependencies(component, seen, dependencies)); } } return root; }
Example #2
Source File: RenderableDependencyResult.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public Set<RenderableDependency> getChildren() { Set<RenderableDependency> out = new LinkedHashSet<RenderableDependency>(); for (DependencyResult d : dependency.getSelected().getDependencies()) { if (d instanceof UnresolvedDependencyResult) { out.add(new RenderableUnresolvedDependencyResult((UnresolvedDependencyResult) d)); } else { out.add(new RenderableDependencyResult((ResolvedDependencyResult) d)); } } return out; }
Example #3
Source File: DefaultResolutionResult.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private void eachElement(ResolvedComponentResult node, Action<? super ResolvedComponentResult> moduleAction, Action<? super DependencyResult> dependencyAction, Set<ResolvedComponentResult> visited) { if (!visited.add(node)) { return; } moduleAction.execute(node); for (DependencyResult d : node.getDependencies()) { dependencyAction.execute(d); if (d instanceof ResolvedDependencyResult) { eachElement(((ResolvedDependencyResult) d).getSelected(), moduleAction, dependencyAction, visited); } } }
Example #4
Source File: LinkageCheckTask.java From cloud-opensource-java with Apache License 2.0 | 5 votes |
private void recordDependencyPaths( ImmutableListMultimap.Builder<String, String> output, ArrayDeque<ResolvedComponentResult> stack, ImmutableSet<String> targetCoordinates) { ResolvedComponentResult item = stack.getLast(); ModuleVersionIdentifier identifier = item.getModuleVersion(); String coordinates = String.format( "%s:%s:%s", identifier.getGroup(), identifier.getName(), identifier.getVersion()); if (targetCoordinates.contains(coordinates)) { String dependencyPath = stack.stream().map(this::formatComponentResult).collect(Collectors.joining(" / ")); output.put(coordinates, dependencyPath); } for (DependencyResult dependencyResult : item.getDependencies()) { if (dependencyResult instanceof ResolvedDependencyResult) { ResolvedDependencyResult resolvedDependencyResult = (ResolvedDependencyResult) dependencyResult; ResolvedComponentResult child = resolvedDependencyResult.getSelected(); stack.add(child); recordDependencyPaths(output, stack, targetCoordinates); } else if (dependencyResult instanceof UnresolvedDependencyResult) { UnresolvedDependencyResult unresolvedResult = (UnresolvedDependencyResult) dependencyResult; getLogger() .error( "Could not resolve dependency: " + unresolvedResult.getAttempted().getDisplayName()); } else { throw new IllegalStateException("Unexpected dependency result type: " + dependencyResult); } } stack.removeLast(); }
Example #5
Source File: DependencyResolver.java From atlas with Apache License 2.0 | 5 votes |
public List<ResolvedDependencyInfo> resolve(List<DependencyResult> dependencyResults, boolean mainBundle) { Multimap<String, ResolvedDependencyInfo> dependenciesMap = LinkedHashMultimap.create(); // Instead of using the official flat dependency treatment, you can use your own tree dependence; For application dependencies, we only take compile dependencies Set<ModuleVersionIdentifier> directDependencies = new HashSet<ModuleVersionIdentifier>(); Set<String> resolveSets = new HashSet<>(); for (DependencyResult dependencyResult : dependencyResults) { if (dependencyResult instanceof ResolvedDependencyResult) { ModuleVersionIdentifier moduleVersion = ((ResolvedDependencyResult)dependencyResult).getSelected() .getModuleVersion(); CircleDependencyCheck circleDependencyCheck = new CircleDependencyCheck(moduleVersion); if (!directDependencies.contains(moduleVersion)) { directDependencies.add(moduleVersion); resolveDependency(null, ((ResolvedDependencyResult)dependencyResult).getSelected(), artifacts, variantDeps, 0, circleDependencyCheck, circleDependencyCheck.getRootDependencyNode(), dependenciesMap, resolveSets,mainBundle); } } } List<ResolvedDependencyInfo> mainResolvdInfo = resolveAllDependencies(dependenciesMap); if (mainBundle) { for (ResolvedDependencyInfo resolvedDependencyInfo : mainResolvdInfo) { addMainDependencyInfo(resolvedDependencyInfo); } } return mainResolvdInfo; }
Example #6
Source File: DependencyConvertUtils.java From atlas with Apache License 2.0 | 5 votes |
public static boolean isAwbDependency(DependencyResult dependencyResult, Map<ModuleVersionIdentifier, List<ResolvedArtifact>> artifacts, Set<String>awbs) { if (dependencyResult instanceof ResolvedDependencyResult) { ResolvedDependencyResult resolvedDependencyResult = (ResolvedDependencyResult)dependencyResult; ModuleVersionIdentifier moduleVersionIdentifier = resolvedDependencyResult.getSelected().getModuleVersion(); List<ResolvedArtifact> resolvedArtifacts = artifacts.get(moduleVersionIdentifier); if (resolvedArtifacts != null && resolvedArtifacts.size() > 0) { ResolvedArtifact resolvedArtifact = resolvedArtifacts.get(0); return ("awb".equals(resolvedArtifact.getType()) || awbs.contains(resolvedArtifact.getModuleVersion().getId().getGroup()+":"+resolvedArtifact.getModuleVersion().getId().getName())); } } return false; }
Example #7
Source File: CachingDependencyResultFactory.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public ResolvedDependencyResult createResolvedDependency(ComponentSelector requested, ResolvedComponentResult from, DefaultResolvedComponentResult selected) { List<Object> key = asList(requested, from, selected); if (!resolvedDependencies.containsKey(key)) { resolvedDependencies.put(key, new DefaultResolvedDependencyResult(requested, selected, from)); } return resolvedDependencies.get(key); }
Example #8
Source File: DefaultResolutionResult.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private void eachElement(ResolvedComponentResult node, Action<? super ResolvedComponentResult> moduleAction, Action<? super DependencyResult> dependencyAction, Set<ResolvedComponentResult> visited) { if (!visited.add(node)) { return; } moduleAction.execute(node); for (DependencyResult d : node.getDependencies()) { dependencyAction.execute(d); if (d instanceof ResolvedDependencyResult) { eachElement(((ResolvedDependencyResult) d).getSelected(), moduleAction, dependencyAction, visited); } } }
Example #9
Source File: StrictDependencyResultSpec.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public boolean isSatisfiedBy(DependencyResult candidate) { if (candidate instanceof ResolvedDependencyResult) { return matchesRequested(candidate) || matchesSelected((ResolvedDependencyResult) candidate); } else { return matchesRequested(candidate); } }
Example #10
Source File: StrictDependencyResultSpec.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private boolean matchesSelected(ResolvedDependencyResult candidate) { ComponentIdentifier selected = candidate.getSelected().getId(); if (moduleIdentifier != null && selected instanceof ModuleComponentIdentifier) { ModuleComponentIdentifier selectedModule = (ModuleComponentIdentifier) selected; return selectedModule.getGroup().equals(moduleIdentifier.getGroup()) && selectedModule.getModule().equals(moduleIdentifier.getName()); } return false; }
Example #11
Source File: DependencyResultSpec.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public boolean isSatisfiedBy(DependencyResult candidate) { //The matching is very simple at the moment but it should solve majority of cases. //It operates using String#contains and it tests either requested or selected module. if (candidate instanceof ResolvedDependencyResult) { return matchesRequested(candidate) || matchesSelected((ResolvedDependencyResult) candidate); } else { return matchesRequested(candidate); } }
Example #12
Source File: DefaultResolutionResult.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private void eachElement(ResolvedComponentResult node, Action<? super ResolvedComponentResult> moduleAction, Action<? super DependencyResult> dependencyAction, Set<ResolvedComponentResult> visited) { if (!visited.add(node)) { return; } moduleAction.execute(node); for (DependencyResult d : node.getDependencies()) { dependencyAction.execute(d); if (d instanceof ResolvedDependencyResult) { eachElement(((ResolvedDependencyResult) d).getSelected(), moduleAction, dependencyAction, visited); } } }
Example #13
Source File: RenderableModuleResult.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public Set<RenderableDependency> getChildren() { Set<RenderableDependency> out = new LinkedHashSet<RenderableDependency>(); for (DependencyResult d : module.getDependencies()) { if (d instanceof UnresolvedDependencyResult) { out.add(new RenderableUnresolvedDependencyResult((UnresolvedDependencyResult) d)); } else { out.add(new RenderableDependencyResult((ResolvedDependencyResult) d)); } } return out; }
Example #14
Source File: InvertedRenderableModuleResult.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public Set<RenderableDependency> getChildren() { Map<ComponentIdentifier, RenderableDependency> children = new LinkedHashMap<ComponentIdentifier, RenderableDependency>(); for (ResolvedDependencyResult dependent : module.getDependents()) { InvertedRenderableModuleResult child = new InvertedRenderableModuleResult(dependent.getFrom()); if (!children.containsKey(child.getId())) { children.put(child.getId(), child); } } return new LinkedHashSet<RenderableDependency>(children.values()); }
Example #15
Source File: StrictDependencyResultSpec.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public boolean isSatisfiedBy(DependencyResult candidate) { if (candidate instanceof ResolvedDependencyResult) { return matchesRequested(candidate) || matchesSelected((ResolvedDependencyResult) candidate); } else { return matchesRequested(candidate); } }
Example #16
Source File: StrictDependencyResultSpec.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private boolean matchesSelected(ResolvedDependencyResult candidate) { ComponentIdentifier selected = candidate.getSelected().getId(); if (moduleIdentifier != null && selected instanceof ModuleComponentIdentifier) { ModuleComponentIdentifier selectedModule = (ModuleComponentIdentifier) selected; return selectedModule.getGroup().equals(moduleIdentifier.getGroup()) && selectedModule.getModule().equals(moduleIdentifier.getName()); } return false; }
Example #17
Source File: DependencyResultSpec.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public boolean isSatisfiedBy(DependencyResult candidate) { //The matching is very simple at the moment but it should solve majority of cases. //It operates using String#contains and it tests either requested or selected module. if (candidate instanceof ResolvedDependencyResult) { return matchesRequested(candidate) || matchesSelected((ResolvedDependencyResult) candidate); } else { return matchesRequested(candidate); } }
Example #18
Source File: RenderableDependencyResult.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public Set<RenderableDependency> getChildren() { Set<RenderableDependency> out = new LinkedHashSet<RenderableDependency>(); for (DependencyResult d : dependency.getSelected().getDependencies()) { if (d instanceof UnresolvedDependencyResult) { out.add(new RenderableUnresolvedDependencyResult((UnresolvedDependencyResult) d)); } else { out.add(new RenderableDependencyResult((ResolvedDependencyResult) d)); } } return out; }
Example #19
Source File: RenderableModuleResult.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public Set<RenderableDependency> getChildren() { Set<RenderableDependency> out = new LinkedHashSet<RenderableDependency>(); for (DependencyResult d : module.getDependencies()) { if (d instanceof UnresolvedDependencyResult) { out.add(new RenderableUnresolvedDependencyResult((UnresolvedDependencyResult) d)); } else { out.add(new RenderableDependencyResult((ResolvedDependencyResult) d)); } } return out; }
Example #20
Source File: InvertedRenderableModuleResult.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public Set<RenderableDependency> getChildren() { Map<ComponentIdentifier, RenderableDependency> children = new LinkedHashMap<ComponentIdentifier, RenderableDependency>(); for (ResolvedDependencyResult dependent : module.getDependents()) { InvertedRenderableModuleResult child = new InvertedRenderableModuleResult(dependent.getFrom()); if (!children.containsKey(child.getId())) { children.put(child.getId(), child); } } return new LinkedHashSet<RenderableDependency>(children.values()); }
Example #21
Source File: CachingDependencyResultFactory.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public ResolvedDependencyResult createResolvedDependency(ComponentSelector requested, ResolvedComponentResult from, DefaultResolvedComponentResult selected) { List<Object> key = asList(requested, from, selected); if (!resolvedDependencies.containsKey(key)) { resolvedDependencies.put(key, new DefaultResolvedDependencyResult(requested, selected, from)); } return resolvedDependencies.get(key); }
Example #22
Source File: DefaultResolutionResult.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private void eachElement(ResolvedComponentResult node, Action<? super ResolvedComponentResult> moduleAction, Action<? super DependencyResult> dependencyAction, Set<ResolvedComponentResult> visited) { if (!visited.add(node)) { return; } moduleAction.execute(node); for (DependencyResult d : node.getDependencies()) { dependencyAction.execute(d); if (d instanceof ResolvedDependencyResult) { eachElement(((ResolvedDependencyResult) d).getSelected(), moduleAction, dependencyAction, visited); } } }
Example #23
Source File: CachingDependencyResultFactory.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public ResolvedDependencyResult createResolvedDependency(ComponentSelector requested, ResolvedComponentResult from, DefaultResolvedComponentResult selected) { List<Object> key = asList(requested, from, selected); if (!resolvedDependencies.containsKey(key)) { resolvedDependencies.put(key, new DefaultResolvedDependencyResult(requested, selected, from)); } return resolvedDependencies.get(key); }
Example #24
Source File: DependencyResultSpec.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public boolean isSatisfiedBy(DependencyResult candidate) { //The matching is very simple at the moment but it should solve majority of cases. //It operates using String#contains and it tests either requested or selected module. if (candidate instanceof ResolvedDependencyResult) { return matchesRequested(candidate) || matchesSelected((ResolvedDependencyResult) candidate); } else { return matchesRequested(candidate); } }
Example #25
Source File: RenderableDependencyResult.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public Set<RenderableDependency> getChildren() { Set<RenderableDependency> out = new LinkedHashSet<RenderableDependency>(); for (DependencyResult d : dependency.getSelected().getDependencies()) { if (d instanceof UnresolvedDependencyResult) { out.add(new RenderableUnresolvedDependencyResult((UnresolvedDependencyResult) d)); } else { out.add(new RenderableDependencyResult((ResolvedDependencyResult) d)); } } return out; }
Example #26
Source File: RenderableModuleResult.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public Set<RenderableDependency> getChildren() { Set<RenderableDependency> out = new LinkedHashSet<RenderableDependency>(); for (DependencyResult d : module.getDependencies()) { if (d instanceof UnresolvedDependencyResult) { out.add(new RenderableUnresolvedDependencyResult((UnresolvedDependencyResult) d)); } else { out.add(new RenderableDependencyResult((ResolvedDependencyResult) d)); } } return out; }
Example #27
Source File: InvertedRenderableModuleResult.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public Set<RenderableDependency> getChildren() { Map<ComponentIdentifier, RenderableDependency> children = new LinkedHashMap<ComponentIdentifier, RenderableDependency>(); for (ResolvedDependencyResult dependent : module.getDependents()) { InvertedRenderableModuleResult child = new InvertedRenderableModuleResult(dependent.getFrom()); if (!children.containsKey(child.getId())) { children.put(child.getId(), child); } } return new LinkedHashSet<RenderableDependency>(children.values()); }
Example #28
Source File: StrictDependencyResultSpec.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private boolean matchesSelected(ResolvedDependencyResult candidate) { ComponentIdentifier selected = candidate.getSelected().getId(); if (moduleIdentifier != null && selected instanceof ModuleComponentIdentifier) { ModuleComponentIdentifier selectedModule = (ModuleComponentIdentifier) selected; return selectedModule.getGroup().equals(moduleIdentifier.getGroup()) && selectedModule.getModule().equals(moduleIdentifier.getName()); } return false; }
Example #29
Source File: StrictDependencyResultSpec.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public boolean isSatisfiedBy(DependencyResult candidate) { if (candidate instanceof ResolvedDependencyResult) { return matchesRequested(candidate) || matchesSelected((ResolvedDependencyResult) candidate); } else { return matchesRequested(candidate); } }
Example #30
Source File: StrictDependencyResultSpec.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private boolean matchesSelected(ResolvedDependencyResult candidate) { ComponentIdentifier selected = candidate.getSelected().getId(); if (moduleIdentifier != null && selected instanceof ModuleComponentIdentifier) { ModuleComponentIdentifier selectedModule = (ModuleComponentIdentifier) selected; return selectedModule.getGroup().equals(moduleIdentifier.getGroup()) && selectedModule.getModule().equals(moduleIdentifier.getName()); } return false; }