Hiding the project sorter as it is an implementation detail of the graph and I want to make another implementation.

This commit is contained in:
Jason van Zyl 2014-02-03 17:37:05 -05:00
parent 0f265210df
commit 90ab970006
2 changed files with 11 additions and 15 deletions

View File

@ -58,7 +58,6 @@ import org.apache.maven.project.ProjectBuilder;
import org.apache.maven.project.ProjectBuildingException;
import org.apache.maven.project.ProjectBuildingRequest;
import org.apache.maven.project.ProjectBuildingResult;
import org.apache.maven.project.ProjectSorter;
import org.apache.maven.repository.LocalRepositoryNotAccessibleException;
import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
import org.apache.maven.settings.Mirror;
@ -757,19 +756,17 @@ public class DefaultMaven
try
{
ProjectSorter projectSorter = new ProjectSorter( projects );
projectDependencyGraph = new DefaultProjectDependencyGraph( projectSorter );
projectDependencyGraph = new DefaultProjectDependencyGraph( projects );
if ( trimming )
{
List<MavenProject> activeProjects = projectSorter.getSortedProjects();
List<MavenProject> activeProjects = projectDependencyGraph.getSortedProjects();
activeProjects = trimSelectedProjects( activeProjects, projectDependencyGraph, request );
activeProjects = trimExcludedProjects( activeProjects, request );
activeProjects = trimResumedProjects( activeProjects, request );
if ( activeProjects.size() != projectSorter.getSortedProjects().size() )
if ( activeProjects.size() != projectDependencyGraph.getSortedProjects().size() )
{
projectDependencyGraph =
new FilteredProjectDependencyGraph( projectDependencyGraph, activeProjects );

View File

@ -25,8 +25,10 @@ import java.util.HashSet;
import java.util.List;
import org.apache.maven.execution.ProjectDependencyGraph;
import org.apache.maven.project.DuplicateProjectException;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.ProjectSorter;
import org.codehaus.plexus.util.dag.CycleDetectedException;
/**
* Describes the inter-dependencies between projects in the reactor.
@ -40,18 +42,15 @@ class DefaultProjectDependencyGraph
private ProjectSorter sorter;
/**
* Creates a new project dependency graph based on the specified project sorting.
* Creates a new project dependency graph based on the specified projects.
*
* @param sorter The project sorter backing the graph, must not be {@code null}.
* @param projects The projects to create the dependency graph with
* @throws DuplicateProjectException
* @throws CycleDetectedException
*/
public DefaultProjectDependencyGraph( ProjectSorter sorter )
public DefaultProjectDependencyGraph( Collection<MavenProject> projects ) throws CycleDetectedException, DuplicateProjectException
{
if ( sorter == null )
{
throw new IllegalArgumentException( "project sorter missing" );
}
this.sorter = sorter;
this.sorter = new ProjectSorter( projects );
}
public List<MavenProject> getSortedProjects()