Java 类org.gradle.api.artifacts.result.ResolvedDependencyResult 实例源码

项目:atlas    文件:AwoDependency.java   
private void collectDependens(Set<ResolvedDependencyResult> compileOnlyDependencySet) {
    for (ResolvedDependencyResult resolvedDependencyResult : compileOnlyDependencySet) {

        compileDependencies.add(resolvedDependencyResult.getSelected()
                                        .getModuleVersion()
                                        .getGroup() +
                                        "-" +
                                        resolvedDependencyResult.getSelected()
                                                .getModuleVersion()
                                                .getName());

        Set<ResolvedDependencyResult> resolvedDependencyResults = new HashSet<ResolvedDependencyResult>();
        if (null != resolvedDependencyResult.getSelected().getDependencies()) {
            for (DependencyResult sub : resolvedDependencyResult.getSelected()
                    .getDependencies()) {
                if (sub instanceof ResolvedDependencyResult) {
                    resolvedDependencyResults.add((ResolvedDependencyResult) sub);
                }
            }
        }

        collectDependens(resolvedDependencyResults);
    }
}
项目:Reer    文件:DefaultResolutionResultBuilder.java   
public void visitOutgoingEdges(Long fromComponent, Collection<? extends DependencyResult> dependencies) {
    for (DependencyResult d : dependencies) {
        DefaultResolvedComponentResult from = modules.get(fromComponent);
        org.gradle.api.artifacts.result.DependencyResult dependency;
        if (d.getFailure() != null) {
            dependency = dependencyResultFactory.createUnresolvedDependency(d.getRequested(), from, d.getReason(), d.getFailure());
        } else {
            DefaultResolvedComponentResult selected = modules.get(d.getSelected());
            dependency = dependencyResultFactory.createResolvedDependency(d.getRequested(), from, selected);
            selected.addDependent((ResolvedDependencyResult) dependency);
        }
        from.addDependency(dependency);
    }
}
项目:Reer    文件:CachingDependencyResultFactory.java   
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);
}
项目:Reer    文件:DefaultResolutionResult.java   
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);
        }
    }
}
项目:Reer    文件:StrictDependencyResultSpec.java   
@Override
public boolean isSatisfiedBy(DependencyResult candidate) {
    if (candidate instanceof ResolvedDependencyResult) {
        return matchesRequested(candidate) || matchesSelected((ResolvedDependencyResult) candidate);
    } else {
        return matchesRequested(candidate);
    }
}
项目:Reer    文件:StrictDependencyResultSpec.java   
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;
}
项目:Reer    文件:DependencyResultSpec.java   
@Override
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);
    }
}
项目:Reer    文件:DependencyInsightReporter.java   
public Collection<RenderableDependency> prepare(Collection<DependencyResult> input, VersionSelectorScheme versionSelectorScheme, VersionComparator versionComparator) {
    LinkedList<RenderableDependency> out = new LinkedList<RenderableDependency>();
    List<DependencyEdge> dependencies = CollectionUtils.collect(input, new Transformer<DependencyEdge, DependencyResult>() {
        @Override
        public DependencyEdge transform(DependencyResult result) {
            if (result instanceof UnresolvedDependencyResult) {
                return new UnresolvedDependencyEdge((UnresolvedDependencyResult) result);
            } else {
                return new ResolvedDependencyEdge((ResolvedDependencyResult) result);
            }
        }
    });
    Collection<DependencyEdge> sorted = DependencyResultSorter.sort(dependencies, versionSelectorScheme, versionComparator);

    //remember if module id was annotated
    HashSet<ComponentIdentifier> annotated = new HashSet<ComponentIdentifier>();
    RequestedVersion current = null;

    for (DependencyEdge dependency : sorted) {
        //add description only to the first module
        if (annotated.add(dependency.getActual())) {
            //add a heading dependency with the annotation if the dependency does not exist in the graph
            if (!dependency.getRequested().matchesStrictly(dependency.getActual())) {
                out.add(new DependencyReportHeader(dependency));
                current = new RequestedVersion(dependency.getRequested(), dependency.getActual(), dependency.isResolvable(), null);
                out.add(current);
            } else {
                current = new RequestedVersion(dependency.getRequested(), dependency.getActual(), dependency.isResolvable(), getReasonDescription(dependency.getReason()));
                out.add(current);
            }
        } else if (!current.getRequested().equals(dependency.getRequested())) {
            current = new RequestedVersion(dependency.getRequested(), dependency.getActual(), dependency.isResolvable(), null);
            out.add(current);
        }

        current.addChild(dependency);
    }

    return out;
}
项目:Reer    文件:RenderableDependencyResult.java   
@Override
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;
}
项目:Reer    文件:RenderableModuleResult.java   
@Override
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;
}
项目:Reer    文件:InvertedRenderableModuleResult.java   
@Override
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());
}
项目:atlas    文件:DependencyResolver.java   
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);
            }
        }
    }

    List<ResolvedDependencyInfo> mainResolvdInfo = resolveAllDependencies(dependenciesMap);
    if (mainBundle) {
        for (ResolvedDependencyInfo resolvedDependencyInfo : mainResolvdInfo) {
            addMainDependencyInfo(resolvedDependencyInfo);
        }
    }
    return mainResolvdInfo;

}
项目:atlas    文件:DependencyConvertUtils.java   
public static boolean isAwbDependency(DependencyResult dependencyResult,
                                      Map<ModuleVersionIdentifier, List<ResolvedArtifact>> artifacts) {
    if (dependencyResult instanceof ResolvedDependencyResult) {
        ResolvedDependencyResult resolvedDependencyResult = (ResolvedDependencyResult)dependencyResult;
        ModuleVersionIdentifier moduleVersionIdentifier = resolvedDependencyResult.getSelected().getModuleVersion();
        List<ResolvedArtifact> resolvedArtifacts = artifacts.get(moduleVersionIdentifier);

        if (resolvedArtifacts.size() > 0) {
            ResolvedArtifact resolvedArtifact = resolvedArtifacts.get(0);
            return ("awb".equals(resolvedArtifact.getType()));
        }
    }
    return false;
}
项目:Pushjet-Android    文件:CachingDependencyResultFactory.java   
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);
}
项目:Pushjet-Android    文件:DefaultResolutionResult.java   
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);
        }
    }
}
项目:Pushjet-Android    文件:StrictDependencyResultSpec.java   
public boolean isSatisfiedBy(DependencyResult candidate) {
    if (candidate instanceof ResolvedDependencyResult) {
        return matchesRequested(candidate) || matchesSelected((ResolvedDependencyResult) candidate);
    } else {
        return matchesRequested(candidate);
    }
}
项目:Pushjet-Android    文件:StrictDependencyResultSpec.java   
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;
}
项目:Pushjet-Android    文件:DependencyResultSpec.java   
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);
    }
}
项目:Pushjet-Android    文件:RenderableDependencyResult.java   
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;
}
项目:Pushjet-Android    文件:RenderableModuleResult.java   
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;
}
项目:Pushjet-Android    文件:InvertedRenderableModuleResult.java   
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());
}
项目:Pushjet-Android    文件:StrictDependencyResultSpec.java   
public boolean isSatisfiedBy(DependencyResult candidate) {
    if (candidate instanceof ResolvedDependencyResult) {
        return matchesRequested(candidate) || matchesSelected((ResolvedDependencyResult) candidate);
    } else {
        return matchesRequested(candidate);
    }
}
项目:Pushjet-Android    文件:StrictDependencyResultSpec.java   
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;
}
项目:Pushjet-Android    文件:DependencyResultSpec.java   
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);
    }
}
项目:Pushjet-Android    文件:RenderableDependencyResult.java   
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;
}
项目:Pushjet-Android    文件:RenderableModuleResult.java   
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;
}
项目:Pushjet-Android    文件:InvertedRenderableModuleResult.java   
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());
}
项目:Pushjet-Android    文件:CachingDependencyResultFactory.java   
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);
}
项目:Pushjet-Android    文件:DefaultResolutionResult.java   
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);
        }
    }
}
项目:Reer    文件:DefaultResolvedComponentResult.java   
public Set<ResolvedDependencyResult> getDependents() {
    return Collections.unmodifiableSet(dependents);
}
项目:Reer    文件:DefaultResolvedComponentResult.java   
public DefaultResolvedComponentResult addDependent(ResolvedDependencyResult dependent) {
    this.dependents.add(dependent);
    return this;
}
项目:Reer    文件:DependencyResultSpec.java   
private boolean matchesSelected(ResolvedDependencyResult candidate) {
    ModuleVersionIdentifier selected = candidate.getSelected().getModuleVersion();
    String selectedCandidate = selected.getGroup() + ":" + selected.getModule() + ":" + selected.getVersion();
    return selectedCandidate.contains(stringNotation);
}
项目:Reer    文件:RenderableDependencyResult.java   
public RenderableDependencyResult(ResolvedDependencyResult dependency) {
    this.dependency = dependency;
}
项目:Reer    文件:ResolvedDependencyEdge.java   
public ResolvedDependencyEdge(ResolvedDependencyResult dependency) {
    this.dependency = dependency;
}
项目:atlas    文件:AwoDependency.java   
private void collectLibraryJars(LibVariantContext libVariantContext) {

        //TODO NPE protect
        Set<DependencyResult> providedDependencySet = getDependencyResults(libVariantContext,
                                                                           "providedCompile");
        Set<DependencyResult> compileDependencySet = getDependencyResults(libVariantContext,
                                                                          "compile");
        Set<DependencyResult> debugCompileDependencySet = getDependencyResults(libVariantContext,
                                                                               "debugCompile");

        if (null == providedDependencySet) {
            providedDependencySet = new HashSet<DependencyResult>();
        }

        if (null == compileDependencySet) {
            compileDependencySet = new HashSet<DependencyResult>();
        } else {
            compileDependencySet = new HashSet<DependencyResult>(compileDependencySet);
        }

        if (null != debugCompileDependencySet && !debugCompileDependencySet.isEmpty()) {
            try {
                ((HashSet<DependencyResult>) compileDependencySet).addAll(debugCompileDependencySet);
            } catch (Throwable e) {
                e.printStackTrace();
            }
        }

        Set<ResolvedDependencyResult> compileOnlyDependencySet = new HashSet<ResolvedDependencyResult>();
        for (DependencyResult resolvedDependencyResult : compileDependencySet) {

            if (resolvedDependencyResult instanceof ResolvedDependencyResult) {

                ModuleVersionIdentifier moduleVersion = ((ResolvedDependencyResult) resolvedDependencyResult)
                        .getSelected()
                        .getModuleVersion();
                String key = moduleVersion.getGroup() + "-" + moduleVersion.getName();
                boolean exclude = false;
                for (DependencyResult resolvedDependencyResult2 : providedDependencySet) {
                    if (resolvedDependencyResult2 instanceof ResolvedDependencyResult) {
                        ModuleVersionIdentifier moduleVersion2 = ((ResolvedDependencyResult) resolvedDependencyResult2)
                                .getSelected()
                                .getModuleVersion();
                        String key2 = moduleVersion2.getGroup() + "-" + moduleVersion2.getName();
                        if (key.equals(key2)) {
                            exclude = true;
                            break;
                        }
                    }
                }

                if (!exclude) {
                    compileOnlyDependencySet.add((ResolvedDependencyResult) resolvedDependencyResult);
                }
            }
        }

        collectDependens(compileOnlyDependencySet);
    }
项目:Pushjet-Android    文件:DefaultResolvedComponentResult.java   
public Set<ResolvedDependencyResult> getDependents() {
    return Collections.unmodifiableSet(dependents);
}
项目:Pushjet-Android    文件:DefaultResolvedComponentResult.java   
public DefaultResolvedComponentResult addDependent(ResolvedDependencyResult dependent) {
    this.dependents.add(dependent);
    return this;
}
项目:Pushjet-Android    文件:DependencyResultSpec.java   
private boolean matchesSelected(ResolvedDependencyResult candidate) {
    ModuleVersionIdentifier selected = candidate.getSelected().getModuleVersion();
    String selectedCandidate = selected.getGroup() + ":" + selected.getModule() + ":" + selected.getVersion();
    return selectedCandidate.contains(stringNotation);
}
项目:Pushjet-Android    文件:RenderableDependencyResult.java   
public RenderableDependencyResult(ResolvedDependencyResult dependency) {
    this.dependency = dependency;
}
项目:Pushjet-Android    文件:ResolvedDependencyEdge.java   
public ResolvedDependencyEdge(ResolvedDependencyResult dependency) {
    this.dependency = dependency;
}