Skip to content
Snippets Groups Projects
Commit 608ca8a2 authored by brinn's avatar brinn
Browse files

improvement: ensure that dependent projects are visited only once (performance)

SVN: 648
parent 053987c7
No related merge requests found
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
package ch.systemsx.cisd.ant.task.subversion; package ch.systemsx.cisd.ant.task.subversion;
import java.util.HashSet;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.Set; import java.util.Set;
...@@ -71,17 +72,30 @@ class SVNDependentProjectsCollector ...@@ -71,17 +72,30 @@ class SVNDependentProjectsCollector
private final Set<String> projects; private final Set<String> projects;
private final String projectPath; private final String projectPath;
private final Set<String> locationsAlreadyVisited;
ProjectHandler(Set<String> projects, String projectPath) ProjectHandler(Set<String> projects, String projectPath)
{
this(projects, projectPath, new HashSet<String>());
}
ProjectHandler(Set<String> projects, String projectPath, Set<String> locationsAlreadyVisited)
{ {
this.projects = projects; this.projects = projects;
this.projectPath = projectPath; this.projectPath = projectPath;
this.locationsAlreadyVisited = locationsAlreadyVisited;
} }
@Override @Override
public IEclipseClasspathLocation createLocation() public IEclipseClasspathLocation createLocation()
{ {
final String displayableLocation = projectPath + "/" + EclipseClasspathReader.CLASSPATH_FILE; final String displayableLocation = projectPath + "/" + EclipseClasspathReader.CLASSPATH_FILE;
if (locationsAlreadyVisited.contains(displayableLocation))
{
return null;
}
locationsAlreadyVisited.add(displayableLocation);
try try
{ {
final String eclipseClasspath = actions.cat(displayableLocation); final String eclipseClasspath = actions.cat(displayableLocation);
...@@ -111,7 +125,7 @@ class SVNDependentProjectsCollector ...@@ -111,7 +125,7 @@ class SVNDependentProjectsCollector
public IProjectHandler createHandler(EclipseClasspathEntry entry) public IProjectHandler createHandler(EclipseClasspathEntry entry)
{ {
final String projectName = SVNUtilities.getTopLevelDirectory(entry.getPath()); final String projectName = SVNUtilities.getTopLevelDirectory(entry.getPath());
return new ProjectHandler(projects, pathProvider.getPath(projectName)); return new ProjectHandler(projects, pathProvider.getPath(projectName), locationsAlreadyVisited);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment