continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From och...@apache.org
Subject svn commit: r771527 - in /continuum/branches/continuum-flat-multi-module: continuum-commons/src/main/java/org/apache/maven/continuum/utils/ continuum-commons/src/test/java/org/apache/maven/continuum/utils/ continuum-core/src/main/java/org/apache/contin...
Date Tue, 05 May 2009 02:53:48 GMT
Author: oching
Date: Tue May  5 02:53:46 2009
New Revision: 771527

URL: http://svn.apache.org/viewvc?rev=771527&view=rev
Log:
[CONTINUUM-2193]
o fix prepare build of multi-module projects
o refactored a few variable names and methods

Modified:
    continuum/branches/continuum-flat-multi-module/continuum-commons/src/main/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryService.java
    continuum/branches/continuum-flat-multi-module/continuum-commons/src/test/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryServiceTest.java
    continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java
    continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java
    continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddProjectToCheckOutQueueAction.java
    continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckWorkingDirectoryAction.java
    continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java
    continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CleanWorkingDirectoryAction.java
    continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
    continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
    continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java
    continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java
    continuum/branches/continuum-flat-multi-module/continuum-model/pom.xml
    continuum/branches/continuum-flat-multi-module/continuum-model/src/main/mdo/continuum.xml
    continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java

Modified: continuum/branches/continuum-flat-multi-module/continuum-commons/src/main/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryService.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-commons/src/main/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryService.java?rev=771527&r1=771526&r2=771527&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-commons/src/main/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryService.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-commons/src/main/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryService.java
Tue May  5 02:53:46 2009
@@ -76,16 +76,16 @@
         
         if ( project.getWorkingDirectory() == null || "".equals( project.getWorkingDirectory()
) )
         {   
-            if( projectScmRoot == null || "".equals( projectScmRoot ) )
+            if( !project.isCheckedOutInSingleDirectory() )
             {
                 project.setWorkingDirectory( Integer.toString( project.getId() ) );
             }
             else
             {
-                if( projects != null && !projects.isEmpty() )
+                Project rootProject = project;
+                if( projects != null )
                 {
-                    // the root project should have the lowest id since it's always added
first
-                    Project rootProject = projects.get( 0 );
+                    // the root project should have the lowest id since it's always added
first                    
                     for( Project projectUnderScmRoot : projects )
                     {
                         if( projectUnderScmRoot.getId() < rootProject.getId() )
@@ -93,20 +93,20 @@
                             rootProject = projectUnderScmRoot;
                         }
                     }
-                    
-                    // determine the path
-                    String projectScmUrl = project.getScmUrl();                    
-                    int indexDiff = StringUtils.differenceAt( projectScmUrl, projectScmRoot
);
-                    
-                    String pathToProject = projectScmUrl.substring( indexDiff );      
-                    if( pathToProject.startsWith( "\\" ) || pathToProject.startsWith( "/"
) )
-                    {
-                        project.setWorkingDirectory( Integer.toString( rootProject.getId()
) + pathToProject );
-                    }
-                    else
-                    {
-                        project.setWorkingDirectory( Integer.toString( rootProject.getId()
) + "/" + pathToProject );
-                    }
+                }                
+                
+             // determine the path
+                String projectScmUrl = project.getScmUrl();                    
+                int indexDiff = StringUtils.differenceAt( projectScmUrl, projectScmRoot );
+                
+                String pathToProject = projectScmUrl.substring( indexDiff );      
+                if( pathToProject.startsWith( "\\" ) || pathToProject.startsWith( "/" ) )
+                {
+                    project.setWorkingDirectory( Integer.toString( rootProject.getId() )
+ pathToProject );
+                }
+                else
+                {
+                    project.setWorkingDirectory( Integer.toString( rootProject.getId() )
+ "/" + pathToProject );
                 }
             }
         }

Modified: continuum/branches/continuum-flat-multi-module/continuum-commons/src/test/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryServiceTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-commons/src/test/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryServiceTest.java?rev=771527&r1=771526&r2=771527&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-commons/src/test/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryServiceTest.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-commons/src/test/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryServiceTest.java
Tue May  5 02:53:46 2009
@@ -72,6 +72,7 @@
         project.setArtifactId( "module-a" );
         project.setVersion( "1.0-SNAPSHOT" );
         project.setScmUrl( "scm:local:src/test-projects:flat-multi-module/module-a" );
+        project.setCheckedOutInSingleDirectory( true );
         
         projects.add( project );
         
@@ -81,6 +82,7 @@
         otherProject.setArtifactId( "module-b" );
         otherProject.setVersion( "1.0-SNAPSHOT" );
         otherProject.setScmUrl( "scm:local:src/test-projects:flat-multi-module/module-b"
);
+        otherProject.setCheckedOutInSingleDirectory( true );
         
         projects.add( otherProject );
         
@@ -90,6 +92,7 @@
         otherProject.setArtifactId( "parent-project" );
         otherProject.setVersion( "1.0-SNAPSHOT" );
         otherProject.setScmUrl( "scm:local:src/test-projects:flat-multi-module/parent-project"
);
+        otherProject.setCheckedOutInSingleDirectory( true );
         
         projects.add( otherProject );
                 

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=771527&r1=771526&r2=771527&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 02:53:46 2009
@@ -31,6 +31,9 @@
 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;
@@ -89,7 +92,16 @@
     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)
      */
@@ -112,7 +124,7 @@
         }
 
         OverallBuildQueue overallBuildQueue =
-            getOverallBuildQueue( BUILD_QUEUE, buildDefinition.getSchedule().getBuildQueues()
);
+            getOverallBuildQueue( BUILD_QUEUE, buildDefinition.getSchedule().getBuildQueues(),
null );
 
         String buildDefinitionLabel = buildDefinition.getDescription();
         if ( StringUtils.isEmpty( buildDefinitionLabel ) )
@@ -164,7 +176,7 @@
         {
             BuildDefinition buildDef = projectsBuildDefinitionsMap.get( firstProjectId );
             OverallBuildQueue overallBuildQueue =
-                getOverallBuildQueue( BUILD_QUEUE, buildDef.getSchedule().getBuildQueues()
);
+                getOverallBuildQueue( BUILD_QUEUE, buildDef.getSchedule().getBuildQueues(),
null );
 
             if ( overallBuildQueue != null )
             {
@@ -388,7 +400,7 @@
         }
 
         OverallBuildQueue overallBuildQueue =
-            getOverallBuildQueue( CHECKOUT_QUEUE, defaultBuildDefinition.getSchedule().getBuildQueues()
);
+            getOverallBuildQueue( CHECKOUT_QUEUE, defaultBuildDefinition.getSchedule().getBuildQueues(),
null );
         CheckOutTask checkoutTask =
             new CheckOutTask( projectId, workingDirectory, projectName, scmUsername, scmPassword,
scmRootUrl, subProjects );
         try
@@ -1108,7 +1120,7 @@
     }
 
     // get overall queue where project will be queued
-    private OverallBuildQueue getOverallBuildQueue( int typeOfQueue, List<BuildQueue>
buildQueues )
+    private OverallBuildQueue getOverallBuildQueue( int typeOfQueue, List<BuildQueue>
buildQueues, Project project )
         throws BuildManagerException
     {
         OverallBuildQueue whereToBeQueued = null;
@@ -1119,59 +1131,20 @@
                 throw new BuildManagerException( "No build queues configured." );
             }
 
-            int size = 0;
-            int idx = 0;
-            int allowedBuilds = configurationService.getNumberOfBuildsInParallel();
+         // 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
 
-            try
+            if( project != null && project.isCheckedOutInSingleDirectory() &&
typeOfQueue == BUILD_QUEUE )
             {
-                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 )
+            else
             {
-                throw new BuildManagerException( "Error occurred while retrieving task quueue:
" + e.getMessage() );
+                whereToBeQueued = getOverallBuildQueue( typeOfQueue, buildQueues );
             }
         }
 
@@ -1192,6 +1165,67 @@
         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
     {

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=771527&r1=771526&r2=771527&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Tue May  5 02:53:46 2009
@@ -1636,7 +1636,7 @@
                             projectsWithSimilarScmRoot.add( projectWithSimilarScmRoot );
                           
                         }
 
-                        context.put( AbstractContinuumAction.KEY_PROJECTS_IN_GROUP_WITH_SIMILAR_SCM_ROOT,
projectsWithSimilarScmRoot );
+                        context.put( AbstractContinuumAction.KEY_PROJECTS_IN_GROUP_WITH_COMMON_SCM_ROOT,
projectsWithSimilarScmRoot );
                     }
                     
                     addProjectToCheckoutQueue( projectBuilderId, buildDefinitionTemplateId,
context, projectGroupCreation,
@@ -3357,22 +3357,29 @@
             // TODO: deng - do we still need a projects and build definitions map?
             //    consider migrated multi-module projects which were checked out in separate
directories!
             //    how would they be affected by these changes?
-            Set<Integer> keys = projectsAndBuildDefinitionsMap.keySet();
-            if( keys != null && !keys.isEmpty() )
-            {                
-                for( Integer key : keys )
-                {
-                    if( key.intValue() > projectId )
+            if( project.isCheckedOutInSingleDirectory() )
+            {
+                Set<Integer> keys = projectsAndBuildDefinitionsMap.keySet();
+                if( keys != null && !keys.isEmpty() )
+                {                
+                    for( Integer key : keys )
                     {
-                        projectsAndBuildDefinitionsMap.put( projectId, buildDefId );
-                        map.put( scmRoot, projectsAndBuildDefinitionsMap );
-                    }
-                } 
+                        if( key.intValue() > projectId )
+                        {
+                            projectsAndBuildDefinitionsMap.put( projectId, buildDefId );
+                            map.put( scmRoot, projectsAndBuildDefinitionsMap );
+                        }
+                    } 
+                }
+                else
+                {
+                    projectsAndBuildDefinitionsMap.put( projectId, buildDefId );        
           
+                    map.put( scmRoot, projectsAndBuildDefinitionsMap );
+                }
             }
             else
             {
-                projectsAndBuildDefinitionsMap.put( projectId, buildDefId );
-                
+                projectsAndBuildDefinitionsMap.put( projectId, buildDefId );            
   
                 map.put( scmRoot, projectsAndBuildDefinitionsMap );
             }   
         }
@@ -3417,28 +3424,31 @@
                 //    are now checked out in a single directory so once they are built
                 //    consider migrated multi-module projects which were checked out in separate
directories!
                 //    how would they be affected by these changes?
-                Set<Integer> keys = projectsAndBuildDefinitionsMap.keySet();
-                if( keys != null && !keys.isEmpty() )
-                {                
-                    for( Integer key : keys )
-                    {
-                        if( key.intValue() > projectId )
+                if( project.isCheckedOutInSingleDirectory() )
+                {
+                    Set<Integer> keys = projectsAndBuildDefinitionsMap.keySet();
+                    if( keys != null && !keys.isEmpty() )
+                    {                
+                        for( Integer key : keys )
                         {
-                            projectsAndBuildDefinitionsMap.put( projectId, buildDefinitionId
);
-                            map.put( scmRoot, projectsAndBuildDefinitionsMap );
-                        }
-                    } 
+                            if( key.intValue() > projectId )
+                            {
+                                projectsAndBuildDefinitionsMap.put( projectId, buildDefinitionId
);
+                                map.put( scmRoot, projectsAndBuildDefinitionsMap );
+                            }
+                        } 
+                    }
+                    else
+                    {
+                        projectsAndBuildDefinitionsMap.put( projectId, buildDefinitionId
);                    
+                        map.put( scmRoot, projectsAndBuildDefinitionsMap );
+                    }
                 }
                 else
                 {
-                    projectsAndBuildDefinitionsMap.put( projectId, buildDefinitionId );
-                    
+                    projectsAndBuildDefinitionsMap.put( projectId, buildDefinitionId ); 
                  
                     map.put( scmRoot, projectsAndBuildDefinitionsMap );
                 }   
-                
-                /*projectsAndBuildDefinitionsMap.put( projectId, buildDefinitionId );   
            
-
-                map.put( scmRoot, projectsAndBuildDefinitionsMap );*/
             }
             catch ( BuildManagerException e )
             {
@@ -3464,10 +3474,6 @@
         throws ContinuumException
     {
         ProjectGroup group = getProjectGroup( projectGroupId );
-
-        // TODO: [deng] there should be a check somewhere that if the project was checked
out in a 
-        //   single directory, then only the root project should be added in the projectsBuildDefinitionsMap!
-        //   --> only the root url will be updated!
         
         try
         {

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java?rev=771527&r1=771526&r2=771527&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java
Tue May  5 02:53:46 2009
@@ -102,7 +102,7 @@
     
     public static final String KEY_URL = "url";
     
-    public static final String KEY_PROJECTS_IN_GROUP_WITH_SIMILAR_SCM_ROOT = "projects-in-group-with-similar-scm-root";
+    public static final String KEY_PROJECTS_IN_GROUP_WITH_COMMON_SCM_ROOT = "projects-in-group-with-common-scm-root";
 
     // ----------------------------------------------------------------------
     //
@@ -234,9 +234,9 @@
         return (Map<Integer, ScmResult>) getObject( context, KEY_SCM_RESULT_MAP );
     }
     
-    public static List<Project> getListOfProjectsInGroupWithSimilarScmRoot( Map<String,
Object> context )
+    public static List<Project> getListOfProjectsInGroupWithCommonScmRoot( Map<String,
Object> context )
     {
-        return (List<Project>) getObject( context, KEY_PROJECTS_IN_GROUP_WITH_SIMILAR_SCM_ROOT,
new ArrayList<Integer>() );
+        return (List<Project>) getObject( context, KEY_PROJECTS_IN_GROUP_WITH_COMMON_SCM_ROOT,
new ArrayList<Integer>() );
     }
     
     

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddProjectToCheckOutQueueAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddProjectToCheckOutQueueAction.java?rev=771527&r1=771526&r2=771527&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddProjectToCheckOutQueueAction.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddProjectToCheckOutQueueAction.java
Tue May  5 02:53:46 2009
@@ -67,6 +67,6 @@
         parallelBuildsManager.checkoutProject( project.getId(), project.getName(),
                                                workingDirectoryService.getWorkingDirectory(
project ),
                                                scmRootUrl, project.getScmUsername(),
-                                               project.getScmPassword(), defaultBuildDefinition,
getListOfProjectsInGroupWithSimilarScmRoot( context ) );
+                                               project.getScmPassword(), defaultBuildDefinition,
getListOfProjectsInGroupWithCommonScmRoot( context ) );
     }
 }

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckWorkingDirectoryAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckWorkingDirectoryAction.java?rev=771527&r1=771526&r2=771527&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckWorkingDirectoryAction.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckWorkingDirectoryAction.java
Tue May  5 02:53:46 2009
@@ -51,10 +51,9 @@
         throws Exception
     {
         Project project = projectDao.getProject( getProjectId( context ) );
-        List<Project> projectsWithSimilarScmRoot = getListOfProjectsInGroupWithSimilarScmRoot(
context );
+        List<Project> projectsWithSimilarScmRoot = getListOfProjectsInGroupWithCommonScmRoot(
context );
         ProjectScmRoot projectScmRoot = getProjectScmRoot( context );
-
-       // File workingDirectory = workingDirectoryService.getWorkingDirectory( project );
+       
         File workingDirectory =
             workingDirectoryService.getWorkingDirectory( project, projectScmRoot.getScmRootAddress(),
                                                          projectsWithSimilarScmRoot );

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java?rev=771527&r1=771526&r2=771527&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java
Tue May  5 02:53:46 2009
@@ -93,7 +93,7 @@
 
         ScmResult result;
 
-        List<Project> projectsWithSimilarScmRoot = getListOfProjectsInGroupWithSimilarScmRoot(
context );
+        List<Project> projectsWithSimilarScmRoot = getListOfProjectsInGroupWithCommonScmRoot(
context );
         
         try
         {

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CleanWorkingDirectoryAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CleanWorkingDirectoryAction.java?rev=771527&r1=771526&r2=771527&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CleanWorkingDirectoryAction.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CleanWorkingDirectoryAction.java
Tue May  5 02:53:46 2009
@@ -53,11 +53,13 @@
         throws Exception
     {
         Project project = projectDao.getProject( getProjectId( context ) );
-        List<Project> projectsWithSimilarScmRoot = getListOfProjectsInGroupWithSimilarScmRoot(
context );
+        List<Project> projectsWithCommonScmRoot = getListOfProjectsInGroupWithCommonScmRoot(
context );
         ProjectScmRoot projectScmRoot = getProjectScmRoot( context ); 
 
         //File workingDirectory = workingDirectoryService.getWorkingDirectory( project );
-        File workingDirectory = workingDirectoryService.getWorkingDirectory( project, projectScmRoot.getScmRootAddress(),
projectsWithSimilarScmRoot );
+        File workingDirectory =
+            workingDirectoryService.getWorkingDirectory( project, projectScmRoot.getScmRootAddress(),
+                                                         projectsWithCommonScmRoot );
 
         if ( workingDirectory.exists() )
         {

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java?rev=771527&r1=771526&r2=771527&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
Tue May  5 02:53:46 2009
@@ -112,7 +112,7 @@
         {
             notifier.checkoutStarted( project, buildDefinition );
 
-            List<Project> projectsWithSimilarScmRoot = getListOfProjectsInGroupWithSimilarScmRoot(
context );
+            List<Project> projectsWithSimilarScmRoot = getListOfProjectsInGroupWithCommonScmRoot(
context );
             ProjectScmRoot projectScmRoot = getProjectScmRoot( context );
 
             // TODO: not sure why this is different to the context, but it all needs to change
@@ -204,7 +204,8 @@
     private ContinuumScmConfiguration createScmConfiguration( Project project, File workingDirectory,
String scmRootUrl )
     {
         ContinuumScmConfiguration config = new ContinuumScmConfiguration();
-        if( scmRootUrl != null && !"".equals( scmRootUrl ) )
+        
+        if( project.isCheckedOutInSingleDirectory() && scmRootUrl!= null &&
!"".equals( scmRootUrl ) )
         {
             config.setUrl( scmRootUrl );
         }
@@ -212,6 +213,7 @@
         {
             config.setUrl( project.getScmUrl() );
         }
+        
         config.setUsername( project.getScmUsername() );
         config.setPassword( project.getScmPassword() );
         config.setUseCredentialsCache( project.isScmUseCache() );

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java?rev=771527&r1=771526&r2=771527&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
Tue May  5 02:53:46 2009
@@ -254,6 +254,8 @@
                 }
             }
 
+            continuumProject.setCheckedOutInSingleDirectory( checkoutInSingleDirectory );
+            
             builderHelper.mapMavenProjectToContinuumProject( result, mavenProject, continuumProject,
groupPom );
 
             if ( result.hasErrors() )

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java?rev=771527&r1=771526&r2=771527&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java
Tue May  5 02:53:46 2009
@@ -95,7 +95,7 @@
 
         context.put( AbstractContinuumAction.KEY_PROJECT_SCM_ROOT, task.getScmRootUrl() );
 
-        context.put( AbstractContinuumAction.KEY_PROJECTS_IN_GROUP_WITH_SIMILAR_SCM_ROOT,
task.getProjectsWithSimilarScmRoot() );
+        context.put( AbstractContinuumAction.KEY_PROJECTS_IN_GROUP_WITH_COMMON_SCM_ROOT,
task.getProjectsWithSimilarScmRoot() );
         
         try
         {

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java?rev=771527&r1=771526&r2=771527&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java
Tue May  5 02:53:46 2009
@@ -213,19 +213,20 @@
             context.put( AbstractContinuumAction.KEY_BUILD_DEFINITION,
                          buildDefinitionDao.getBuildDefinition( buildDefinitionId ) );
 
-          //TODO: deng - put all projects in group with the same scm root in the context!

-            //  this, together with the project scm root, will be used to determine the working
dir            
-            List<Project> projectsInGroup =
-                projectGroupDao.getProjectGroupWithProjects( projectGroup.getId() ).getProjects();

-            List<Project> projectsWithCommonScmRoot = new ArrayList<Project>();
           
-            for( Project projectInGroup : projectsInGroup )
+            if( project.isCheckedOutInSingleDirectory() )
             {
-                if( projectInGroup.getScmUrl().contains( projectScmRootAddress ) )
+                List<Project> projectsInGroup =
+                    projectGroupDao.getProjectGroupWithProjects( projectGroup.getId() ).getProjects();

+                List<Project> projectsWithCommonScmRoot = new ArrayList<Project>();
           
+                for( Project projectInGroup : projectsInGroup )
                 {
-                    projectsWithCommonScmRoot.add( projectInGroup );
-                }
-            }            
-            context.put( AbstractContinuumAction.KEY_PROJECTS_IN_GROUP_WITH_SIMILAR_SCM_ROOT,
projectsWithCommonScmRoot );
+                    if( projectInGroup.getScmUrl().contains( projectScmRootAddress ) )
+                    {
+                        projectsWithCommonScmRoot.add( projectInGroup );
+                    }
+                }            
+                context.put( AbstractContinuumAction.KEY_PROJECTS_IN_GROUP_WITH_COMMON_SCM_ROOT,
projectsWithCommonScmRoot );
+            }
             
             BuildResult oldBuildResult =
                 buildResultDao.getLatestBuildResultForBuildDefinition( projectId, buildDefinitionId
);
@@ -293,7 +294,6 @@
 
         // check state of scm root
         return projectScmRoot.getState() != ContinuumProjectState.ERROR;
-
     }
 
     private void startPrepareBuild( Map<String, Object> context )
@@ -536,7 +536,7 @@
         for ( Project project : projectList )
         {
             int buildDefinitionId;
-
+            
             if ( projectsAndBuildDefinitionsMap.get( project.getId() ) != null )
             {
                 buildDefinitionId = projectsAndBuildDefinitionsMap.get( project.getId() );
@@ -573,7 +573,7 @@
                     log.error( e.getMessage(), e );
                     throw new TaskExecutionException( "Error executing action 'build-project'",
e );
                 }
-            }
+            }            
         }
 
         try

Modified: continuum/branches/continuum-flat-multi-module/continuum-model/pom.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-model/pom.xml?rev=771527&r1=771526&r2=771527&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-model/pom.xml (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-model/pom.xml Tue May  5 02:53:46
2009
@@ -63,7 +63,7 @@
           </execution>
         </executions>
         <configuration>
-          <version>1.3.3</version>
+          <version>1.4.0</version>
           <packageWithVersion>false</packageWithVersion>
           <model>src/main/mdo/continuum.xml</model>
         </configuration>

Modified: continuum/branches/continuum-flat-multi-module/continuum-model/src/main/mdo/continuum.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-model/src/main/mdo/continuum.xml?rev=771527&r1=771526&r2=771527&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-model/src/main/mdo/continuum.xml
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-model/src/main/mdo/continuum.xml
Tue May  5 02:53:46 2009
@@ -317,6 +317,12 @@
           <version>1.1.0+</version>
           <type>String</type>
         </field>
+        <field>
+          <name>checkedOutInSingleDirectory</name>
+          <version>1.4.0+</version>
+          <type>boolean</type>
+          <defaultValue>false</defaultValue>
+        </field>
         <field jpox.mapped-by="project" jpox.fetch-groups="project-with-builds">
           <name>buildResults</name>
           <version>1.0.9+</version>

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java?rev=771527&r1=771526&r2=771527&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java
Tue May  5 02:53:46 2009
@@ -106,6 +106,12 @@
             }
         }
 
+        // force set checkoutInCingleDirectory to false if adding the project as non-recursive
+        if( this.isNonRecursiveProject() )
+        {
+            this.setCheckoutInSingleDirectory( false );
+        }
+        
         if ( result == null )
         {
             result = getContinuum().addMavenTwoProject( pomUrl, selectedProjectGroup, checkProtocol,
scmUseCache,



Mime
View raw message