/** Populates the result from the graph traversal state. */
  private void assembleResult(ResolveState resolveState, DependencyGraphVisitor listener) {
    listener.start(resolveState.root);

    // Visit the nodes
    for (ConfigurationNode resolvedConfiguration : resolveState.getConfigurationNodes()) {
      if (resolvedConfiguration.isSelected()) {
        resolvedConfiguration.validate();
        listener.visitNode(resolvedConfiguration);
      }
    }
    // Visit the edges
    for (ConfigurationNode resolvedConfiguration : resolveState.getConfigurationNodes()) {
      if (resolvedConfiguration.isSelected()) {
        listener.visitEdge(resolvedConfiguration);
      }
    }

    listener.finish(resolveState.root);
  }
Esempio n. 2
0
  /** Populates the result from the graph traversal state. */
  private void assembleResult(
      ResolveState resolveState,
      ResolvedConfigurationBuilder result,
      ResolvedConfigurationListener listener) {
    FailureState failureState = new FailureState(resolveState.root);
    ModuleVersionIdentifier root = resolveState.root.toId();
    listener.start(root);

    for (ConfigurationNode resolvedConfiguration : resolveState.getConfigurationNodes()) {
      if (resolvedConfiguration.isSelected()) {
        resolvedConfiguration.attachToParents(result);
        resolvedConfiguration.collectFailures(failureState);
        listener.resolvedModuleVersion(resolvedConfiguration.moduleRevision);
      }
    }
    for (ConfigurationNode resolvedConfiguration : resolveState.getConfigurationNodes()) {
      if (resolvedConfiguration.isSelected()) {
        listener.resolvedConfiguration(
            resolvedConfiguration.toId(), resolvedConfiguration.outgoingEdges);
      }
    }
    failureState.attachFailures(result);
    result.done(resolveState.root.getResult());
  }