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

项目: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);
    }
}
项目:atlas    文件:DependencyGroup.java   
private Set<String> getBundleDependencies(Configuration compileClasspath,
                                          Set<? extends DependencyResult> bundleDependencies) {
    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())) {
                    bundleSets.add(
                        dependency.getGroup() + ":" + dependency.getName() + ":" + dependency.getVersion());
                }
            }
        }
    }
    return bundleSets;
}
项目:Reer    文件:ErrorHandlingConfigurationResolver.java   
public Set<? extends DependencyResult> getAllDependencies() {
    try {
        return resolutionResult.getAllDependencies();
    } catch (Throwable e) {
        throw wrapException(e, resolveContext);
    }
}
项目:Reer    文件:DefaultResolutionResult.java   
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;
}
项目: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    文件:JsonProjectDependencyRenderer.java   
private List createInsight(ModuleIdentifier module, final Configuration configuration) {
    final Spec<DependencyResult> dependencySpec = new StrictDependencyResultSpec(module);

    ResolutionResult result = configuration.getIncoming().getResolutionResult();
    final Set<DependencyResult> selectedDependencies = new LinkedHashSet<DependencyResult>();

    result.allDependencies(new Action<DependencyResult>() {
        @Override
        public void execute(DependencyResult it) {
            if (dependencySpec.isSatisfiedBy(it)) {
                selectedDependencies.add(it);
            }
        }
    });

    Collection<RenderableDependency> sortedDeps = new DependencyInsightReporter().prepare(selectedDependencies, versionSelectorScheme, versionComparator);
    return CollectionUtils.collect(sortedDeps, new Transformer<Object, RenderableDependency>() {
        @Override
        public Object transform(RenderableDependency dependency) {
            String name = replaceArrow(dependency.getName());
            LinkedHashMap<String, Object> map = new LinkedHashMap<String, Object>(5);
            map.put("name", replaceArrow(dependency.getName()));
            map.put("description", dependency.getDescription());
            map.put("resolvable", dependency.getResolutionState());
            map.put("hasConflict", !name.equals(dependency.getName()));
            map.put("children", createInsightDependencyChildren(dependency, new HashSet<Object>(), configuration));
            return map;
        }
    });
}
项目: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 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;
}
项目:Reer    文件:DependencyResultSpecNotationConverter.java   
@Override
public void convert(String notation, NotationConvertResult<? super Spec<DependencyResult>> result) throws TypeConversionException {
    final String stringNotation = notation.trim();
    if (stringNotation.length() > 0) {
        result.converted(new DependencyResultSpec(stringNotation));
    }
}
项目:Reer    文件:DependencyResultSpecNotationConverter.java   
public static NotationParser<Object, Spec<DependencyResult>> parser() {
    return NotationParserBuilder
            .toType(new TypeInfo<Spec<DependencyResult>>(Spec.class))
            .invalidNotationMessage("Please check the input for the DependencyInsight.dependency element.")
            .fromType(Closure.class, new ClosureToSpecNotationConverter<DependencyResult>(DependencyResult.class))
            .fromCharSequence(new DependencyResultSpecNotationConverter())
            .toComposite();
}
项目: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    文件:DependencyResultSpec.java   
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;
}
项目: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    文件:DefaultIdeDependencyResolver.java   
/**
 * Finds all unresolved dependency results.
 *
 * @param dependencies Unfiltered dependencies
 * @return Unresolved dependency results.
 */
private List<UnresolvedDependencyResult> findAllUnresolvedDependencyResults(Set<? extends DependencyResult> dependencies) {
    List<UnresolvedDependencyResult> unresolvedDependencyResults = new ArrayList<UnresolvedDependencyResult>();

    for (DependencyResult dependencyResult : dependencies) {
        if (dependencyResult instanceof UnresolvedDependencyResult) {
            unresolvedDependencyResults.add((UnresolvedDependencyResult) dependencyResult);
        }
    }

    return unresolvedDependencyResults;
}
项目:atlas    文件:AwoDependency.java   
private Set<DependencyResult> getDependencyResults(LibVariantContext libVariantContext,
                                                   String name) {
    return (Set<DependencyResult>) libVariantContext.getProject()
            .getConfigurations()
            .getAt(name)
            .getIncoming()
            .getResolutionResult()
            .getRoot()
            .getDependencies();
}
项目: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    文件:AtlasDepTreeParser.java   
public AtlasDependencyTree parseDependencyTree(@NonNull VariantDependencies variantDeps) {

        String name = variantDeps.getName().toLowerCase();
        if (!name.endsWith("debug") && !name.endsWith("release")) {
            return new AtlasDependencyTree(new ArrayList<>());
        }

        Configuration compileClasspath = variantDeps.getCompileConfiguration();
        Configuration packageClasspath = variantDeps.getPackageConfiguration();
        Configuration bundleClasspath = project.getConfigurations().maybeCreate(AtlasPlugin.BUNDLE_COMPILE);

        ensureConfigured(compileClasspath);
        ensureConfigured(packageClasspath);
        ensureConfigured(bundleClasspath);

        Map<ModuleVersionIdentifier, List<ResolvedArtifact>> artifacts = Maps.newHashMap();
        collectArtifacts(compileClasspath, artifacts);
        collectArtifacts(packageClasspath, artifacts);
        collectArtifacts(bundleClasspath, artifacts);

        //Rely on the group
        DependencyGroup dependencyGroup = new DependencyGroup(compileClasspath, bundleClasspath,artifacts);

        DependencyResolver dependencyResolver = new DependencyResolver(project, variantDeps, artifacts,
                                                                       dependencyGroup.bundleProvidedMap,
                                                                       apDependencies);

        mResolvedDependencies.addAll(dependencyResolver.resolve(dependencyGroup.compileDependencies, true));

        for (DependencyResult dependencyResult : dependencyGroup.bundleDependencies) {
            mResolvedDependencies.addAll(dependencyResolver.resolve(Arrays.asList(dependencyResult), false));
        }

        AtlasDependencyTree atlasDependencyTree = toAtlasDependencyTree();

        check(atlasDependencyTree);

        return atlasDependencyTree;
    }
项目: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    文件:ErrorHandlingArtifactDependencyResolver.java   
public Set<? extends DependencyResult> getAllDependencies() {
    try {
        return resolutionResult.getAllDependencies();
    } catch (Throwable e) {
        throw wrapException(e, configuration);
    }
}
项目:Pushjet-Android    文件:DefaultResolutionResult.java   
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;
}
项目: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 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;
}
项目:Pushjet-Android    文件:DependencyResultSpecNotationParser.java   
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();
}
项目: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    文件:DependencyResultSpec.java   
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;
}
项目: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    文件: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 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;
}
项目:Pushjet-Android    文件:DependencyResultSpecNotationParser.java   
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);
}
项目:Pushjet-Android    文件:DependencyResultSpecNotationParser.java   
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();
}
项目: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    文件:DependencyResultSpec.java   
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;
}
项目: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    文件:ErrorHandlingArtifactDependencyResolver.java   
public Set<? extends DependencyResult> getAllDependencies() {
    try {
        return resolutionResult.getAllDependencies();
    } catch (Throwable e) {
        throw wrapException(e, configuration);
    }
}
项目:Pushjet-Android    文件:DefaultResolutionResult.java   
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;
}