You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by oc...@apache.org on 2009/05/05 08:18:51 UTC
svn commit: r771577 -
/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java
Author: oching
Date: Tue May 5 06:18:51 2009
New Revision: 771577
URL: http://svn.apache.org/viewvc?rev=771577&view=rev
Log:
o revert previous changes made to parallel builds manager
Modified:
continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java
Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java?rev=771577&r1=771576&r2=771577&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java Tue May 5 06:18:51 2009
@@ -31,9 +31,6 @@
import org.apache.continuum.buildqueue.BuildQueueService;
import org.apache.continuum.buildqueue.BuildQueueServiceException;
import org.apache.continuum.dao.BuildDefinitionDao;
-import org.apache.continuum.dao.ProjectDao;
-import org.apache.continuum.dao.ProjectGroupDao;
-import org.apache.continuum.dao.ProjectScmRootDao;
import org.apache.continuum.taskqueue.BuildProjectTask;
import org.apache.continuum.taskqueue.CheckOutTask;
import org.apache.continuum.taskqueue.OverallBuildQueue;
@@ -92,16 +89,7 @@
private BuildQueueService buildQueueService;
private PlexusContainer container;
-
- @Resource
- private ProjectDao projectDao;
-
- @Resource
- private ProjectGroupDao projectGroupDao;
-
- @Resource
- private ProjectScmRootDao projectScmRootDao;
-
+
/**
* @see BuildsManager#buildProject(int, BuildDefinition, String, int, ScmResult)
*/
@@ -124,7 +112,7 @@
}
OverallBuildQueue overallBuildQueue =
- getOverallBuildQueue( BUILD_QUEUE, buildDefinition.getSchedule().getBuildQueues(), null );
+ getOverallBuildQueue( BUILD_QUEUE, buildDefinition.getSchedule().getBuildQueues() );
String buildDefinitionLabel = buildDefinition.getDescription();
if ( StringUtils.isEmpty( buildDefinitionLabel ) )
@@ -176,7 +164,7 @@
{
BuildDefinition buildDef = projectsBuildDefinitionsMap.get( firstProjectId );
OverallBuildQueue overallBuildQueue =
- getOverallBuildQueue( BUILD_QUEUE, buildDef.getSchedule().getBuildQueues(), null );
+ getOverallBuildQueue( BUILD_QUEUE, buildDef.getSchedule().getBuildQueues() );
if ( overallBuildQueue != null )
{
@@ -400,7 +388,7 @@
}
OverallBuildQueue overallBuildQueue =
- getOverallBuildQueue( CHECKOUT_QUEUE, defaultBuildDefinition.getSchedule().getBuildQueues(), null );
+ getOverallBuildQueue( CHECKOUT_QUEUE, defaultBuildDefinition.getSchedule().getBuildQueues() );
CheckOutTask checkoutTask =
new CheckOutTask( projectId, workingDirectory, projectName, scmUsername, scmPassword, scmRootUrl, subProjects );
try
@@ -1120,7 +1108,7 @@
}
// get overall queue where project will be queued
- private OverallBuildQueue getOverallBuildQueue( int typeOfQueue, List<BuildQueue> buildQueues, Project project )
+ private OverallBuildQueue getOverallBuildQueue( int typeOfQueue, List<BuildQueue> buildQueues )
throws BuildManagerException
{
OverallBuildQueue whereToBeQueued = null;
@@ -1130,22 +1118,61 @@
{
throw new BuildManagerException( "No build queues configured." );
}
-
- // TODO: deng - flat multi-modules
- // - check whether the requested queue is a checkout queue or a build queue
- // * proceed with the succeeding steps only when requested queue is a build queue
- // - check if project is checked out in a single directory and if true:
- // * get the build queue where a project with a common scm root is queued
- // * queue the project there
-
- if( project != null && project.isCheckedOutInSingleDirectory() && typeOfQueue == BUILD_QUEUE )
- {
-
+
+ try
+ {
+ int size = 0;
+ int idx = 0;
+ int allowedBuilds = configurationService.getNumberOfBuildsInParallel();
+ int count = 1;
+
+ for ( BuildQueue buildQueue : buildQueues )
+ {
+ if ( count <= allowedBuilds )
+ {
+ OverallBuildQueue overallBuildQueue = overallBuildQueues.get( buildQueue.getId() );
+ if ( overallBuildQueue != null )
+ {
+ TaskQueue taskQueue = null;
+ if ( typeOfQueue == BUILD_QUEUE )
+ {
+ taskQueue = overallBuildQueue.getBuildQueue();
+ }
+ else if ( typeOfQueue == CHECKOUT_QUEUE )
+ {
+ taskQueue = overallBuildQueue.getCheckoutQueue();
+ }
+
+ if ( idx == 0 )
+ {
+ size = taskQueue.getQueueSnapshot().size();
+ whereToBeQueued = overallBuildQueue;
+ }
+
+ if ( taskQueue.getQueueSnapshot().size() < size )
+ {
+ whereToBeQueued = overallBuildQueue;
+ size = taskQueue.getQueueSnapshot().size();
+ }
+
+ idx++;
+ }
+ else
+ {
+ log.error( "Build queue not found." );
+ }
+ count++;
+ }
+ else
+ {
+ break;
+ }
+ }
}
- else
+ catch ( TaskQueueException e )
{
- whereToBeQueued = getOverallBuildQueue( typeOfQueue, buildQueues );
- }
+ throw new BuildManagerException( "Error occurred while retrieving task quueue: " + e.getMessage() );
+ }
}
// use default overall build queue if none is configured
@@ -1164,68 +1191,7 @@
return whereToBeQueued;
}
-
- private OverallBuildQueue getOverallBuildQueue( int typeOfQueue, List<BuildQueue> buildQueues )
- throws BuildManagerException
- {
- OverallBuildQueue whereToBeQueued = null;
-
- try
- {
- int size = 0;
- int idx = 0;
- int allowedBuilds = configurationService.getNumberOfBuildsInParallel();
- int count = 1;
- for ( BuildQueue buildQueue : buildQueues )
- {
- if ( count <= allowedBuilds )
- {
- OverallBuildQueue overallBuildQueue = overallBuildQueues.get( buildQueue.getId() );
- if ( overallBuildQueue != null )
- {
- TaskQueue taskQueue = null;
- if ( typeOfQueue == BUILD_QUEUE )
- {
- taskQueue = overallBuildQueue.getBuildQueue();
- }
- else if ( typeOfQueue == CHECKOUT_QUEUE )
- {
- taskQueue = overallBuildQueue.getCheckoutQueue();
- }
-
- if ( idx == 0 )
- {
- size = taskQueue.getQueueSnapshot().size();
- whereToBeQueued = overallBuildQueue;
- }
-
- if ( taskQueue.getQueueSnapshot().size() < size )
- {
- whereToBeQueued = overallBuildQueue;
- size = taskQueue.getQueueSnapshot().size();
- }
-
- idx++;
- }
- else
- {
- log.error( "Build queue not found." );
- }
- count++;
- }
- else
- {
- break;
- }
- }
- }
- catch ( TaskQueueException e )
- {
- throw new BuildManagerException( "Error occurred while retrieving task quueue: " + e.getMessage() );
- }
- return whereToBeQueued;
- }
-
+
public void contextualize( Context context )
throws ContextException
{