Skip to content

Commit

Permalink
dix - Dedup the project dependency (#1568)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdneo authored Aug 8, 2024
1 parent e5d74ff commit 32d689a
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -300,13 +300,15 @@ public void updateProjectDependencies(BuildServerConnection connection, IProject
javaProject.setRawClasspath(classpath.toArray(IClasspathEntry[]::new), javaProject.getOutputLocation(), monitor);
}

private List<IClasspathEntry> getProjectDependencyEntries(IProject project, Set<BuildTargetIdentifier> projectDependencies) {
List<IClasspathEntry> entries = new LinkedList<>();
private Collection<IClasspathEntry> getProjectDependencyEntries(IProject project, Set<BuildTargetIdentifier> projectDependencies) {
Map<String, IClasspathEntry> projectEntryMap = new LinkedHashMap<>();
for (BuildTargetIdentifier dependency : projectDependencies) {
URI uri = Utils.getUriWithoutQuery(dependency.getUri());
IProject dependencyProject = ProjectUtils.getProjectFromUri(uri.toString());
if (dependencyProject != null && !Objects.equals(project, dependencyProject)) {
entries.add(JavaCore.newProjectEntry(
String projectName = dependencyProject.getName();
if (dependencyProject != null && !Objects.equals(project, dependencyProject) &&
!projectEntryMap.containsKey(projectName)) {
projectEntryMap.put(projectName, JavaCore.newProjectEntry(
dependencyProject.getFullPath(),
ClasspathEntry.NO_ACCESS_RULES,
true,
Expand All @@ -315,7 +317,7 @@ private List<IClasspathEntry> getProjectDependencyEntries(IProject project, Set<
));
}
}
return entries;
return projectEntryMap.values();
}

@Override
Expand Down

0 comments on commit 32d689a

Please sign in to comment.