continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From och...@apache.org
Subject svn commit: r771638 - in /continuum/branches/continuum-flat-multi-module: continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/ continuum-core/src/main/java/org/apache/maven/continuum/core/action/ continuum-core/src/test/java/org/apa...
Date Tue, 05 May 2009 09:29:50 GMT
Author: oching
Date: Tue May  5 09:29:49 2009
New Revision: 771638

URL: http://svn.apache.org/viewvc?rev=771638&view=rev
Log:
[CONTINUUM-2193]
o fixed building of flat multi-module projects

Modified:
    continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
    continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.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/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java
    continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseRollbackAction.java

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java?rev=771638&r1=771637&r2=771638&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
Tue May  5 09:29:49 2009
@@ -39,6 +39,7 @@
 import org.apache.maven.continuum.model.project.BuildResult;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectDependency;
+import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.model.scm.ChangeFile;
 import org.apache.maven.continuum.model.scm.ChangeSet;
 import org.apache.maven.continuum.model.scm.ScmResult;
@@ -338,6 +339,8 @@
 
         context.setTrigger( trigger );
 
+        Map<String, Object> actionContext = context.getActionContext();
+        
         try
         {
             Project project = projectDao.getProject( projectId );
@@ -354,6 +357,37 @@
             context.setOldBuildResult( oldBuildResult );
 
             context.setScmResult( scmResult );
+            
+            // CONTINUUM-2193
+            ProjectGroup projectGroup = project.getProjectGroup();
+            List<ProjectScmRoot> scmRoots = projectScmRootDao.getProjectScmRootByProjectGroup(
projectGroup.getId() );
+            String projectScmUrl = project.getScmUrl();
+            String projectScmRootAddress = "";
+            
+            for ( ProjectScmRoot projectScmRoot : scmRoots )
+            {
+                projectScmRootAddress = projectScmRoot.getScmRootAddress();
+                if ( projectScmUrl.contains( projectScmRoot.getScmRootAddress() ) )
+                {                    
+                    actionContext.put( AbstractContinuumAction.KEY_PROJECT_SCM_ROOT, projectScmRoot
);
+                    break;
+                }
+            }
+            
+            if( project.isCheckedOutInSingleDirectory() )
+            {
+                List<Project> projectsInGroup =
+                    projectGroupDao.getProjectGroupWithProjects( projectGroup.getId() ).getProjects();

+                List<Project> projectsWithCommonScmRoot = new ArrayList<Project>();
           
+                for( Project projectInGroup : projectsInGroup )
+                {
+                    if( projectInGroup.getScmUrl().contains( projectScmRootAddress ) )
+                    {
+                        projectsWithCommonScmRoot.add( projectInGroup );
+                    }
+                }            
+                actionContext.put( AbstractContinuumAction.KEY_PROJECTS_IN_GROUP_WITH_COMMON_SCM_ROOT,
projectsWithCommonScmRoot );
+            }
 
             // CONTINUUM-1871 olamy if continuum is killed during building oldBuildResult
will have a endTime 0
             // this means all changes since the project has been loaded in continuum will
be in memory
@@ -369,8 +403,6 @@
             throw new TaskExecutionException( "Error initializing the build context", e );
         }
 
-        Map<String, Object> actionContext = context.getActionContext();
-
         actionContext.put( AbstractContinuumAction.KEY_PROJECT_ID, projectId );
 
         actionContext.put( AbstractContinuumAction.KEY_PROJECT, context.getProject() );
@@ -384,7 +416,7 @@
         actionContext.put( AbstractContinuumAction.KEY_FIRST_RUN, context.getOldBuildResult()
== null );
 
         actionContext.put( AbstractContinuumAction.KEY_SCM_RESULT, context.getScmResult()
);
-
+        
         if ( context.getOldBuildResult() != null )
         {
             actionContext.put( AbstractContinuumAction.KEY_OLD_BUILD_ID, context.getOldBuildResult().getId()
);
@@ -524,9 +556,13 @@
             try
             {
                 ContinuumBuildExecutor executor = buildExecutorManager.getBuildExecutor(
project.getExecutorId() );
-                shouldBuild = executor.shouldBuild( context.getScmResult().getChanges(),
project,
-                                                    workingDirectoryService.getWorkingDirectory(
project ),
-                                                    context.getBuildDefinition() );
+                
+                Map<String, Object> actionContext = context.getActionContext();   
            
+                List<Project> projectsWithCommonScmRoot = AbstractContinuumAction.getListOfProjectsInGroupWithCommonScmRoot(
actionContext );
+                ProjectScmRoot projectScmRoot = AbstractContinuumAction.getProjectScmRoot(
actionContext );
+
+                shouldBuild = executor.shouldBuild( context.getScmResult().getChanges(),
project, 
+                       workingDirectoryService.getWorkingDirectory( project, projectScmRoot.getScmRootAddress(),
projectsWithCommonScmRoot ), context.getBuildDefinition() );                
             }
             catch ( Exception e )
             {

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java?rev=771638&r1=771637&r2=771638&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java
Tue May  5 09:29:49 2009
@@ -21,6 +21,7 @@
 
 import org.apache.continuum.dao.BuildDefinitionDao;
 import org.apache.continuum.dao.ProjectDao;
+import org.apache.continuum.model.project.ProjectScmRoot;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.execution.ContinuumBuildExecutor;
 import org.apache.maven.continuum.execution.ContinuumBuildExecutorException;
@@ -30,6 +31,8 @@
 import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.apache.maven.continuum.utils.WorkingDirectoryService;
 
+import java.io.File;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -78,8 +81,11 @@
 
         ContinuumBuildExecutor builder = buildExecutorManager.getBuildExecutor( project.getExecutorId()
);
 
-        builder.updateProjectFromCheckOut( workingDirectoryService.getWorkingDirectory( project
), project,
-                                           buildDefinition );
+        List<Project> projectsWithCommonScmRoot = getListOfProjectsInGroupWithCommonScmRoot(
context );
+        ProjectScmRoot projectScmRoot = getProjectScmRoot( context );
+        
+        builder.updateProjectFromCheckOut( workingDirectoryService.getWorkingDirectory( project,

+                        projectScmRoot.getScmRootAddress(), projectsWithCommonScmRoot ),
project, buildDefinition );
 
         // ----------------------------------------------------------------------
         // Store the new descriptor

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=771638&r1=771637&r2=771638&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 09:29:49 2009
@@ -112,14 +112,14 @@
         {
             notifier.checkoutStarted( project, buildDefinition );
 
-            List<Project> projectsWithSimilarScmRoot = getListOfProjectsInGroupWithCommonScmRoot(
context );
+            List<Project> projectsWithCommonScmRoot = getListOfProjectsInGroupWithCommonScmRoot(
context );
             ProjectScmRoot projectScmRoot = getProjectScmRoot( context );
 
             // TODO: not sure why this is different to the context, but it all needs to change
             //File workingDirectory = workingDirectoryService.getWorkingDirectory( project
);
             File workingDirectory =
                 workingDirectoryService.getWorkingDirectory( project, projectScmRoot.getScmRootAddress(),
-                                                             projectsWithSimilarScmRoot );
+                                                             projectsWithCommonScmRoot );
             
             ContinuumScmConfiguration config = createScmConfiguration( project, workingDirectory,
projectScmRoot.getScmRootAddress() );
             config.setLatestUpdateDate( latestUpdateDate );

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java?rev=771638&r1=771637&r2=771638&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java
Tue May  5 09:29:49 2009
@@ -21,7 +21,9 @@
 
 import org.apache.continuum.dao.BuildDefinitionDao;
 import org.apache.continuum.dao.BuildResultDao;
+import org.apache.continuum.model.project.ProjectScmRoot;
 import org.apache.maven.continuum.AbstractContinuumTest;
+import org.apache.maven.continuum.core.action.AbstractContinuumAction;
 import org.apache.maven.continuum.execution.ContinuumBuildExecutorConstants;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.BuildResult;
@@ -36,6 +38,7 @@
 import java.io.IOException;
 import java.util.Calendar;
 import java.util.List;
+import java.util.Map;
 
 public class DefaultBuildControllerTest
     extends AbstractContinuumTest
@@ -138,6 +141,13 @@
         oldBuildResult.setEndTime( Calendar.getInstance().getTimeInMillis() + ( hourOfLastExecution
* 3600000 ) );
         context.setOldBuildResult( oldBuildResult );
         context.setScmResult( new ScmResult() );
+        
+        Map<String, Object> actionContext = context.getActionContext();
+        ProjectScmRoot projectScmRoot = new ProjectScmRoot();
+        projectScmRoot.setId( 1 );
+        projectScmRoot.setScmRootAddress( "scm:local:src/test-projects:flat-multi-module"
);
+        actionContext.put( AbstractContinuumAction.KEY_PROJECT_SCM_ROOT, projectScmRoot );
+        
         return context;
     }
 

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseRollbackAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseRollbackAction.java?rev=771638&r1=771637&r2=771638&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseRollbackAction.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseRollbackAction.java
Tue May  5 09:29:49 2009
@@ -93,6 +93,8 @@
     
             Project project = getContinuum().getProject( projectId );
     
+            // TODO: deng - this also needs to be updated! the workingDirectoryService called
should be
+            //      the one with the 3 params
             releaseManager.rollback( releaseId, workingDirectoryService.getWorkingDirectory(
project ).getPath(), listener );
     
             //recurse until rollback is finished



Mime
View raw message