예제 #1
0
 public ModuleVersionSpec getSelector() {
   String[] configurations =
       from.metaData.getHierarchy().toArray(new String[from.metaData.getHierarchy().size()]);
   ModuleVersionSpec selector =
       ModuleVersionSpec.forExcludes(dependencyDescriptor.getExcludeRules(configurations));
   return selector.intersect(selectorSpec);
 }
예제 #2
0
    public void visitOutgoingDependencies(Collection<DependencyEdge> target) {
      // If this configuration's version is in conflict, don't do anything
      // If not traversed before, add all selected outgoing edges
      // If traversed before, and the selected modules have changed, remove previous outgoing edges
      // and add outgoing edges again with
      //    the new selections.
      // If traversed before, and the selected modules have not changed, ignore
      // If none of the incoming edges are transitive, then the node has no outgoing edges

      if (moduleRevision.state != ModuleState.Selected) {
        LOGGER.debug("version for {} is not selected. ignoring.", this);
        return;
      }

      List<DependencyEdge> transitiveIncoming = new ArrayList<DependencyEdge>();
      for (DependencyEdge edge : incomingEdges) {
        if (edge.isTransitive()) {
          transitiveIncoming.add(edge);
        }
      }

      if (transitiveIncoming.isEmpty() && this != resolveState.root) {
        if (previousTraversal != null) {
          removeOutgoingEdges();
        }
        if (incomingEdges.isEmpty()) {
          LOGGER.debug("{} has no incoming edges. ignoring.", this);
        } else {
          LOGGER.debug("{} has no transitive incoming edges. ignoring outgoing edges.", this);
        }
        return;
      }

      ModuleVersionSpec selectorSpec = getSelector(transitiveIncoming);
      if (previousTraversal != null) {
        if (previousTraversal.acceptsSameModulesAs(selectorSpec)) {
          LOGGER.debug(
              "Changed edges for {} selects same versions as previous traversal. ignoring", this);
          return;
        }
        removeOutgoingEdges();
      }

      for (DependencyMetaData dependency : metaData.getDependencies()) {
        DependencyDescriptor dependencyDescriptor = dependency.getDescriptor();
        ModuleId targetModuleId = dependencyDescriptor.getDependencyRevisionId().getModuleId();
        if (!selectorSpec.isSatisfiedBy(targetModuleId)) {
          LOGGER.debug("{} is excluded from {}.", targetModuleId, this);
          continue;
        }
        DependencyEdge dependencyEdge =
            new DependencyEdge(this, dependency, selectorSpec, resolveState);
        outgoingEdges.add(dependencyEdge);
        target.add(dependencyEdge);
      }
      previousTraversal = selectorSpec;
    }
예제 #3
0
 private ModuleVersionSpec getSelector(List<DependencyEdge> transitiveEdges) {
   ModuleVersionSpec selector;
   if (transitiveEdges.isEmpty()) {
     selector = ModuleVersionSpec.forExcludes(); // includes all
   } else {
     selector = transitiveEdges.get(0).getSelector();
     for (int i = 1; i < transitiveEdges.size(); i++) {
       DependencyEdge dependencyEdge = transitiveEdges.get(i);
       selector = selector.union(dependencyEdge.getSelector());
     }
   }
   selector = selector.intersect(ModuleVersionSpec.forExcludes(metaData.getExcludeRules()));
   return selector;
 }