Skip to content

Commit

Permalink
dix - Dedup the project dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
jdneo committed Aug 7, 2024
1 parent a281e6b commit 87a463e
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 87a463e

Please sign in to comment.