continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcconn...@apache.org
Subject svn commit: r476211 - /maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Date Fri, 17 Nov 2006 16:52:31 GMT
Author: jmcconnell
Date: Fri Nov 17 08:52:30 2006
New Revision: 476211

URL: http://svn.apache.org/viewvc?view=rev&rev=476211
Log:
reverting the build projects on a schedule to the way it was around version 406895 before
I mangled it up with my project group work

Modified:
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?view=diff&rev=476211&r1=476210&r2=476211
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Fri Nov 17 08:52:30 2006
@@ -530,6 +530,8 @@
     /**
      * takes a given schedule and determines which projects need to build
      *
+     * The build order is determined by the 
+     *
      * @param schedule
      * @throws ContinuumException
      */
@@ -540,77 +542,52 @@
 
         Map projectsMap = null;
 
-        Map projectGroupsMap = null;
-
-        // get the Maps of id's that are effected by this schedule
         try
         {
-            // todo the store should get cleaned up some so this isn't as clunky,
-            // todo I think the store should be able to return all of these info
-
             projectsMap = store.getProjectIdsAndBuildDefinitionsIdsBySchedule( schedule.getId()
);
 
-            projectGroupsMap = store.getProjectGroupIdsAndBuildDefinitionsIdsBySchedule(
schedule.getId() );
-
-            if ( projectsMap == null && projectGroupsMap == null )
+            if ( projectsMap == null )
             {
                 // We don't have projects attached to this schedule
-                getLogger().info( "No projects to build for schedule " + schedule );
                 return;
             }
+
+            projectsList = getProjectsInBuildOrder();
         }
         catch ( ContinuumStoreException e )
         {
             throw new ContinuumException( "Can't get project list for schedule " + schedule.getName(),
e );
         }
-
-        Collection projectGroups = getAllProjectGroupsWithProjects();
-
-        // walk through all of the project groups
-        for ( Iterator i = projectGroups.iterator(); i.hasNext(); )
+        catch ( CycleDetectedException e )
         {
-            // get the project group
-            ProjectGroup projectGroup = (ProjectGroup) i.next();
-
-            // get all the sorted projects in a project group
-            try
-            {
-                projectsList = getProjectsInBuildOrder( store.getProjectsWithDependenciesByGroupId(
projectGroup.getId() ) );
-            }
-            catch ( CycleDetectedException e )
-            {
-                getLogger().warn(
-                    "Cycle detected while sorting projects for building, falling back to
unsorted build." );
+            getLogger().warn( "Cycle detected while sorting projects for building, falling
back to unsorted build." );
 
-                projectsList = getProjectsInGroup( projectGroup.getId() );
-            }
+            projectsList = getProjects();
+        }
 
-            getLogger().info( "Building " + projectsList.size() + " projects" );
+        for ( Iterator projectIterator = projectsList.iterator(); projectIterator.hasNext();
)
+        {
+            Project project = (Project) projectIterator.next();
 
-            // get the group build definitions associated with this project group
-            List groupBuildDefinitionIds = (List) projectGroupsMap.get( new Integer( projectGroup.getId()
) );
+            List buildDefIds = (List) projectsMap.get( new Integer( project.getId() ) );
 
-            // iterate through the sorted (or potentially unsorted) projects in this project
group
-            for ( Iterator j = projectsList.iterator(); j.hasNext(); )
+            if ( buildDefIds != null && !buildDefIds.isEmpty() )
             {
-                Project project = (Project) j.next();
-
-                // iterate through the project group build definitions and build
-                buildFromDefinitionIds( groupBuildDefinitionIds, project );
-
-                // iterate through the project build definitions and build
-                List buildDefIds = projectsMap == null ? null : (List) projectsMap.get( new
Integer( project.getId() ) );
-
-                buildFromDefinitionIds( buildDefIds, project );
-
-                if ( buildDefIds == null || buildDefIds.isEmpty() )
+                for ( Iterator buildDefinitionIterator = buildDefIds.iterator(); buildDefinitionIterator.hasNext();
)
                 {
-                    getLogger().info( "No build definitions, not building for project " +
project );
+                    Integer buildDefId = (Integer) buildDefinitionIterator.next();
+
+                    if ( buildDefId != null && !isInBuildingQueue( project.getId(),
buildDefId.intValue() ) &&
+                        !isInCheckoutQueue( project.getId() ) )
+                    {
+                        buildProject( project, buildDefId.intValue(), ContinuumProjectState.TRIGGER_SCHEDULED,
false );
+                    }
                 }
             }
         }
     }
 
+
     private void buildFromDefinitionIds( Collection buildDefinitionIds, Project project )
         throws ContinuumException
     {
@@ -851,6 +828,13 @@
         return getProjectsInBuildOrder( getProjectsWithDependencies() );
     }
 
+    /**
+     * take a collection of projects and sort for order
+     *
+     * @param projects
+     * @return
+     * @throws CycleDetectedException
+     */
     private List getProjectsInBuildOrder( Collection projects )
         throws CycleDetectedException
     {



Mime
View raw message