private static DataNode<? extends ExternalEntityData> createDependencyDataNode(ExternalLibraryDependency libraryDependency,
                                                                                 @NotNull DataNode<? extends ExternalEntityData> ownerDataNode,
                                                                                 @Nullable DataNode<ProjectData> ideProject,
                                                                                 AtomicInteger classpathOrderShift) {
    DependencyScope dependencyScope = getDependencyScope(libraryDependency.getScope());
    final ModuleData ownerModule = getOwnerModule(ownerDataNode);
    String libraryName = libraryDependency.getId().getPresentableName();
    LibraryData library = new LibraryData(GradleConstants.SYSTEM_ID, libraryName);
    library.setArtifactId(libraryDependency.getId().getName());
    library.setGroup(libraryDependency.getId().getGroup());
    library.setVersion(libraryDependency.getId().getVersion());

    library.addPath(LibraryPathType.BINARY, libraryDependency.getFile().getPath());
    File sourcePath = libraryDependency.getSource();
    if (sourcePath != null) {
      library.addPath(LibraryPathType.SOURCE, sourcePath.getPath());
    }
    File javaDocPath = libraryDependency.getJavadoc();
    if (javaDocPath != null) {
      library.addPath(LibraryPathType.DOC, javaDocPath.getPath());
    }

    LibraryLevel level = StringUtil.isNotEmpty(libraryName) ? LibraryLevel.PROJECT : LibraryLevel.MODULE;
    if (StringUtil.isEmpty(libraryName) || !linkProjectLibrary(ideProject, library)) {
      level = LibraryLevel.MODULE;
    }

    LibraryDependencyData libraryDependencyData = new LibraryDependencyData(ownerModule, library, level);
    libraryDependencyData.setScope(dependencyScope);
    libraryDependencyData.setOrder(libraryDependency.getClasspathOrder() + classpathOrderShift.get());
    libraryDependencyData.setExported(libraryDependency.getExported());
    return ownerDataNode.createChild(ProjectKeys.LIBRARY_DEPENDENCY, libraryDependencyData);
  }
private static DataNode<? extends ExternalEntityData> createDependencyDataNode(ExternalLibraryDependency libraryDependency,
                                                                                 @NotNull DataNode<? extends ExternalEntityData> ownerDataNode,
                                                                                 @Nullable DataNode<ProjectData> ideProject,
                                                                                 AtomicInteger classpathOrderShift)