Class ProjectSorter


  • public class ProjectSorter
    extends java.lang.Object
    ProjectSorter
    • Field Detail

      • dag

        private org.codehaus.plexus.util.dag.DAG dag
      • sortedProjects

        private java.util.List<MavenProject> sortedProjects
      • projectMap

        private java.util.Map<java.lang.String,​MavenProject> projectMap
    • Constructor Detail

      • ProjectSorter

        public ProjectSorter​(java.util.Collection<MavenProject> projects)
                      throws org.codehaus.plexus.util.dag.CycleDetectedException,
                             DuplicateProjectException
        Sort a list of projects.
        • collect all the vertices for the projects that we want to build.
        • iterate through the deps of each project and if that dep is within the set of projects we want to build then add an edge, otherwise throw the edge away because that dependency is not within the set of projects we are trying to build. we assume a closed set.
        • do a topo sort on the graph that remains.
        Throws:
        DuplicateProjectException - if any projects are duplicated by id
        org.codehaus.plexus.util.dag.CycleDetectedException
    • Method Detail

      • addEdge

        private void addEdge​(java.util.Map<java.lang.String,​MavenProject> projectMap,
                             java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​org.codehaus.plexus.util.dag.Vertex>> vertexMap,
                             MavenProject project,
                             org.codehaus.plexus.util.dag.Vertex projectVertex,
                             java.lang.String groupId,
                             java.lang.String artifactId,
                             java.lang.String version,
                             boolean force,
                             boolean safe)
                      throws org.codehaus.plexus.util.dag.CycleDetectedException
        Throws:
        org.codehaus.plexus.util.dag.CycleDetectedException
      • addEdge

        private void addEdge​(org.codehaus.plexus.util.dag.Vertex fromVertex,
                             org.codehaus.plexus.util.dag.Vertex toVertex,
                             MavenProject fromProject,
                             java.util.Map<java.lang.String,​MavenProject> projectMap,
                             boolean force,
                             boolean safe)
                      throws org.codehaus.plexus.util.dag.CycleDetectedException
        Throws:
        org.codehaus.plexus.util.dag.CycleDetectedException
      • isSpecificVersion

        private boolean isSpecificVersion​(java.lang.String version)
      • getTopLevelProject

        public MavenProject getTopLevelProject()
      • getSortedProjects

        public java.util.List<MavenProject> getSortedProjects()
      • hasMultipleProjects

        public boolean hasMultipleProjects()
      • getDependents

        public java.util.List<java.lang.String> getDependents​(java.lang.String id)
      • getDependencies

        public java.util.List<java.lang.String> getDependencies​(java.lang.String id)
      • getId

        public static java.lang.String getId​(MavenProject project)
      • getDAG

        public org.codehaus.plexus.util.dag.DAG getDAG()
      • getProjectMap

        public java.util.Map<java.lang.String,​MavenProject> getProjectMap()