public DependencyScopeNode buildDependencyGraph(
    @NotNull Configuration configuration,
    @NotNull Project project
  ) {
    if (!project.getConfigurations().contains(configuration)) {
      throw new IllegalArgumentException("configurations of the project should be used");
    }

    IdGenerator idGenerator = new IdGenerator(nextId);
    ResolutionResult resolutionResult = configuration.getIncoming().getResolutionResult();
    ResolvedComponentResult root = resolutionResult.getRoot();
    String configurationName = configuration.getName();
    long id = idGenerator.getId(root.getId());
    String scopeDisplayName = "project " + project.getPath() + " (" + configurationName + ")";
    DependencyScopeNode node = new DependencyScopeNode(id, configurationName, scopeDisplayName, configuration.getDescription());
    node.setResolutionState(ResolutionState.RESOLVED);
    for (Dependency dependency : configuration.getAllDependencies()) {
      if (dependency instanceof FileCollectionDependency) {
        FileCollection fileCollection = ((FileCollectionDependency)dependency).getFiles();
        if (fileCollection instanceof Configuration) continue;
        Set<File> files = fileCollection.getFiles();
        if (files.isEmpty()) continue;

        String displayName = null;
        if (fileCollection instanceof Describable) {
          displayName = ((Describable)fileCollection).getDisplayName();
        }
        else {
          String string = fileCollection.toString();
          if (!"file collection".equals(string)) {
            displayName = string;
          }
        }

        if (displayName != null) {
          long fileDepId = idGenerator.getId(displayName);
          node.getDependencies().add(new FileCollectionDependencyNodeImpl(fileDepId, displayName, fileCollection.getAsPath()));
        }
        else {
          for (File file : files) {
            long fileDepId = idGenerator.getId(file.getPath());
            node.getDependencies().add(new FileCollectionDependencyNodeImpl(fileDepId, file.getName(), file.getPath()));
          }
        }
      }
    }


    Map<Object, DependencyNode> added = new LinkedHashMap<>();

    for (DependencyResult child : root.getDependencies()) {
      node.getDependencies().add(buildDependencyNode(child, added, idGenerator));
    }

    return node;
  }
public DependencyScopeNode buildDependencyGraph(
    @NotNull Configuration configuration,
    @NotNull Project project
  )