continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r766669 - in /continuum/branches/continuum-1.3.x: continuum-api/src/main/java/org/apache/maven/continuum/ continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/ continuum-builder/src/main/java/org/apache/continuu...
Date Mon, 20 Apr 2009 12:25:20 GMT
Author: brett
Date: Mon Apr 20 12:25:20 2009
New Revision: 766669

URL: http://svn.apache.org/viewvc?rev=766669&view=rev
Log:
[CONTINUUM-2183] avoid failed startup because of cycle in projects. In other situations, instead
of using the alphabetical sort, log the warning and continue so the list is mostly sorted

Modified:
    continuum/branches/continuum-1.3.x/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
    continuum/branches/continuum-1.3.x/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/DistributedBuildProjectTaskExecutor.java
    continuum/branches/continuum-1.3.x/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/overall/DistributedBuildProjectTaskExecutorOverall.java
    continuum/branches/continuum-1.3.x/continuum-commons/src/main/java/org/apache/continuum/utils/ProjectSorter.java
    continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java
    continuum/branches/continuum-1.3.x/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java
    continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
    continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java

Modified: continuum/branches/continuum-1.3.x/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java?rev=766669&r1=766668&r2=766669&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
Mon Apr 20 12:25:20 2009
@@ -47,7 +47,6 @@
 import org.apache.maven.continuum.profile.ProfileService;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
 import org.apache.maven.continuum.release.ContinuumReleaseManager;
-import org.codehaus.plexus.util.dag.CycleDetectedException;
 
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
@@ -153,17 +152,15 @@
     // ----------------------------------------------------------------------
 
     List<Project> getProjectsInBuildOrder()
-        throws CycleDetectedException, ContinuumException;
+        throws ContinuumException;
 
     /**
      * take a collection of projects and sort for order
      *
      * @param projects
      * @return
-     * @throws CycleDetectedException
      */
-    List<Project> getProjectsInBuildOrder( Collection<Project> projects )
-        throws CycleDetectedException;
+    List<Project> getProjectsInBuildOrder( Collection<Project> projects );
 
     void buildProjects()
         throws ContinuumException;

Modified: continuum/branches/continuum-1.3.x/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/DistributedBuildProjectTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/DistributedBuildProjectTaskExecutor.java?rev=766669&r1=766668&r2=766669&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/DistributedBuildProjectTaskExecutor.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/DistributedBuildProjectTaskExecutor.java
Mon Apr 20 12:25:20 2009
@@ -50,7 +50,6 @@
 import org.codehaus.plexus.taskqueue.Task;
 import org.codehaus.plexus.taskqueue.execution.TaskExecutionException;
 import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.util.dag.CycleDetectedException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -141,14 +140,7 @@
                 projects.add( project );
             }
 
-            try
-            {
-                projects = ProjectSorter.getSortedProjects( projects, null );
-            }
-            catch ( CycleDetectedException e )
-            {
-                log.info( "Cycle Detected" );
-            }
+            projects = ProjectSorter.getSortedProjects( projects, null );
 
             for ( Project project : projects )
             {

Modified: continuum/branches/continuum-1.3.x/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/overall/DistributedBuildProjectTaskExecutorOverall.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/overall/DistributedBuildProjectTaskExecutorOverall.java?rev=766669&r1=766668&r2=766669&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/overall/DistributedBuildProjectTaskExecutorOverall.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/overall/DistributedBuildProjectTaskExecutorOverall.java
Mon Apr 20 12:25:20 2009
@@ -159,14 +159,7 @@
                 projects.add( projectDao.getProjectWithDependencies( projectId ) );
             }
 
-            try
-            {
-                projects = ProjectSorter.getSortedProjects( projects, null );
-            }
-            catch ( CycleDetectedException e )
-            {
-                log.info( "Cycle Detected" );
-            }
+            projects = ProjectSorter.getSortedProjects( projects, null );
 
             int buildDefinitionId = projectsAndBuildDefinitions.get( projects.get( 0 ).getId()
);
             BuildDefinition buildDefinition = buildDefinitionDao.getBuildDefinition( buildDefinitionId
);

Modified: continuum/branches/continuum-1.3.x/continuum-commons/src/main/java/org/apache/continuum/utils/ProjectSorter.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-commons/src/main/java/org/apache/continuum/utils/ProjectSorter.java?rev=766669&r1=766668&r2=766669&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-commons/src/main/java/org/apache/continuum/utils/ProjectSorter.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-commons/src/main/java/org/apache/continuum/utils/ProjectSorter.java
Mon Apr 20 12:25:20 2009
@@ -19,6 +19,12 @@
  * under the License.
  */
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectDependency;
 import org.codehaus.plexus.util.dag.CycleDetectedException;
@@ -26,12 +32,6 @@
 import org.codehaus.plexus.util.dag.TopologicalSorter;
 import org.slf4j.Logger;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 /**
  * Sort projects by dependencies.
  *
@@ -57,7 +57,6 @@
      * </ul>
      */
     public static List<Project> getSortedProjects( Collection<Project> projects,
Logger logger )
-        throws CycleDetectedException
     {
         DAG dag = new DAG();
 
@@ -90,7 +89,14 @@
 
                 if ( dag.getVertex( dependencyId ) != null )
                 {
-                    dag.addEdge( id, dependencyId );
+                    try
+                    {
+                        dag.addEdge( id, dependencyId );
+                    }
+                    catch ( CycleDetectedException e )
+                    {
+                        logger.warn( "Ignore cycle detected in project dependencies: " +
e.getMessage() );
+                    }
                 }
             }
 
@@ -108,7 +114,14 @@
                     {
                         dag.removeEdge( parentId, id );
                     }
-                    dag.addEdge( id, parentId );
+                    try
+                    {
+                        dag.addEdge( id, parentId );
+                    }
+                    catch ( CycleDetectedException e )
+                    {
+                        logger.warn( "Ignore cycle detected in project parent: " + e.getMessage()
);
+                    }
                 }
             }
         }

Modified: continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=766669&r1=766668&r2=766669&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Mon Apr 20 12:25:20 2009
@@ -103,7 +103,6 @@
 import org.codehaus.plexus.taskqueue.TaskQueueException;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.util.dag.CycleDetectedException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
@@ -785,18 +784,7 @@
     public void buildProjects( int trigger )
         throws ContinuumException
     {
-        Collection<Project> projectsList;
-
-        try
-        {
-            projectsList = getProjectsInBuildOrder();
-        }
-        catch ( CycleDetectedException e )
-        {
-            log.warn( "Cycle detected while sorting projects for building, falling back to
unsorted build." );
-
-            projectsList = getProjects();
-        }
+        Collection<Project> projectsList = getProjectsInBuildOrder();
 
         Collection<Project> filteredProjectsList = getProjectsNotInReleaseStage( projectsList
);
 
@@ -813,18 +801,7 @@
     public void buildProjects( int trigger, int buildDefinitionId )
         throws ContinuumException
     {
-        Collection<Project> projectsList;
-
-        try
-        {
-            projectsList = getProjectsInBuildOrder();
-        }
-        catch ( CycleDetectedException e )
-        {
-            log.warn( "Cycle detected while sorting projects for building, falling back to
unsorted build." );
-
-            projectsList = getProjects();
-        }
+        Collection<Project> projectsList = getProjectsInBuildOrder();
 
         Collection<Project> filteredProjectsList = getProjectsNotInReleaseStage( projectsList
);
 
@@ -886,17 +863,8 @@
         {
             Collection<Project> projectsList;
 
-            try
-            {
-                projectsList =
-                    getProjectsInBuildOrder( projectDao.getProjectsWithDependenciesByGroupId(
projectGroupId ) );
-            }
-            catch ( CycleDetectedException e )
-            {
-                log.warn( "Cycle detected while sorting projects for building, falling back
to unsorted build." );
-
-                projectsList = getProjects();
-            }
+            projectsList =
+                getProjectsInBuildOrder( projectDao.getProjectsWithDependenciesByGroupId(
projectGroupId ) );
 
             prepareBuildProjects( projectsList, bds, checkDefaultBuildDefinitionForProject,
                                   ContinuumProjectState.TRIGGER_FORCED );
@@ -935,12 +903,6 @@
         {
             throw new ContinuumException( "Can't get project list for schedule " + schedule.getName(),
e );
         }
-        catch ( CycleDetectedException e )
-        {
-            log.warn( "Cycle detected while sorting projects for building, falling back to
unsorted build." );
-
-            projectsList = getProjects();
-        }
 
         Map<ProjectScmRoot, Map<Integer, Integer>> map = new HashMap<ProjectScmRoot,
Map<Integer, Integer>>();
 
@@ -1205,7 +1167,7 @@
     // ----------------------------------------------------------------------
 
     public List<Project> getProjectsInBuildOrder()
-        throws CycleDetectedException, ContinuumException
+        throws ContinuumException
     {
         return getProjectsInBuildOrder( getProjectsWithDependencies() );
     }
@@ -1215,10 +1177,8 @@
      *
      * @param projects
      * @return
-     * @throws CycleDetectedException
      */
     public List<Project> getProjectsInBuildOrder( Collection<Project> projects
)
-        throws CycleDetectedException
     {
         if ( projects == null || projects.isEmpty() )
         {
@@ -3480,15 +3440,8 @@
     {
         List<Project> projectsList;
 
-        try
-        {
-            projectsList =
-                getProjectsInBuildOrder( projectDao.getProjectsWithDependenciesByGroupId(
projectGroup.getId() ) );
-        }
-        catch ( CycleDetectedException e )
-        {
-            throw new ContinuumException( "Error while retrieving projects", e );
-        }
+        projectsList =
+            getProjectsInBuildOrder( projectDao.getProjectsWithDependenciesByGroupId( projectGroup.getId()
) );
 
         String url = "";
 

Modified: continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java?rev=766669&r1=766668&r2=766669&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java
Mon Apr 20 12:25:20 2009
@@ -506,14 +506,7 @@
         List<Project> projects = projectDao.getProjectsWithDependenciesByGroupId( projectGroupId
);
         List<Project> projectList;
 
-        try
-        {
-            projectList = ProjectSorter.getSortedProjects( projects, log );
-        }
-        catch ( CycleDetectedException e )
-        {
-            projectList = projectDao.getAllProjectsByName();
-        }
+        projectList = ProjectSorter.getSortedProjects( projects, log );
 
         List<Project> projectsToBeBuilt = new ArrayList<Project>();
         Map<Integer, BuildDefinition> projectsBuildDefinitionsMap = new HashMap<Integer,
BuildDefinition>();

Modified: continuum/branches/continuum-1.3.x/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java?rev=766669&r1=766668&r2=766669&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java
Mon Apr 20 12:25:20 2009
@@ -373,36 +373,26 @@
         {
             ProjectGroup projectGroup = projectGroups.get( key );
             String url = " ";
-            try
+            List<Project> projects =
+                ProjectSorter.getSortedProjects( getProjectsByGroupIdWithDependencies( pmf,
projectGroup.getId() ),
+                                                 log );
+            for ( Iterator j = projects.iterator(); j.hasNext(); )
             {
-                List<Project> projects =
-                    ProjectSorter.getSortedProjects( getProjectsByGroupIdWithDependencies(
pmf, projectGroup.getId() ),
-                                                     log );
-                for ( Iterator j = projects.iterator(); j.hasNext(); )
+                Project project = (Project) j.next();
+                if ( !project.getScmUrl().trim().startsWith( url ) )
                 {
-                    Project project = (Project) j.next();
-                    if ( !project.getScmUrl().trim().startsWith( url ) )
-                    {
-                        url = project.getScmUrl();
-                        ProjectScmRoot projectScmRoot = new ProjectScmRoot();
-                        projectScmRoot.setId( id );
-                        projectScmRoot.setProjectGroup( projectGroup );
-                        projectScmRoot.setScmRootAddress( url );
-                        projectScmRoot.setState( project.getState() );
-
-                        projectScmRoot = (ProjectScmRoot) PlexusJdoUtils.addObject( pmf.getPersistenceManager(),
projectScmRoot );
-                        projectScmRoots.put( Integer.valueOf( projectScmRoot.getId() ), projectScmRoot
);
-                        id++;
-                    }
+                    url = project.getScmUrl();
+                    ProjectScmRoot projectScmRoot = new ProjectScmRoot();
+                    projectScmRoot.setId( id );
+                    projectScmRoot.setProjectGroup( projectGroup );
+                    projectScmRoot.setScmRootAddress( url );
+                    projectScmRoot.setState( project.getState() );
+
+                    projectScmRoot = (ProjectScmRoot) PlexusJdoUtils.addObject( pmf.getPersistenceManager(),
projectScmRoot );
+                    projectScmRoots.put( Integer.valueOf( projectScmRoot.getId() ), projectScmRoot
);
+                    id++;
                 }
             }
-            catch ( CycleDetectedException e )
-            {
-                //skip
-                log.info( "Skipping group '" + projectGroup.getGroupId() +
-                    "' when creating ProjectScmRoot data. Cycle detected: " + e.getMessage()
);
-                continue;
-            }
         }
 
         /*

Modified: continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java?rev=766669&r1=766668&r2=766669&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
Mon Apr 20 12:25:20 2009
@@ -52,7 +52,6 @@
 import org.codehaus.plexus.redback.role.RoleManagerException;
 import org.codehaus.plexus.redback.users.User;
 import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.util.dag.CycleDetectedException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -189,20 +188,12 @@
                 int nbAntProjects = 0;
                 int nbShellProjects = 0;
 
-                // get the projects according to build order (first project in the group
is the root project)
-                try
-                {
-                    Project rootProject = ( getContinuum().getProjectsInBuildOrder(
-                        getContinuum().getProjectsInGroupWithDependencies( projectGroupId
) ) ).get( 0 );
-                    if ( "maven2".equals( rootProject.getExecutorId() ) ||
-                        "maven-1".equals( rootProject.getExecutorId() ) )
-                    {
-                        url = rootProject.getUrl();
-                    }
-                }
-                catch ( CycleDetectedException e )
+                Project rootProject = ( getContinuum().getProjectsInBuildOrder(
+                    getContinuum().getProjectsInGroupWithDependencies( projectGroupId ) )
).get( 0 );
+                if ( "maven2".equals( rootProject.getExecutorId() ) ||
+                    "maven-1".equals( rootProject.getExecutorId() ) )
                 {
-                    // ignore. url won't be displayed if null
+                    url = rootProject.getUrl();
                 }
 
                 for ( Object o : projectGroup.getProjects() )
@@ -362,7 +353,7 @@
     }
 
     public String edit()
-        throws ContinuumException, CycleDetectedException
+        throws ContinuumException
     {
         try
         {

Modified: continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java?rev=766669&r1=766668&r2=766669&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
Mon Apr 20 12:25:20 2009
@@ -149,15 +149,7 @@
                 projectsList.add( p );
             }
 
-            List<Project> sortedProjects;
-            try
-            {
-                sortedProjects = getContinuum().getProjectsInBuildOrder( projectsList );
-            }
-            catch ( CycleDetectedException e )
-            {
-                sortedProjects = projectsList;
-            }
+            List<Project> sortedProjects = getContinuum().getProjectsInBuildOrder(
projectsList );
 
             if ( this.getBuildDefinitionId() <= 0 )
             {



Mime
View raw message