com.intellij.openapi.roots.impl.libraries.ProjectLibraryTable Java Examples

The following examples show how to use com.intellij.openapi.roots.impl.libraries.ProjectLibraryTable. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AarLibrary.java    From intellij with Apache License 2.0 6 votes vote down vote up
/** Get path to res folder according to CLASSES root of modifiable model */
@Nullable
public PathString getResFolder(Project project) {
  Library aarLibrary =
      ProjectLibraryTable.getInstance(project)
          .getLibraryByName(this.key.getIntelliJLibraryName());
  if (aarLibrary != null) {
    VirtualFile[] files = aarLibrary.getFiles(OrderRootType.CLASSES);
    for (VirtualFile file : files) {
      if (file.isDirectory() && SdkConstants.FD_RES.equals(file.getName())) {
        return new PathString(file.getPath());
      }
    }
  }
  return null;
}
 
Example #2
Source File: BlazeScalaSyncPlugin.java    From intellij with Apache License 2.0 6 votes vote down vote up
@Override
public void updateProjectStructure(
    Project project,
    BlazeContext context,
    WorkspaceRoot workspaceRoot,
    ProjectViewSet projectViewSet,
    BlazeProjectData blazeProjectData,
    @Nullable BlazeProjectData oldBlazeProjectData,
    ModuleEditor moduleEditor,
    Module workspaceModule,
    ModifiableRootModel workspaceModifiableModel) {
  if (!blazeProjectData.getWorkspaceLanguageSettings().isLanguageActive(LanguageClass.SCALA)) {
    return;
  }
  for (Library library : ProjectLibraryTable.getInstance(project).getLibraries()) {
    // Convert the type of the SDK library to prevent the scala plugin from
    // showing the missing SDK notification.
    // TODO: use a canonical class in the SDK (e.g., scala.App) instead of the name?
    if (library.getName() != null && library.getName().startsWith("scala-library")) {
      ExistingLibraryEditor editor = new ExistingLibraryEditor(library, null);
      editor.setType(ScalaLibraryType.apply());
      editor.commit();
      return;
    }
  }
}
 
Example #3
Source File: LibraryDataService.java    From consulo with Apache License 2.0 6 votes vote down vote up
public void importLibrary(@Nonnull final String libraryName, @Nonnull final Map<OrderRootType, Collection<File>> libraryFiles, @Nonnull final Project project, boolean synchronous) {
  ExternalSystemApiUtil.executeProjectChangeAction(synchronous, new DisposeAwareProjectChange(project) {
    @RequiredUIAccess
    @Override
    public void execute() {
      // Is assumed to be called from the EDT.
      final LibraryTable libraryTable = ProjectLibraryTable.getInstance(project);
      final LibraryTable.ModifiableModel projectLibraryModel = libraryTable.getModifiableModel();
      final Library intellijLibrary;
      try {
        intellijLibrary = projectLibraryModel.createLibrary(libraryName);
      }
      finally {
        projectLibraryModel.commit();
      }
      final Library.ModifiableModel libraryModel = intellijLibrary.getModifiableModel();
      try {
        registerPaths(libraryFiles, libraryModel, libraryName);
      }
      finally {
        libraryModel.commit();
      }
    }
  });
}
 
Example #4
Source File: PsiTestUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
private static void addProjectLibrary(final Module module,
                                      final ModifiableRootModel model,
                                      final String libName,
                                      final VirtualFile... classesRoots) {
  new WriteCommandAction.Simple(module.getProject()) {
    @Override
    protected void run() throws Throwable {
      final LibraryTable libraryTable = ProjectLibraryTable.getInstance(module.getProject());
      final Library library = libraryTable.createLibrary(libName);
      final Library.ModifiableModel libraryModel = library.getModifiableModel();
      for (VirtualFile root : classesRoots) {
        libraryModel.addRoot(root, BinariesOrderRootType.getInstance());
      }
      libraryModel.commit();
      model.addLibraryEntry(library);
      final OrderEntry[] orderEntries = model.getOrderEntries();
      OrderEntry last = orderEntries[orderEntries.length - 1];
      System.arraycopy(orderEntries, 0, orderEntries, 1, orderEntries.length - 1);
      orderEntries[0] = last;
      model.rearrangeOrderEntries(orderEntries);
    }
  }.execute().throwException();
}
 
Example #5
Source File: HaxelibUtil.java    From intellij-haxe with Apache License 2.0 6 votes vote down vote up
/**
 * Get the list of libraries specified on the project.  Managed haxelib
 * (of the form "haxelib|<lib_name>") libraries are included unless
 * filterManagedLibs is true.
 *
 *
 * @param project to get the classpath for.
 * @return a (possibly empty) list of the classpaths for all of the libraries
 *         that are specified on the project (in the library pane).
 */
@NotNull
public static HaxeLibraryList getProjectLibraries(@NotNull Project project, boolean filterManagedLibs, boolean filterUnmanagedLibs) {
  LibraryTable libraryTable = ProjectLibraryTable.getInstance(project);
  if (null == libraryTable || (filterManagedLibs && filterUnmanagedLibs)) {
    return new HaxeLibraryList(HaxelibSdkUtils.lookupSdk(project));
  }

  HaxeLibraryList libs = new HaxeLibraryList(HaxelibSdkUtils.lookupSdk(project));
  Library[] libraries = libraryTable.getLibraries();
  for (Library library : libraries) {
    String name = library.getName();
    if (name == null) continue;

    boolean isManaged = HaxelibNameUtil.isManagedLibrary(name);
    if (filterManagedLibs && isManaged) continue;
    if (filterUnmanagedLibs && !isManaged) continue;

    libs.add(HaxeLibraryReference.create(project, name));
  }
  return libs;
}
 
Example #6
Source File: ExternalSystemUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void processOrphanProjectLibraries() {
  List<Library> orphanIdeLibraries = ContainerUtilRt.newArrayList();

  LibraryTable projectLibraryTable = ProjectLibraryTable.getInstance(myProject);
  for (Library library : projectLibraryTable.getLibraries()) {
    if (!ExternalSystemApiUtil.isExternalSystemLibrary(library, myExternalSystemId)) continue;
    if (ProjectStructureHelper.isOrphanProjectLibrary(library, ModuleManager.getInstance(myProject).getModules())) {
      orphanIdeLibraries.add(library);
    }
  }
  for (Library orphanIdeLibrary : orphanIdeLibraries) {
    projectLibraryTable.removeLibrary(orphanIdeLibrary);
  }
}
 
Example #7
Source File: ExternalSystemImportingTestCase.java    From intellij-quarkus with Eclipse Public License 2.0 5 votes vote down vote up
public void assertProjectLibraries(String... expectedNames) {
  List<String> actualNames = new ArrayList<>();
  for (Library each : ProjectLibraryTable.getInstance(myProject).getLibraries()) {
    String name = each.getName();
    actualNames.add(name == null ? "<unnamed>" : name);
  }
  assertUnorderedElementsAreEqual(actualNames, expectedNames);
}
 
Example #8
Source File: ProjectStructureHelper.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
public static Library findIdeLibrary(@Nonnull final LibraryData libraryData, @Nonnull Project ideProject) {
  final LibraryTable libraryTable = ProjectLibraryTable.getInstance(ideProject);
  for (Library ideLibrary : libraryTable.getLibraries()) {
    if (ExternalSystemApiUtil.isRelated(ideLibrary, libraryData)) return ideLibrary;
  }
  return null;
}
 
Example #9
Source File: LibraryDependencyDataService.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void importMissingProjectLibraries(@Nonnull Module module, @Nonnull Collection<DataNode<LibraryDependencyData>> nodesToImport, boolean synchronous) {
  LibraryTable libraryTable = ProjectLibraryTable.getInstance(module.getProject());
  List<DataNode<LibraryData>> librariesToImport = ContainerUtilRt.newArrayList();
  for (DataNode<LibraryDependencyData> dataNode : nodesToImport) {
    final LibraryDependencyData dependencyData = dataNode.getData();
    if (dependencyData.getLevel() != LibraryLevel.PROJECT) {
      continue;
    }
    final Library library = libraryTable.getLibraryByName(dependencyData.getInternalName());
    if (library == null) {
      DataNode<ProjectData> projectNode = dataNode.getDataNode(ProjectKeys.PROJECT);
      if (projectNode != null) {
        DataNode<LibraryData> libraryNode = ExternalSystemApiUtil.find(projectNode, ProjectKeys.LIBRARY, new BooleanFunction<DataNode<LibraryData>>() {
          @Override
          public boolean fun(DataNode<LibraryData> node) {
            return node.getData().equals(dependencyData.getTarget());
          }
        });
        if (libraryNode != null) {
          librariesToImport.add(libraryNode);
        }
      }
    }
  }
  if (!librariesToImport.isEmpty()) {
    LibraryDataService.getInstance().importData(librariesToImport, module.getProject(), synchronous);
  }
}
 
Example #10
Source File: LibraryDataService.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void removeData(@Nonnull final Collection<? extends Library> libraries, @Nonnull final Project project, boolean synchronous) {
  if (libraries.isEmpty()) {
    return;
  }
  ExternalSystemApiUtil.executeProjectChangeAction(synchronous, new DisposeAwareProjectChange(project) {
    @RequiredUIAccess
    @Override
    public void execute() {
      final LibraryTable libraryTable = ProjectLibraryTable.getInstance(project);
      final LibraryTable.ModifiableModel model = libraryTable.getModifiableModel();
      try {
        for (Library library : libraries) {
          String libraryName = library.getName();
          if (libraryName != null) {
            Library libraryToRemove = model.getLibraryByName(libraryName);
            if (libraryToRemove != null) {
              model.removeLibrary(libraryToRemove);
            }
          }
        }
      }
      finally {
        model.commit();
      }
    }
  });
}
 
Example #11
Source File: AbstractExternalModuleImportProvider.java    From consulo with Apache License 2.0 5 votes vote down vote up
/**
 * The whole import sequence looks like below:
 * <p>
 * <pre>
 * <ol>
 *   <li>Get project view from the gradle tooling api without resolving dependencies (downloading libraries);</li>
 *   <li>Allow to adjust project settings before importing;</li>
 *   <li>Create IJ project and modules;</li>
 *   <li>Ask gradle tooling api to resolve library dependencies (download the if necessary);</li>
 *   <li>Configure libraries used by the gradle project at intellij;</li>
 *   <li>Configure library dependencies;</li>
 * </ol>
 * </pre>
 * <p>
 *
 * @param projectWithResolvedLibraries gradle project with resolved libraries (libraries have already been downloaded and
 *                                     are available at file system under gradle service directory)
 * @param project                      current intellij project which should be configured by libraries and module library
 *                                     dependencies information available at the given gradle project
 */
private void setupLibraries(@Nonnull final DataNode<ProjectData> projectWithResolvedLibraries, final Project project) {
  ExternalSystemApiUtil.executeProjectChangeAction(new DisposeAwareProjectChange(project) {
    @RequiredUIAccess
    @Override
    public void execute() {
      ProjectRootManagerEx.getInstanceEx(project).mergeRootsChangesDuring(new Runnable() {
        @Override
        public void run() {
          if (ExternalSystemApiUtil.isNewProjectConstruction()) {
            // Clean existing libraries (if any).
            LibraryTable projectLibraryTable = ProjectLibraryTable.getInstance(project);
            if (projectLibraryTable == null) {
              LOG.warn("Can't resolve external dependencies of the target gradle project (" + project + "). Reason: project " + "library table is undefined");
              return;
            }
            LibraryTable.ModifiableModel model = projectLibraryTable.getModifiableModel();
            try {
              for (Library library : model.getLibraries()) {
                model.removeLibrary(library);
              }
            }
            finally {
              model.commit();
            }
          }

          // Register libraries.
          myProjectDataManager.importData(Collections.<DataNode<?>>singletonList(projectWithResolvedLibraries), project, false);
        }
      });
    }
  });
}
 
Example #12
Source File: HaxelibClasspathUtils.java    From intellij-haxe with Apache License 2.0 5 votes vote down vote up
/**
 * Get the list of library names specified on the project.  Managed haxelib
 * (of the form "haxelib|<lib_name>") libraries are included unless
 * filterManagedLibs is true.
 *
 * @param project to get the libraries for.
 * @param filterManagedLibs whether to remove managed haxelibs from the list.
 * @return a (possibly empty) list of libraries that are specified for the
 *         project (in the library pane).
 */
@NotNull
public static List<String> getProjectLibraryNames(@NotNull Project project, boolean filterManagedLibs) {
  List<String> nameList = new ArrayList<String>();
  LibraryTable libraryTable = ProjectLibraryTable.getInstance(project);
  Library[] libraries = libraryTable.getLibraries();
  for (Library library : libraries) {
    if (filterManagedLibs && HaxelibNameUtil.isManagedLibrary(library.getName())) {
      continue;
    }
    nameList.add(library.getName());
  }
  return nameList;
}
 
Example #13
Source File: HaxelibClasspathUtils.java    From intellij-haxe with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the libraries specified for the IDEA project; source paths and
 * class paths for project libraries excepting those named "haxelib|<lib_name>".
 *
 * @param project a project to get the class path settings for.
 * @return a list of class path URLs.
 */
@NotNull
public static HaxeClasspath getUnmanagedProjectLibraryClasspath(@NotNull Project project) {
  LibraryTable libraryTable = ProjectLibraryTable.getInstance(project);
  if (null == libraryTable) return HaxeClasspath.EMPTY_CLASSPATH;

  HaxeClasspath classpath = new HaxeClasspath();

  Library[] libraries = libraryTable.getLibraries();
  for (Library library : libraries) {
    //
    // This is checking that the library name doesn't match "haxelib|lib_name".
    // That is, if it /is/ a haxelib entry, ignore it; grab the classpaths for
    // libs that aren't haxelibs.
    //
    if (!HaxelibNameUtil.isManagedLibrary(library.getName())) {
      OrderRootType interestingRootTypes[] = {OrderRootType.SOURCES, OrderRootType.CLASSES};
      for (OrderRootType rootType : interestingRootTypes) {
        for (String url : library.getUrls(rootType)) {
          if (!classpath.containsUrl(url)) {  // The if just keeps us from churning.
            classpath.add(new HaxeClasspathEntry(library.getName(), url));
          }
        }
      }
    }
  }
  return classpath;
}
 
Example #14
Source File: BlazeAttachSourceProvider.java    From intellij with Apache License 2.0 5 votes vote down vote up
private static void attachSources(
    Project project,
    BlazeProjectData blazeProjectData,
    Collection<BlazeLibrary> librariesToAttachSourceTo) {
  ApplicationManager.getApplication()
      .runWriteAction(
          () -> {
            LibraryTable libraryTable = ProjectLibraryTable.getInstance(project);
            LibraryTable.ModifiableModel libraryTableModel = libraryTable.getModifiableModel();
            for (BlazeLibrary blazeLibrary : librariesToAttachSourceTo) {
              // Make sure we don't do it twice
              if (AttachedSourceJarManager.getInstance(project)
                  .hasSourceJarAttached(blazeLibrary.key)) {
                continue;
              }
              AttachedSourceJarManager.getInstance(project)
                  .setHasSourceJarAttached(blazeLibrary.key, true);
              LibraryEditor.updateLibrary(
                  project,
                  blazeProjectData.getArtifactLocationDecoder(),
                  libraryTable,
                  libraryTableModel,
                  blazeLibrary);
            }
            libraryTableModel.commit();
          });
}
 
Example #15
Source File: LibraryActionHelper.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Nullable
static Library findLibraryForAction(AnActionEvent e) {
  Project project = e.getProject();
  if (project != null) {
    NamedLibraryElementNode node = findLibraryNode(e.getDataContext());
    if (node != null) {
      String libraryName = node.getName();
      if (StringUtil.isNotEmpty(libraryName)) {
        LibraryTable libraryTable = ProjectLibraryTable.getInstance(project);
        return libraryTable.getLibraryByName(libraryName);
      }
    }
  }
  return null;
}
 
Example #16
Source File: AttachSourceJarAction.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
protected void actionPerformedInBlazeProject(Project project, AnActionEvent e) {
  BlazeProjectData projectData =
      BlazeProjectDataManager.getInstance(project).getBlazeProjectData();
  if (projectData == null) {
    return;
  }
  BlazeJarLibrary library = LibraryActionHelper.findBlazeLibraryForAction(project, e);
  if (library == null || library.libraryArtifact.getSourceJars().isEmpty()) {
    return;
  }
  AttachedSourceJarManager sourceJarManager = AttachedSourceJarManager.getInstance(project);
  boolean attachSourceJar = !sourceJarManager.hasSourceJarAttached(library.key);
  sourceJarManager.setHasSourceJarAttached(library.key, attachSourceJar);

  ApplicationManager.getApplication()
      .runWriteAction(
          () -> {
            LibraryTable libraryTable = ProjectLibraryTable.getInstance(project);
            LibraryTable.ModifiableModel libraryTableModel = libraryTable.getModifiableModel();
            LibraryEditor.updateLibrary(
                project,
                projectData.getArtifactLocationDecoder(),
                libraryTable,
                libraryTableModel,
                library);
            libraryTableModel.commit();
          });
}
 
Example #17
Source File: LibraryEditor.java    From intellij with Apache License 2.0 5 votes vote down vote up
private static void updateLibraryDependency(ModifiableRootModel model, LibraryKey libraryKey) {
  LibraryTable libraryTable = ProjectLibraryTable.getInstance(model.getProject());
  Library library = libraryTable.getLibraryByName(libraryKey.getIntelliJLibraryName());
  if (library == null) {
    logger.error(
        "Library missing: "
            + libraryKey.getIntelliJLibraryName()
            + ". Please resync project to resolve.");
    return;
  }
  model.addLibraryEntry(library);
}
 
Example #18
Source File: HaxelibProjectUpdater.java    From intellij-haxe with Apache License 2.0 4 votes vote down vote up
/**
 * Workhorse routine for resolveModuleLibraries.  This does the actual
 * update of the module.  It will block until all of the running events
 * on the AWT thread have completed, and then this will run on that thread.
 *
 * @param module   to update.
 * @param toRemove libraries that need to be removed from the module.
 * @param toAdd    libraries that need to be added to the module.
 */
private void updateModule(final ProjectTracker tracker,
                          final Module module,
                          final HaxeLibraryList toRemove,
                          final HaxeLibraryList toAdd) {
  if ((null == toRemove || toRemove.isEmpty()) && (null == toAdd || toAdd.isEmpty())) {
    return;
  }

  // Some internal error checking.
  assertEntriesAreManaged(toRemove, "Attempting to automatically remove a library that was not marked as managed.");
  assertEntriesAreManaged(toAdd, "Attempting to automatically add a library that is not marked as managed.");

  final HaxeDebugTimeLog timeLog = new HaxeDebugTimeLog("Write action:");
  timeLog.stamp("Queueing write action...");

  doWriteAction(new Runnable() {
    @Override
    public void run() {
      timeLog.stamp("<-- Time elapsed waiting for write access on the AWT thread.");
      timeLog.stamp("Begin: Updating module libraries for " + module.getName());

      // Figure out the list of project libraries that we should reference, if we can.
      HaxeLibraryList projectLibraries = ModuleRootManager.getInstance(module).isSdkInherited()
                                       ? getProjectLibraryList(tracker)
                                       : new HaxeLibraryList(module);
      final LibraryTable projectTable = ProjectLibraryTable.getInstance(tracker.getProject());

      timeLog.stamp("<-- Time elapsed retrieving project libraries.");

      ModifiableRootModel moduleRootModel = null;
      LibraryTable.ModifiableModel libraryTableModel = null;
      try {
        moduleRootModel = ModuleRootManager.getInstance(module).getModifiableModel();
        libraryTableModel = moduleRootModel.getModuleLibraryTable().getModifiableModel();

        // Remove unused packed "haxelib|<lib_name>" libraries from the module and project library.
        if (null != toRemove) {
          removeLibraries(toRemove, libraryTableModel, timeLog);
        }

        // Add new dependencies to modules.
        if (null != toAdd) {
          addLibraries(toAdd, projectLibraries, projectTable, moduleRootModel, libraryTableModel, timeLog);
        }

        timeLog.stamp("Committing changes to module libraries");
        libraryTableModel.commit();
        libraryTableModel = null;
        moduleRootModel.commit();
        moduleRootModel = null;
      }
      finally {
        if (null != moduleRootModel || null != libraryTableModel)
          timeLog.stamp("Failure to update module libraries");
        if (null != libraryTableModel)
          if (IdeaTarget.IS_VERSION_15_COMPATIBLE) {
            // libraryTableModel.dispose() in IDEA 15+; not a disposable in earlier versions.
            new MethodWrapper<Void>(libraryTableModel.getClass(), "dispose").invoke(libraryTableModel);
          }
        if (null != moduleRootModel)
          moduleRootModel.dispose();
      }
      timeLog.stamp("Finished: Updating module libraries");
    }
  });

  timeLog.print();
}
 
Example #19
Source File: DartSdkUtils.java    From intellij with Apache License 2.0 4 votes vote down vote up
@Nullable
static Library findDartLibrary(Project project) {
  return ProjectLibraryTable.getInstance(project).getLibraryByName(DART_SDK_LIBRARY_NAME);
}
 
Example #20
Source File: LibraryDependencyDataService.java    From consulo with Apache License 2.0 4 votes vote down vote up
public void importData(@Nonnull final Collection<DataNode<LibraryDependencyData>> nodesToImport, @Nonnull final Module module, final boolean synchronous) {
  ExternalSystemApiUtil.executeProjectChangeAction(synchronous, new DisposeAwareProjectChange(module) {
    @RequiredUIAccess
    @Override
    public void execute() {
      importMissingProjectLibraries(module, nodesToImport, synchronous);

      // The general idea is to import all external project library dependencies and module libraries which don't present at the
      // ide side yet and remove all project library dependencies and module libraries which present at the ide but not at
      // the given collection.
      // The trick is that we should perform module settings modification inside try/finally block against target root model.
      // That means that we need to prepare all necessary data, obtain a model and modify it as necessary.
      Map<Set<String>/* library paths */, LibraryDependencyData> moduleLibrariesToImport = ContainerUtilRt.newHashMap();
      Map<String/* library name + scope */, LibraryDependencyData> projectLibrariesToImport = ContainerUtilRt.newHashMap();
      Set<LibraryDependencyData> toImport = ContainerUtilRt.newLinkedHashSet();

      boolean hasUnresolved = false;
      for (DataNode<LibraryDependencyData> dependencyNode : nodesToImport) {
        LibraryDependencyData dependencyData = dependencyNode.getData();
        LibraryData libraryData = dependencyData.getTarget();
        hasUnresolved |= libraryData.isUnresolved();
        switch (dependencyData.getLevel()) {
          case MODULE:
            if (!libraryData.isUnresolved()) {
              Set<String> paths = ContainerUtilRt.newHashSet();
              for (String path : libraryData.getPaths(LibraryPathType.BINARY)) {
                paths.add(ExternalSystemApiUtil.toCanonicalPath(path) + dependencyData.getScope().name());
              }
              moduleLibrariesToImport.put(paths, dependencyData);
              toImport.add(dependencyData);
            }
            break;
          case PROJECT:
            projectLibrariesToImport.put(libraryData.getInternalName() + dependencyData.getScope().name(), dependencyData);
            toImport.add(dependencyData);
        }
      }

      ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module);
      final ModifiableRootModel moduleRootModel = moduleRootManager.getModifiableModel();
      LibraryTable moduleLibraryTable = moduleRootModel.getModuleLibraryTable();
      LibraryTable libraryTable = ProjectLibraryTable.getInstance(module.getProject());
      try {
        filterUpToDateAndRemoveObsolete(moduleLibrariesToImport, projectLibrariesToImport, toImport, moduleRootModel, hasUnresolved);

        // Import missing library dependencies.
        if (!toImport.isEmpty()) {
          importMissing(toImport, moduleRootModel, moduleLibraryTable, libraryTable, module);
        }
      }
      finally {
        moduleRootModel.commit();
      }
    }
  });
}
 
Example #21
Source File: HaxelibClasspathUtils.java    From intellij-haxe with Apache License 2.0 3 votes vote down vote up
/**
 * Get the classpath for all libraries in the project.  This *does not*
 * filter managed libraries of the form "haxelib|<lib_name>".
 *
 * @param project to get the classpath for.
 * @return a (possibly empty) list of the classpaths for all of the libraries
 *         that are specified on the project (in the library pane).
 */
@NotNull
public static HaxeClasspath getProjectLibraryClasspath(@NotNull Project project) {
  LibraryTable libraryTable = ProjectLibraryTable.getInstance(project);
  if (null == libraryTable) return HaxeClasspath.EMPTY_CLASSPATH;
  return loadClasspathFrom(libraryTable);
}