Package org.apache.ivy.core.resolve

Examples of org.apache.ivy.core.resolve.IvyNode


    private void attachToParents(IvyNode ivyNode, ReportConversionContext context) {
        Map<String, ConfigurationDetails> resolvedDependencies = context.handledNodes.get(ivyNode.getId());
        for (IvyNodeCallers.Caller caller : ivyNode.getCallers(context.conf)) {
            Set<String> dependencyConfigurationsForNode = getDependencyConfigurationsByCaller(ivyNode, caller);
            IvyNode parentNode = isRootCaller(context.configurationResolveReport, caller) ? ivyNode.getRoot() : context.configurationResolveReport.getDependency(caller.getModuleRevisionId());
            if (!isResolvedNode(parentNode, context.conf)) {
                continue;
            }
            Map<String, ConfigurationDetails> parentResolvedDependencies = context.handledNodes.get(parentNode.getId());
            if (parentResolvedDependencies == null) {
                throw new IllegalStateException(String.format("Could not find caller node %s for node %s. Available nodes: %s",
                        parentNode.getId(), ivyNode.getId(), context.handledNodes.keySet()));
            }
            createAssociationsBetweenChildAndParentResolvedDependencies(ivyNode, resolvedDependencies, context.resolvedArtifacts, parentNode, caller,
                    dependencyConfigurationsForNode, parentResolvedDependencies.values());
        }
    }
View Full Code Here


        List deps = report.getDependencies();
        Iterator dependencies = deps.iterator();
        String[] confs = report.getConfigurations();
        while (dependencies.hasNext()) {
            IvyNode node = (IvyNode) dependencies.next();
            for (int i = 0; i < confs.length; i++) {
                String conf = confs[i];
                if (!node.isEvicted(conf)) {
                    boolean flag1 = report.getConfigurationReport(conf).getDependency(
                        node.getResolvedId()) != null;
                    boolean flag2 = report.getConfigurationReport(conf).getModuleRevisionIds()
                            .contains(node.getResolvedId());
                    assertEquals("Inconsistent data for node " + node + " in conf " + conf, flag1,
                        flag2);
                }
            }
        }
View Full Code Here

    public Collection resolveConflicts(IvyNode parent, Collection conflicts) {
        if (conflicts.size() < 2) {
            return conflicts;
        }
        for (Iterator iter = conflicts.iterator(); iter.hasNext();) {
            IvyNode node = (IvyNode) iter.next();
            DependencyDescriptor dd = node.getDependencyDescriptor(parent);
            if (dd != null && dd.isForce()
                    && parent.getResolvedId().equals(dd.getParentRevisionId())) {
                return Collections.singleton(node);
            }
        }

        /*
         * If the list of conflicts contains dynamic revisions, delay the conflict calculation until
         * they are resolved. TODO: we probably could already evict some of the dynamic revisions!
         */
        for (Iterator iter = conflicts.iterator(); iter.hasNext();) {
            IvyNode node = (IvyNode) iter.next();
            ModuleRevisionId modRev = node.getResolvedId();
            if (getSettings().getVersionMatcher().isDynamic(modRev)) {
                return null;
            }
        }

View Full Code Here

    }

    protected ArtifactInfo[] toArtifactInfo(Collection conflicts) {
        List artifacts = new ArrayList(conflicts.size());
        for (Iterator iter = conflicts.iterator(); iter.hasNext();) {
            IvyNode node = (IvyNode) iter.next();
            artifacts.add(new IvyNodeArtifactInfo(node));
        }
        return (ArtifactInfo[]) artifacts.toArray(new ArtifactInfo[artifacts.size()]);
    }
View Full Code Here

    }

    public Collection resolveConflicts(IvyNode parent, Collection conflicts) {
        VersionMatcher versionMatcher = getSettings().getVersionMatcher();

        IvyNode lastNode = null;
        for (Iterator iter = conflicts.iterator(); iter.hasNext();) {
            IvyNode node = (IvyNode) iter.next();

            if (versionMatcher.isDynamic(node.getResolvedId())) {
                // dynamic revision, not enough information to resolve conflict
                return null;
            }

            if (lastNode != null && !lastNode.equals(node)) {
View Full Code Here

            return conflicts;
        }
        VersionMatcher versionMatcher = getSettings().getVersionMatcher();

        Iterator iter = conflicts.iterator();
        IvyNode node = (IvyNode) iter.next();
        ModuleRevisionId mrid = node.getResolvedId();

        if (versionMatcher.isDynamic(mrid)) {
            while (iter.hasNext()) {
                IvyNode other = (IvyNode) iter.next();
                if (versionMatcher.isDynamic(other.getResolvedId())) {
                    // two dynamic versions in conflict, not enough information yet
                    return null;
                } else if (!versionMatcher.accept(mrid, other.getResolvedId())) {
                    // incompatibility found
                    if (!handleIncompatibleConflict(parent, conflicts, node, other)) {
                        return null;
                    }
                }
            }
            // no incompatibility nor dynamic version found, let's return the latest static version
            if (conflicts.size() == 2) {
                // very common special case of only two modules in conflict,
                // let's return the second one (static)
                Iterator it = conflicts.iterator();
                it.next();
                return Collections.singleton(it.next());
            }
            Collection newConflicts = new LinkedHashSet(conflicts);
            newConflicts.remove(node);
            return super.resolveConflicts(parent, newConflicts);
        } else {
            // the first node is a static revision, let's see if all other versions match
            while (iter.hasNext()) {
                IvyNode other = (IvyNode) iter.next();
                if (!versionMatcher.accept(other.getResolvedId(), mrid)) {
                    // incompatibility found
                    if (!handleIncompatibleConflict(parent, conflicts, node, other)) {
                        return null;
                    }
                }
View Full Code Here

        // but returning a boolean make the calling code cleaner
        try {
            IvyNodeArtifactInfo latest = (IvyNodeArtifactInfo) getStrategy().findLatest(
                toArtifactInfo(Arrays.asList(new IvyNode[] {node, other})), null);
            if (latest != null) {
                IvyNode latestNode = latest.getNode();
                IvyNode oldestNode = latestNode == node ? other : node;
                blackListIncompatibleCallerAndRestartResolveIfPossible(getSettings(), parent,
                    oldestNode, latestNode);
                // if we arrive here, we haven't managed to blacklist all paths to the latest
                // node, we try with the oldest
                blackListIncompatibleCallerAndRestartResolveIfPossible(getSettings(), parent,
View Full Code Here

     */
    private Collection/* <IvyNodeBlacklist> */blackListIncompatibleCaller(
            VersionMatcher versionMatcher, IvyNode conflictParent, IvyNode selectedNode,
            IvyNode evictedNode, Stack/* <IvyNode> */callerStack) {
        Collection/* <IvyNodeBlacklist> */blacklisted = new ArrayList/* <IvyNodeBlacklist> */();
        IvyNode node = (IvyNode) callerStack.peek();
        String rootModuleConf = conflictParent.getData().getReport().getConfiguration();
        Caller[] callers = node.getCallers(rootModuleConf);
        for (int i = 0; i < callers.length; i++) {
            IvyNode callerNode = node.findNode(callers[i].getModuleRevisionId());
            if (callerNode.isBlacklisted(rootModuleConf)) {
                continue;
            }
            if (versionMatcher.isDynamic(callers[i].getAskedDependencyId(node.getData()))) {
                blacklisted.add(new IvyNodeBlacklist(conflictParent, selectedNode, evictedNode,
                        node, rootModuleConf));
View Full Code Here

            ModuleRevisionId mrid = (ModuleRevisionId) iterator.next();
            blacklisted.add(resolveData.getNode(mrid));
        }

        for (Iterator iterator = blacklisted.iterator(); iterator.hasNext();) {
            IvyNode node = (IvyNode) iterator.next();
            IvyNodeBlacklist bdata = node.getBlacklistData(resolveData.getReport()
                    .getConfiguration());
            handleUnsolvableConflict(bdata.getConflictParent(),
                Arrays.asList(new Object[] {bdata.getEvictedNode(), bdata.getSelectedNode()}),
                bdata.getEvictedNode(), bdata.getSelectedNode());
        }
View Full Code Here

        ResolveReport report = getResolvedReport();
        log("Dependency tree for " + report.getResolveId());
        ModuleRevisionId mrid = report.getModuleDescriptor().getModuleRevisionId();
        // make dependency tree easier to fetch informations
        for (Iterator iterator = report.getDependencies().iterator(); iterator.hasNext();) {
            IvyNode dependency = (IvyNode) iterator.next();
            populateDependencyTree(dependency, mrid, report);
        }
        printDependencies((List) dependencies.get(mrid), 0);
    }
View Full Code Here

TOP

Related Classes of org.apache.ivy.core.resolve.IvyNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.