org.gradle.api.artifacts.result.DependencyResult Java Examples
The following examples show how to use
org.gradle.api.artifacts.result.DependencyResult.
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: DependencyGroup.java From atlas with Apache License 2.0 | 6 votes |
private Set<String> getBundleDependencies(Configuration compileClasspath, Set<? extends DependencyResult> bundleDependencies, Set<String> awbs) { Set<String> bundleSets = new HashSet<>(); for (DependencyResult dependencyResult : bundleDependencies) { bundleSets.add(dependencyResult.toString()); } for (Dependency dependency : compileClasspath.getAllDependencies()) { if (dependency instanceof DefaultExternalModuleDependency) { DefaultExternalModuleDependency externalModuleDependency = (DefaultExternalModuleDependency)dependency; if (!((DefaultExternalModuleDependency)dependency).getArtifacts().isEmpty()) { if (StringUtils.equalsIgnoreCase("awb", ((DefaultExternalModuleDependency)dependency).getArtifacts() .iterator().next().getType()) || awbs.contains(dependency.getGroup()+":"+dependency.getName())) { bundleSets.add( dependency.getGroup() + ":" + dependency.getName() + ":" + dependency.getVersion()); } } } } return bundleSets; }
Example #2
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 #3
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 #4
Source File: DependencyResultSpec.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private boolean matchesRequested(DependencyResult candidate) { ComponentSelector requested = candidate.getRequested(); if(requested instanceof ModuleComponentSelector) { ModuleComponentSelector requestedModule = (ModuleComponentSelector)requested; String requestedCandidate = requestedModule.getGroup() + ":" + requestedModule.getModule() + ":" + requestedModule.getVersion(); return requestedCandidate.contains(stringNotation); } return false; }
Example #5
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 #6
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 #7
Source File: DependencyResolver.java From atlas with Apache License 2.0 | 5 votes |
public DependencyResolver(Project project, VariantDependencies variantDeps, Map<ModuleVersionIdentifier, List<ResolvedArtifact>> artifacts, Map<String, Set<String>> bundleProvidedMap, Map<String,Set<DependencyResult>>bundleCompileMap) { this.project = project; this.variantDeps = variantDeps; this.artifacts = artifacts; this.bundleProvidedMap = bundleProvidedMap; this.bundleCompileMap = bundleCompileMap; if (artifacts!= null){ for (ModuleVersionIdentifier moduleVersionIdentifier:artifacts.keySet()){ ids.add(moduleVersionIdentifier.getGroup()+":"+moduleVersionIdentifier.getName()); } } // this.apDependencies = apDependencies; }
Example #8
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 #9
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 #10
Source File: ErrorHandlingArtifactDependencyResolver.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public Set<? extends DependencyResult> getAllDependencies() { try { return resolutionResult.getAllDependencies(); } catch (Throwable e) { throw wrapException(e, configuration); } }
Example #11
Source File: DefaultResolutionResult.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public Set<? extends DependencyResult> getAllDependencies() { final Set<DependencyResult> out = new LinkedHashSet<DependencyResult>(); allDependencies(new Action<DependencyResult>() { public void execute(DependencyResult dep) { out.add(dep); } }); return out; }
Example #12
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 #13
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 #14
Source File: StrictDependencyResultSpec.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private boolean matchesRequested(DependencyResult candidate) { ComponentSelector requested = candidate.getRequested(); if (moduleIdentifier != null && requested instanceof ModuleComponentSelector) { ModuleComponentSelector requestedSelector = (ModuleComponentSelector) requested; return requestedSelector.getGroup().equals(moduleIdentifier.getGroup()) && requestedSelector.getModule().equals(moduleIdentifier.getName()); } return false; }
Example #15
Source File: DependencyResultSpecNotationParser.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public static NotationParser<Object, Spec<DependencyResult>> create() { return NotationParserBuilder .toType(new TypeInfo<Spec<DependencyResult>>(Spec.class)) .invalidNotationMessage("Please check the input for the DependencyInsight.dependency element.") .fromType(Closure.class, new ClosureToSpecNotationParser<DependencyResult>(DependencyResult.class)) .fromCharSequence(new DependencyResultSpecNotationParser()) .toComposite(); }
Example #16
Source File: ErrorHandlingArtifactDependencyResolver.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public Set<? extends DependencyResult> getAllDependencies() { try { return resolutionResult.getAllDependencies(); } catch (Throwable e) { throw wrapException(e, configuration); } }
Example #17
Source File: DependencyResultSpec.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private boolean matchesRequested(DependencyResult candidate) { ComponentSelector requested = candidate.getRequested(); if(requested instanceof ModuleComponentSelector) { ModuleComponentSelector requestedModule = (ModuleComponentSelector)requested; String requestedCandidate = requestedModule.getGroup() + ":" + requestedModule.getModule() + ":" + requestedModule.getVersion(); return requestedCandidate.contains(stringNotation); } return false; }
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: 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 #21
Source File: StrictDependencyResultSpec.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private boolean matchesRequested(DependencyResult candidate) { ComponentSelector requested = candidate.getRequested(); if (moduleIdentifier != null && requested instanceof ModuleComponentSelector) { ModuleComponentSelector requestedSelector = (ModuleComponentSelector) requested; return requestedSelector.getGroup().equals(moduleIdentifier.getGroup()) && requestedSelector.getModule().equals(moduleIdentifier.getName()); } return false; }
Example #22
Source File: DependencyResultSpecNotationParser.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public Spec<DependencyResult> parseNotation(final Object notation) throws UnsupportedNotationException { if (notation instanceof CharSequence) { final String stringNotation = notation.toString().trim(); if (stringNotation.length() > 0) { return new DependencyResultSpec(stringNotation); } } throw new UnsupportedNotationException(notation); }
Example #23
Source File: DependencyResultSpecNotationParser.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public static NotationParser<Object, Spec<DependencyResult>> create() { return new NotationParserBuilder<Spec<DependencyResult>>() .resultingType(new TypeInfo<Spec<DependencyResult>>(Spec.class)) .invalidNotationMessage("Please check the input for the DependencyInsight.dependency element.") .parser(new ClosureToSpecNotationParser<DependencyResult>()) .parser(new DependencyResultSpecNotationParser()) .toComposite(); }
Example #24
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 #25
Source File: DependencyResultSpec.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private boolean matchesRequested(DependencyResult candidate) { ComponentSelector requested = candidate.getRequested(); if(requested instanceof ModuleComponentSelector) { ModuleComponentSelector requestedModule = (ModuleComponentSelector)requested; String requestedCandidate = requestedModule.getGroup() + ":" + requestedModule.getModule() + ":" + requestedModule.getVersion(); return requestedCandidate.contains(stringNotation); } return false; }
Example #26
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 #27
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 #28
Source File: ErrorHandlingArtifactDependencyResolver.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public Set<? extends DependencyResult> getAllDependencies() { try { return resolutionResult.getAllDependencies(); } catch (Throwable e) { throw wrapException(e, configuration); } }
Example #29
Source File: DefaultResolutionResult.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public Set<? extends DependencyResult> getAllDependencies() { final Set<DependencyResult> out = new LinkedHashSet<DependencyResult>(); allDependencies(new Action<DependencyResult>() { public void execute(DependencyResult dep) { out.add(dep); } }); return out; }
Example #30
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); } } }