Java Code Examples for org.apache.ivy.core.resolve.IvyNode#getCallers()

The following examples show how to use org.apache.ivy.core.resolve.IvyNode#getCallers() . 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: XmlReportWriter.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
private void outputCallers(ConfigurationResolveReport report, PrintWriter out, IvyNode dep) {
    for (Caller caller : dep.getCallers(report.getConfiguration())) {
        final DependencyDescriptor dependencyDescriptor = caller.getDependencyDescriptor();
        out.println(String.format("\t\t\t\t<caller organisation=\"%s\" name=\"%s\" conf=\"%s\" rev=\"%s\" rev-constraint-default=\"%s\" rev-constraint-dynamic=\"%s\" callerrev=\"%s\"%s/>",
                XMLHelper.escape(caller.getModuleRevisionId().getOrganisation()),
                XMLHelper.escape(caller.getModuleRevisionId().getName()),
                XMLHelper.escape(joinArray(caller.getCallerConfigurations(), ", ")),
                XMLHelper.escape(caller.getAskedDependencyId().getRevision()),
                XMLHelper.escape(dependencyDescriptor.getDependencyRevisionId().getRevision()),
                XMLHelper.escape(dependencyDescriptor.getDynamicConstraintDependencyRevisionId().getRevision()),
                XMLHelper.escape(caller.getModuleRevisionId().getRevision()),
                extraToString(dependencyDescriptor.getQualifiedExtraAttributes(), SEPARATOR)));
    }
}
 
Example 2
Source File: LatestCompatibleConflictManager.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
/**
 * Tries to blacklist exactly one version for all callers paths.
 *
 * @param versionMatcher
 *            the version matcher to use to interpret versions
 * @param conflictParent
 *            the node in which the conflict is occurring
 * @param selectedNode
 *            the node in favor of which the conflict is resolved
 * @param evictedNode
 *            the node which will be evicted if we are able to blacklist all paths
 * @param callerStack
 *            ditto
 * @return the collection of blacklisting to do, null if a blacklist is not possible in at least
 *         one caller path
 */
private Collection<IvyNodeBlacklist> blackListIncompatibleCaller(VersionMatcher versionMatcher,
        IvyNode conflictParent, IvyNode selectedNode, IvyNode evictedNode,
        Stack<IvyNode> callerStack) {
    Collection<IvyNodeBlacklist> blacklisted = new ArrayList<>();
    IvyNode node = callerStack.peek();
    String rootModuleConf = conflictParent.getData().getReport().getConfiguration();
    for (Caller caller : node.getCallers(rootModuleConf)) {
        IvyNode callerNode = node.findNode(caller.getModuleRevisionId());
        if (callerNode.isBlacklisted(rootModuleConf)) {
            continue;
        }
        if (versionMatcher.isDynamic(caller.getAskedDependencyId())) {
            blacklisted.add(new IvyNodeBlacklist(conflictParent, selectedNode, evictedNode,
                    node, rootModuleConf));
            if (node.isEvicted(rootModuleConf)
                    && !handleIncompatibleCaller(callerStack, node, callerNode, conflictParent,
                        selectedNode, evictedNode, blacklisted, versionMatcher)) {
                return null;
            }
        } else if (!handleIncompatibleCaller(callerStack, node, callerNode, conflictParent,
            selectedNode, evictedNode, blacklisted, versionMatcher)) {
            return null;
        }
    }
    if (blacklisted.isEmpty() && !callerStack.subList(0, callerStack.size() - 1).contains(node)) {
        return null;
    }
    return blacklisted;
}