continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r740587 [2/2] - in /continuum/trunk: continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/ continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/ continuum-buildagent/continuum-b...
Date Wed, 04 Feb 2009 03:23:32 GMT
Modified: continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutor.java?rev=740587&r1=740586&r2=740587&view=diff
==============================================================================
--- continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutor.java (original)
+++ continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutor.java Wed Feb  4 03:23:31 2009
@@ -25,8 +25,6 @@
 import java.util.List;
 import java.util.Map;
 
-import javax.annotation.Resource;
-
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.continuum.buildagent.buildcontext.BuildContext;
 import org.apache.continuum.buildagent.buildcontext.manager.BuildContextManager;
@@ -40,6 +38,8 @@
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.execution.ContinuumBuildExecutorConstants;
 import org.apache.maven.continuum.model.project.BuildResult;
+import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.scm.ScmException;
 import org.apache.maven.scm.repository.ScmRepositoryException;
@@ -92,11 +92,12 @@
         BuildContext context = buildContextManager.getBuildContext( projectId );
         initializeBuildContext( context );
 
+        /*
         if ( !checkScmResult( context ) )
         {
             log.info( "Error updating from SCM, not building" );
             return;
-        }
+        }*/
         
         log.info( "Starting build of " + context.getProjectName() );
         startBuild( context );
@@ -105,6 +106,18 @@
         {
             Map actionContext = context.getActionContext();
 
+            try
+            {
+                performAction( "update-project-from-agent-working-directory", context );
+            }
+            catch ( TaskExecutionException e )
+            {
+                updateBuildResult( context, ContinuumBuildAgentUtil.throwableToString( e ) );
+
+                //just log the error but don't stop the build from progressing in order not to suppress any build result messages there
+                log.error( "Error executing action update-project-from-agent-working-directory '", e );
+            }
+
             performAction( "execute-agent-builder", context );
 
             updateBuildResult( context, null );
@@ -118,15 +131,23 @@
     private void initializeBuildContext( BuildContext buildContext )
         throws TaskExecutionException
     {
-        Map<String, Object> actionContext = buildContext.getActionContext();
+        Map<String, Object> actionContext = new HashMap<String, Object>();
 
         actionContext.put( ContinuumBuildAgentUtil.KEY_PROJECT_ID, buildContext.getProjectId() );
-        actionContext.put( ContinuumBuildAgentUtil.KEY_PROJECT, BuildContextToProject.getProject( buildContext ) );
+
+        Project project = BuildContextToProject.getProject( buildContext );
+        ProjectGroup projectGroup = new ProjectGroup();
+        projectGroup.setId( buildContext.getProjectGroupId() );
+        projectGroup.setName( buildContext.getProjectGroupName() );
+        project.setProjectGroup( projectGroup );
+        
+        actionContext.put( ContinuumBuildAgentUtil.KEY_PROJECT, project );
         actionContext.put( ContinuumBuildAgentUtil.KEY_BUILD_DEFINITION, BuildContextToBuildDefinition.getBuildDefinition( buildContext ) );
         actionContext.put( ContinuumBuildAgentUtil.KEY_TRIGGER, buildContext.getTrigger() );
         actionContext.put( ContinuumBuildAgentUtil.KEY_ENVIRONMENTS, getEnvironments( buildContext.getBuildDefinitionId(), 
                                                                                       getInstallationType( buildContext ) ) );
         actionContext.put( ContinuumBuildAgentUtil.KEY_LOCAL_REPOSITORY, buildContext.getLocalRepository() );
+        buildContext.setActionContext( actionContext );
 
         buildContext.setBuildStartTime( System.currentTimeMillis() );
     }

Modified: continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/utils/BuildContextToProject.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/utils/BuildContextToProject.java?rev=740587&r1=740586&r2=740587&view=diff
==============================================================================
--- continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/utils/BuildContextToProject.java (original)
+++ continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/utils/BuildContextToProject.java Wed Feb  4 03:23:31 2009
@@ -35,6 +35,8 @@
 
         project.setName( buildContext.getProjectName() );
 
+        project.setVersion( buildContext.getProjectVersion() );
+
         project.setScmUrl( buildContext.getScmUrl() );
 
         project.setScmUsername( buildContext.getScmUsername() );
@@ -44,7 +46,13 @@
         project.setExecutorId( buildContext.getExecutorId() );
 
         project.setState( buildContext.getProjectState() );
-        
+
+        project.setOldState( buildContext.getProjectState() );
+
+        project.setBuildNumber( buildContext.getBuildNumber() );
+
+        project.setScmResult( buildContext.getOldScmResult() );
+
         return project;
     }
 }

Modified: continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/utils/ContinuumBuildAgentUtil.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/utils/ContinuumBuildAgentUtil.java?rev=740587&r1=740586&r2=740587&view=diff
==============================================================================
--- continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/utils/ContinuumBuildAgentUtil.java (original)
+++ continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/utils/ContinuumBuildAgentUtil.java Wed Feb  4 03:23:31 2009
@@ -21,6 +21,9 @@
 
 import java.io.PrintWriter;
 import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
 import java.util.Map;
 
 import org.apache.maven.continuum.model.project.BuildDefinition;
@@ -34,6 +37,10 @@
 
     public static final String KEY_PROJECT_ID = "project-id";
 
+    public static final String KEY_PROJECT_VERSION = "project-version";
+
+    public static final String KEY_BUILD_NUMBER = "build-number";
+
     public static final String KEY_BUILD_DEFINITION_ID = "builddefinition-id";
 
     public static final String KEY_TRIGGER = "trigger";
@@ -76,6 +83,8 @@
 
     public static final String KEY_PROJECT_GROUP_ID = "project-group-id";
 
+    public static final String KEY_PROJECT_GROUP_NAME = "project-group-name";
+
     public static final String KEY_SCM_ROOT_ADDRESS = "scm-root-address";
 
     public static final String KEY_SCM_ROOT_STATE = "scm-root-state";
@@ -118,6 +127,70 @@
 
     public static final String KEY_LOCAL_REPOSITORY = "local-repository";
 
+    public static final String KEY_SCM_CHANGES = "scm-changes";
+
+    public static final String KEY_CHANGESET_AUTHOR = "changeset-author";
+
+    public static final String KEY_CHANGESET_COMMENT = "changeset-comment";
+
+    public static final String KEY_CHANGESET_DATE = "changeset-date";
+
+    public static final String KEY_CHANGESET_FILES = "changeset-files";
+
+    public static final String KEY_CHANGEFILE_NAME = "changefile-name";
+
+    public static final String KEY_CHANGEFILE_REVISION = "changefile-revision";
+
+    public static final String KEY_CHANGEFILE_STATUS = "changefile-status";
+
+    public static final String KEY_OLD_SCM_RESULT = "old-scm-result";
+
+    public static final String KEY_OLD_SCM_CHANGES = "old-scm-changes";
+
+    public static final String KEY_PROJECT_DESCRIPTION = "project-description";
+
+    public static final String KEY_GROUP_ID = "group-id";
+
+    public static final String KEY_ARTIFACT_ID = "artifact-id";
+
+    public static final String KEY_PROJECT_DEVELOPERS = "project-developers";
+
+    public static final String KEY_PROJECT_DEPENDENCIES = "project-dependencies";
+
+    public static final String KEY_PROJECT_NOTIFIERS = "project-notifiers";
+
+    public static final String KEY_PROJECT_URL = "project-url";
+
+    public static final String KEY_SCM_TAG = "scm-tag";
+
+    public static final String KEY_PROJECT_PARENT = "project-parent";
+
+    public static final String KEY_NOTIFIER_TYPE = "notifier-type";
+
+    public static final String KEY_NOTIFIER_CONFIGURATION = "notifier-configuration";
+
+    public static final String KEY_NOTIFIER_FROM = "notifier-from";
+
+    public static final String KEY_NOTIFIER_RECIPIENT_TYPE = "notifier-recipient-type";
+
+    public static final String KEY_NOTIFIER_ENABLED = "notifier-enabled";
+
+    public static final String KEY_NOTIFIER_SEND_ON_SUCCESS = "notifier-send-on-success";
+
+    public static final String KEY_NOTIFIER_SEND_ON_FAILURE = "notifier-send-on-failure";
+
+    public static final String KEY_NOTIFIER_SEND_ON_ERROR = "notifier-send-on-error";
+
+    public static final String KEY_NOTIFIER_SEND_ON_SCMFAILURE = "notifier-send-on-scmfailure";
+
+    public static final String KEY_NOTIFIER_SEND_ON_WARNING = "notifier-send-on-warning";
+
+    public static final String KEY_PROJECT_DEVELOPER_NAME = "developer-name";
+
+    public static final String KEY_PROJECT_DEVELOPER_EMAIL = "developer-email";
+
+    public static final String KEY_PROJECT_DEVELOPER_SCMID = "developer-scmid";
+
     public static Integer getProjectId( Map context )
     {
         return getInteger( context, KEY_PROJECT_ID );
@@ -220,7 +293,7 @@
 
     public static int getTrigger( Map context )
     {
-        return (Integer) getObject( context, KEY_TRIGGER );
+        return getInteger( context, KEY_TRIGGER );
     }
 
     public static BuildResult getBuildResult( Map context, Object defaultValue )
@@ -235,7 +308,76 @@
 
     public static String getLocalRepository( Map context )
     {
-        return (String) getObject( context, KEY_LOCAL_REPOSITORY );
+        return getString( context, KEY_LOCAL_REPOSITORY );
+    }
+
+    public static String getProjectVersion( Map context )
+    {
+        return getString( context, KEY_PROJECT_VERSION );
+    }
+
+    public static String getProjectGroupName( Map context )
+    {
+        return getString( context, KEY_PROJECT_GROUP_NAME );
+    }
+
+    public static int getBuildNumber( Map context )
+    {
+        return getInteger( context, KEY_BUILD_NUMBER );
+    }
+
+    public static List getOldScmChanges( Map context )
+    {
+        return getList( context, KEY_OLD_SCM_CHANGES );
+    }
+
+    public static String getChangeSetAuthor( Map context )
+    {
+        return getString( context, KEY_CHANGESET_AUTHOR );
+    }
+
+    public static String getChangeSetComment( Map context )
+    {
+        return getString( context, KEY_CHANGESET_COMMENT );
+    }
+
+    public static long getChangeSetDate( Map context )
+    {
+        Date date = getDate( context, KEY_CHANGESET_DATE );
+
+        if ( date == null )
+        {
+            return 0;
+        }
+        else
+        {
+            return date.getTime();
+        }
+    }
+
+    public static List getChangeSetFiles( Map context )
+    {
+        return getList( context, KEY_CHANGESET_FILES );
+    }
+
+    public static String getChangeFileName( Map context )
+    {
+        return getString( context, KEY_CHANGEFILE_NAME );
+    }
+
+    public static String getChangeFileRevision( Map context )
+    {
+        return getString( context, KEY_CHANGEFILE_REVISION );
+    }
+
+    public static String getChangeFileStatus( Map context )
+    {
+        return getString( context, KEY_CHANGEFILE_STATUS );
+    }
+
+    public static ScmResult getOldScmResult( Map context, ScmResult defaultValue )
+    {
+        return (ScmResult) getObject( context, KEY_OLD_SCM_RESULT, defaultValue );
     }
 
     // ----------------------------------------------------------------------
@@ -276,6 +418,49 @@
         }
     }
 
+    public static List getList( Map context, String key )
+    {
+        Object obj = getObject( context, key, null );
+
+        if ( obj == null )
+        {
+            return null;
+        }
+        else
+        {
+            List list = new ArrayList();
+            Object[] objA = (Object[]) obj;
+
+            for ( Object o : objA )
+            {
+                if ( o instanceof Map )
+                {
+                    list.add( (Map) o );
+                }
+                else
+                {
+                    list.add( o );
+                }
+            }
+
+            return list;
+        }
+    }
+
+    public static Date getDate( Map context, String key )
+    {
+        Object obj = getObject( context, key );
+
+        if ( obj == null )
+        {
+            return null;
+        }
+        else
+        {
+            return (Date) obj;
+        }
+    }
+
     protected static Object getObject( Map context, String key )
     {
         if ( !context.containsKey( key ) )

Modified: continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/resources/META-INF/spring-context.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/resources/META-INF/spring-context.xml?rev=740587&r1=740586&r2=740587&view=diff
==============================================================================
--- continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/resources/META-INF/spring-context.xml (original)
+++ continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/resources/META-INF/spring-context.xml Wed Feb  4 03:23:31 2009
@@ -16,7 +16,7 @@
   <bean name="continuumAgentBuildExecutor#maven2"
          class="org.apache.continuum.buildagent.build.execution.maven.m2.MavenTwoBuildExecutor" autowire="byName">
     <property name="defaultExecutable" value="mvn"/>
-    <property name="builderHelper" ref="buildAgentMavenBuilderHelper"/>
+    <property name="buildAgentMavenBuilderHelper" ref="buildAgentMavenBuilderHelper"/>
     <property name="projectHelper" ref="mavenProjectHelper"/>
   </bean>
   <bean name="continuumAgentBuildExecutor#maven-1"
@@ -39,16 +39,6 @@
     <property name="configurationFile" value="file:${CONTINUUM_BUILDAGENT_HOME}/conf/continuum-buildagent.xml" />
   </bean>
 
-  <bean id="projectHelper" class="org.apache.maven.project.DefaultMavenProjectHelper"/>
-
-  <bean id="projectBuilder" class="org.apache.maven.project.DefaultMavenProjectBuilder"/>
-
-  <bean id="mavenSettingsBuilder" class="org.apache.maven.settings.DefaultMavenSettingsBuilder"/>
-
-  <bean id="artifactRepositoryFactory" class="org.apache.maven.artifact.repository.DefaultArtifactRepositoryFactory"/>
-
-  <bean id="defaultRepositoryLayout" class="org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout"/>
-
   <bean id="actionManager" class="org.codehaus.plexus.action.DefaultActionManager"/>
 </beans>
 	
\ No newline at end of file

Modified: continuum/trunk/continuum-buildagent/continuum-buildagent-webapp/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-webapp/src/main/webapp/WEB-INF/web.xml?rev=740587&r1=740586&r2=740587&view=diff
==============================================================================
--- continuum/trunk/continuum-buildagent/continuum-buildagent-webapp/src/main/webapp/WEB-INF/web.xml (original)
+++ continuum/trunk/continuum-buildagent/continuum-buildagent-webapp/src/main/webapp/WEB-INF/web.xml Wed Feb  4 03:23:31 2009
@@ -30,22 +30,6 @@
   </context-param>
   
   <servlet>
-    <servlet-name>MasterXmlRpcServlet</servlet-name>
-    <servlet-class>
-      com.atlassian.xmlrpc.spring.BinderSpringXmlRpcServlet
-    </servlet-class>
-    <init-param>
-      <param-name>serviceListBeanName</param-name>
-      <param-value>xmlrpcServicesList</param-value>
-    </init-param>
-    <init-param>
-      <param-name>enabledForExtensions</param-name>
-      <param-value>true</param-value>
-    </init-param>
-    <load-on-startup>1</load-on-startup>
-  </servlet>
-  
-  <servlet>
     <servlet-name>SlaveXmlRpcServlet</servlet-name>
     <servlet-class>
       com.atlassian.xmlrpc.spring.BinderSpringXmlRpcServlet
@@ -62,11 +46,6 @@
   </servlet>
   
   <servlet-mapping>
-    <servlet-name>MasterXmlRpcServlet</servlet-name>
-    <url-pattern>/master-xmlrpc</url-pattern>
-  </servlet-mapping>
-  
-  <servlet-mapping>
     <servlet-name>SlaveXmlRpcServlet</servlet-name>
     <url-pattern>/xmlrpc</url-pattern>
   </servlet-mapping>

Modified: continuum/trunk/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/DistributedBuildProjectTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/DistributedBuildProjectTaskExecutor.java?rev=740587&r1=740586&r2=740587&view=diff
==============================================================================
--- continuum/trunk/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/DistributedBuildProjectTaskExecutor.java (original)
+++ continuum/trunk/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/DistributedBuildProjectTaskExecutor.java Wed Feb  4 03:23:31 2009
@@ -41,10 +41,15 @@
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.BuildResult;
 import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.model.scm.ChangeFile;
+import org.apache.maven.continuum.model.scm.ChangeSet;
+import org.apache.maven.continuum.model.scm.ScmResult;
+import org.apache.maven.continuum.notification.ContinuumNotificationDispatcher;
 import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.continuum.store.ContinuumStoreException;
 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;
@@ -105,6 +110,8 @@
                                                         prepareBuildTask.getScmRootAddress() );
 
             startTime = System.currentTimeMillis();
+            client.updateProjects( buildContext );
+            updateBuildContext( buildContext);
             client.buildProjects( buildContext );
 
             endTime = System.currentTimeMillis();
@@ -150,16 +157,17 @@
             {                
                 int buildDefinitionId = projectsAndBuildDefinitions.get( project.getId() );
                 BuildDefinition buildDef = buildDefinitionDao.getBuildDefinition( buildDefinitionId );
-                BuildResult oldBuildResult =
-                    buildResultDao.getLatestBuildResultForBuildDefinition( project.getId(), buildDefinitionId );
 
                 Map context = new HashMap();
                 
                 context.put( ContinuumBuildConstant.KEY_PROJECT_GROUP_ID, new Integer( project.getProjectGroup().getId() ) );
+                context.put( ContinuumBuildConstant.KEY_PROJECT_GROUP_NAME, project.getProjectGroup().getName() );
                 context.put( ContinuumBuildConstant.KEY_SCM_ROOT_ADDRESS, scmRootAddress );
                 context.put( ContinuumBuildConstant.KEY_PROJECT_ID, new Integer( project.getId() ) );
                 context.put( ContinuumBuildConstant.KEY_PROJECT_NAME, project.getName() );
+                context.put( ContinuumBuildConstant.KEY_PROJECT_VERSION, project.getVersion() );
                 context.put( ContinuumBuildConstant.KEY_EXECUTOR_ID, project.getExecutorId() );
+                context.put( ContinuumBuildConstant.KEY_PROJECT_BUILD_NUMBER, new Integer( project.getBuildNumber() ) );
                 context.put( ContinuumBuildConstant.KEY_SCM_URL, project.getScmUrl() );
                 context.put( ContinuumBuildConstant.KEY_PROJECT_STATE, new Integer( project.getState() ) );
 
@@ -206,6 +214,8 @@
                 }
                 context.put( ContinuumBuildConstant.KEY_TRIGGER, new Integer( trigger ) );
                 context.put( ContinuumBuildConstant.KEY_BUILD_FRESH, new Boolean( buildDef.isBuildFresh() ) );
+                context.put( ContinuumBuildConstant.KEY_ALWAYS_BUILD, new Boolean( buildDef.isAlwaysBuild() ) );
+                context.put( ContinuumBuildConstant.KEY_OLD_SCM_CHANGES, getOldScmChanges( project.getId(), buildDefinitionId ) );
 
                 buildContext.add( context );
             }
@@ -263,4 +273,146 @@
             throw new TaskExecutionException( "Error while creating result", e );
         }
     }
+
+    private List getOldScmChanges( int projectId, int buildDefinitionId )
+        throws ContinuumStoreException
+    {
+        List scmChanges = new ArrayList();
+
+        BuildResult oldBuildResult =
+            buildResultDao.getLatestBuildResultForBuildDefinition( projectId, buildDefinitionId );
+
+        if ( oldBuildResult != null )
+        {
+            ScmResult scmResult = getOldScmResults( projectId, oldBuildResult.getBuildNumber(), oldBuildResult.getEndTime() );
+        
+            if ( scmResult != null && scmResult.getChanges() != null )
+            {
+                for ( Object obj : scmResult.getChanges() )
+                {
+                    ChangeSet changeSet = (ChangeSet) obj; 
+
+                    Map map = new HashMap();
+                    if ( StringUtils.isNotEmpty( changeSet.getAuthor() ) )
+                    {
+                        map.put( ContinuumBuildConstant.KEY_CHANGESET_AUTHOR, changeSet.getAuthor() );
+                    }
+                    else
+                    {
+                        map.put( ContinuumBuildConstant.KEY_CHANGESET_AUTHOR, "" );
+                    }
+                    if ( StringUtils.isNotEmpty( changeSet.getComment() ) )
+                    {
+                        map.put( ContinuumBuildConstant.KEY_CHANGESET_COMMENT, changeSet.getComment() );
+                    }
+                    else
+                    {
+                        map.put( ContinuumBuildConstant.KEY_CHANGESET_COMMENT, "" );
+                    }
+                    map.put( ContinuumBuildConstant.KEY_CHANGESET_DATE, changeSet.getDateAsDate() );
+                    map.put( ContinuumBuildConstant.KEY_CHANGESET_FILES, getOldScmChangeFiles( changeSet.getFiles() ) );
+                    scmChanges.add( map );
+                }
+            }
+        }
+
+        return scmChanges;
+    }
+
+    private List<Map> getOldScmChangeFiles( List<ChangeFile> files )
+    {
+        List<Map> scmChangeFiles = new ArrayList<Map>();
+
+        if ( files != null )
+        {
+            for ( ChangeFile changeFile : files )
+            {
+                Map map = new HashMap();
+
+                if ( StringUtils.isNotEmpty( changeFile.getName() ) )
+                {
+                    map.put( ContinuumBuildConstant.KEY_CHANGEFILE_NAME, changeFile.getName() );
+                }
+                else
+                {
+                    map.put( ContinuumBuildConstant.KEY_CHANGEFILE_NAME, "" );
+                }
+                if ( StringUtils.isNotEmpty( changeFile.getRevision() ) )
+                {
+                    map.put( ContinuumBuildConstant.KEY_CHANGEFILE_REVISION, changeFile.getRevision() );
+                }
+                else
+                {
+                    map.put( ContinuumBuildConstant.KEY_CHANGEFILE_REVISION, "" );
+                }
+                if ( StringUtils.isNotEmpty( changeFile.getStatus() ) )
+                {
+                    map.put( ContinuumBuildConstant.KEY_CHANGEFILE_STATUS, changeFile.getStatus() );
+                }
+                else
+                {
+                    map.put( ContinuumBuildConstant.KEY_CHANGEFILE_STATUS, "" );   
+                }
+                scmChangeFiles.add( map );
+            }
+        }
+        return scmChangeFiles;
+    }
+
+    private ScmResult getOldScmResults( int projectId, long startId, long fromDate )
+        throws ContinuumStoreException
+    {
+        List<BuildResult> results = buildResultDao.getBuildResultsForProjectFromId( projectId, startId );
+    
+        ScmResult res = new ScmResult();
+    
+        if ( results != null && results.size() > 0 )
+        {
+            for ( BuildResult result : results )
+            {
+                ScmResult scmResult = result.getScmResult();
+    
+                if ( scmResult != null )
+                {
+                    List<ChangeSet> changes = scmResult.getChanges();
+    
+                    if ( changes != null )
+                    {
+                        for ( ChangeSet changeSet : changes )
+                        {
+                            if ( changeSet.getDate() < fromDate )
+                            {
+                                continue;
+                            }
+                            if ( !res.getChanges().contains( changeSet ) )
+                            {
+                                res.addChange( changeSet );
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    
+        return res;
+    }
+
+    private void updateBuildContext( List<Map> buildContext )
+    {
+        for ( Map context : buildContext )
+        {
+            int projectId = ContinuumBuildConstant.getProjectId( context );
+            
+            if ( !shouldBuild() )
+            {
+                buildContext.remove( context );
+            }
+        }
+    }
+
+    //TODO: Fix this
+    private boolean shouldBuild()
+    {
+        return true;
+    }
 }

Modified: continuum/trunk/continuum-builder/src/main/java/org/apache/continuum/builder/utils/ContinuumBuildConstant.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-builder/src/main/java/org/apache/continuum/builder/utils/ContinuumBuildConstant.java?rev=740587&r1=740586&r2=740587&view=diff
==============================================================================
--- continuum/trunk/continuum-builder/src/main/java/org/apache/continuum/builder/utils/ContinuumBuildConstant.java (original)
+++ continuum/trunk/continuum-builder/src/main/java/org/apache/continuum/builder/utils/ContinuumBuildConstant.java Wed Feb  4 03:23:31 2009
@@ -19,6 +19,9 @@
  * under the License.
  */
 
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
 import java.util.Map;
 
 import org.apache.maven.continuum.model.project.BuildResult;
@@ -27,6 +30,10 @@
 {
     public static final String KEY_PROJECT_ID = "project-id";
 
+    public static final String KEY_PROJECT_VERSION = "project-version";
+
+    public static final String KEY_PROJECT_BUILD_NUMBER = "build-number";
+
     public static final String KEY_BUILD_DEFINITION_ID = "builddefinition-id";
 
     public static final String KEY_TRIGGER = "trigger";
@@ -47,6 +54,8 @@
 
     public static final String KEY_BUILD_FRESH = "build-fresh";
 
+    public static final String KEY_ALWAYS_BUILD = "always-build";
+
     public static final String KEY_BUILD_START = "build-start";
 
     public static final String KEY_BUILD_END = "build-end";
@@ -69,6 +78,8 @@
 
     public static final String KEY_PROJECT_GROUP_ID = "project-group-id";
 
+    public static final String KEY_PROJECT_GROUP_NAME = "project-group-name";
+    
     public static final String KEY_SCM_ROOT_ADDRESS = "scm-root-address";
 
     public static final String KEY_SCM_ERROR = "scm-error";
@@ -91,6 +102,70 @@
 
     public static final String KEY_LOCAL_REPOSITORY = "local-repository";
 
+    public static final String KEY_SCM_CHANGES = "scm-changes";
+
+    public static final String KEY_CHANGESET_ID = "changeset-id";
+
+    public static final String KEY_CHANGESET_AUTHOR = "changeset-author";
+
+    public static final String KEY_CHANGESET_COMMENT = "changeset-comment";
+
+    public static final String KEY_CHANGESET_DATE = "changeset-date";
+
+    public static final String KEY_CHANGESET_FILES = "changeset-files";
+
+    public static final String KEY_CHANGEFILE_NAME = "changefile-name";
+
+    public static final String KEY_CHANGEFILE_REVISION = "changefile-revision";
+
+    public static final String KEY_CHANGEFILE_STATUS = "changefile-status";
+
+    public static final String KEY_OLD_SCM_CHANGES = "old-scm-changes";
+
+    public static final String KEY_PROJECT_DESCRIPTION = "project-description";
+
+    public static final String KEY_GROUP_ID = "group-id";
+
+    public static final String KEY_ARTIFACT_ID = "artifact-id";
+
+    public static final String KEY_PROJECT_DEVELOPERS = "project-developers";
+
+    public static final String KEY_PROJECT_DEPENDENCIES = "project-dependencies";
+
+    public static final String KEY_PROJECT_NOTIFIERS = "project-notifiers";
+
+    public static final String KEY_PROJECT_URL = "project-url";
+
+    public static final String KEY_SCM_TAG = "scm-tag";
+
+    public static final String KEY_PROJECT_PARENT = "project-parent";
+
+    public static final String KEY_NOTIFIER_TYPE = "notifier-type";
+
+    public static final String KEY_NOTIFIER_CONFIGURATION = "notifier-configuration";
+
+    public static final String KEY_NOTIFIER_FROM = "notifier-from";
+
+    public static final String KEY_NOTIFIER_RECIPIENT_TYPE = "notifier-recipient-type";
+
+    public static final String KEY_NOTIFIER_ENABLED = "notifier-enabled";
+
+    public static final String KEY_NOTIFIER_SEND_ON_SUCCESS = "notifier-send-on-success";
+
+    public static final String KEY_NOTIFIER_SEND_ON_FAILURE = "notifier-send-on-failure";
+
+    public static final String KEY_NOTIFIER_SEND_ON_ERROR = "notifier-send-on-error";
+
+    public static final String KEY_NOTIFIER_SEND_ON_SCMFAILURE = "notifier-send-on-scmfailure";
+
+    public static final String KEY_NOTIFIER_SEND_ON_WARNING = "notifier-send-on-warning";
+
+    public static final String KEY_PROJECT_DEVELOPER_NAME = "developer-name";
+
+    public static final String KEY_PROJECT_DEVELOPER_EMAIL = "developer-email";
+
+    public static final String KEY_PROJECT_DEVELOPER_SCMID = "developer-scmid";
+
     public static int getProjectId( Map context )
     {
         return getInteger( context, KEY_PROJECT_ID );
@@ -201,6 +276,181 @@
         return getString( context, KEY_INSTALLATION_VAR_NAME );
     }
 
+    public static List getScmChanges( Map context )
+    {
+        return getList( context, KEY_SCM_CHANGES );
+    }
+
+    public static String getChangeSetAuthor( Map context )
+    {
+        return getString( context, KEY_CHANGESET_AUTHOR );
+    }
+
+    public static String getChangeSetComment( Map context )
+    {
+        return getString( context, KEY_CHANGESET_COMMENT );
+    }
+
+    public static long getChangeSetDate( Map context )
+    {
+        Date date = getDate( context, KEY_CHANGESET_DATE );
+
+        if ( date == null )
+        {
+            return 0;
+        }
+        else
+        {
+            return date.getTime();
+        }
+    }
+
+    public static List getChangeSetFiles( Map context )
+    {
+        return getList( context, KEY_CHANGESET_FILES );
+    }
+
+    public static String getChangeFileName( Map context )
+    {
+        return getString( context, KEY_CHANGEFILE_NAME );
+    }
+
+    public static String getChangeFileRevision( Map context )
+    {
+        return getString( context, KEY_CHANGEFILE_REVISION );
+    }
+
+    public static String getChangeFileStatus( Map context )
+    {
+        return getString( context, KEY_CHANGEFILE_STATUS );
+    }
+
+    public static String getGroupId( Map context )
+    {
+        return getString( context, KEY_GROUP_ID);
+    }
+
+    public static String getArtifactId( Map context )
+    {
+        return getString( context, KEY_ARTIFACT_ID );
+    }
+
+    public static String getVersion( Map context )
+    {
+        return getString( context, KEY_PROJECT_VERSION );
+        
+    }
+
+    public static String getProjectName( Map context )
+    {
+        return getString( context, KEY_PROJECT_NAME );
+    }
+
+    public static String getProjectDescription( Map context )
+    {
+        return getString( context, KEY_PROJECT_DESCRIPTION );
+    }
+
+    public static String getProjectUrl( Map context )
+    {
+        return getString( context, KEY_PROJECT_URL );
+    }
+
+    public static String getScmUrl( Map context )
+    {
+        return getString( context, KEY_SCM_URL );
+    }
+
+    public static String getScmTag( Map context )
+    {
+        return getString( context, KEY_SCM_TAG );
+    }
+
+    public static Map getProjectParent( Map context )
+    {
+        return getMap( context, KEY_PROJECT_PARENT );
+    }
+
+    public static List getProjectDevelopers( Map context )
+    {
+        return getList( context, KEY_PROJECT_DEVELOPERS );
+    }
+
+    public static String getDeveloperName( Map context )
+    {
+        return getString( context, KEY_PROJECT_DEVELOPER_NAME );
+    }
+
+    public static String getDeveloperEmail( Map context )
+    {
+        return getString( context, KEY_PROJECT_DEVELOPER_EMAIL );
+    }
+
+    public static String getDeveloperScmId( Map context )
+    {
+        return getString( context, KEY_PROJECT_DEVELOPER_SCMID );
+    }
+
+    public static List getProjectDependencies( Map context )
+    {
+        return getList( context, KEY_PROJECT_DEPENDENCIES );
+    }
+
+    public static List getProjectNotifiers( Map context )
+    {
+        return getList( context, KEY_PROJECT_NOTIFIERS );
+    }
+
+    public static Map getNotifierConfiguration( Map context )
+    {
+        return getMap( context, KEY_NOTIFIER_CONFIGURATION );
+    }
+
+    public static int getNotifierFrom( Map context )
+    {
+        return getInteger( context, KEY_NOTIFIER_FROM );
+    }
+
+    public static int getNotifierRecipientType( Map context )
+    {
+        return getInteger( context, KEY_NOTIFIER_RECIPIENT_TYPE );
+    }
+
+    public static String getNotifierType( Map context )
+    {
+        return getString( context, KEY_NOTIFIER_TYPE );
+    }
+
+    public static boolean isNotifierEnabled( Map context )
+    {
+        return getBoolean( context, KEY_NOTIFIER_ENABLED );
+    }
+
+    public static boolean isNotifierSendOnError( Map context )
+    {
+        return getBoolean( context, KEY_NOTIFIER_SEND_ON_ERROR );
+    }
+
+    public static boolean isNotifierSendOnFailure( Map context )
+    {
+        return getBoolean( context, KEY_NOTIFIER_SEND_ON_FAILURE );
+    }
+
+    public static boolean isNotifierSendOnScmFailure( Map context )
+    {
+        return getBoolean( context, KEY_NOTIFIER_SEND_ON_SCMFAILURE );
+    }
+
+    public static boolean isNotifierSendOnSuccess( Map context )
+    {
+        return getBoolean( context, KEY_NOTIFIER_SEND_ON_SUCCESS );
+    }
+
+    public static boolean isNotifierSendOnWarning( Map context )
+    {
+        return getBoolean( context, KEY_NOTIFIER_SEND_ON_WARNING );
+    }
+
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
@@ -257,17 +507,60 @@
         }
     }
 
-    protected static long getLong( Map context, String key )
+    protected static Date getDate( Map context, String key )
     {
         Object obj = getObject( context, key, null );
-        
+
         if ( obj == null )
         {
-            return 0;
+            return null;
+        }
+        else
+        {
+            return (Date)obj;
+        }
+    }
+
+    protected static List getList( Map context, String key )
+    {
+        Object obj = getObject( context, key, null );
+
+        if ( obj == null )
+        {
+            return null;
+        }
+        else
+        {
+            List list = new ArrayList();
+            Object[] objA = (Object[]) obj;
+
+            for ( Object o : objA )
+            {
+                if ( o instanceof Map )
+                {
+                    list.add( (Map) o );
+                }
+                else
+                {
+                    list.add( o );
+                }
+            }
+
+            return list;
+        }
+    }
+
+    protected static Map getMap( Map context, String key )
+    {
+        Object obj = getObject( context, key, null );
+
+        if ( obj == null )
+        {
+            return null;
         }
         else
         {
-            return ( (Long) obj ).longValue();
+            return (Map) obj;
         }
     }
 

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java?rev=740587&r1=740586&r2=740587&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java Wed Feb  4 03:23:31 2009
@@ -51,6 +51,10 @@
 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.ProjectDeveloper;
+import org.apache.maven.continuum.model.project.ProjectNotifier;
+import org.apache.maven.continuum.model.scm.ChangeFile;
+import org.apache.maven.continuum.model.scm.ChangeSet;
 import org.apache.maven.continuum.model.scm.ScmResult;
 import org.apache.maven.continuum.model.system.Installation;
 import org.apache.maven.continuum.model.system.Profile;
@@ -344,6 +348,7 @@
             scmResult.setException( ContinuumBuildConstant.getScmException( context ) );
             scmResult.setProviderMessage( ContinuumBuildConstant.getScmProviderMessage( context ) );
             scmResult.setSuccess( ContinuumBuildConstant.isScmSuccess( context ) );
+            scmResult.setChanges( getScmChanges( context ) );
 
             project.setScmResult( scmResult );
             projectDao.updateProject( project );
@@ -392,6 +397,7 @@
                 buildResult.setBuildDefinition( buildDefinition );
                 buildResult.setBuildNumber( buildNumber );
                 buildResult.setModifiedDependencies( getModifiedDependencies( oldBuildResult, context ) );
+                buildResult.setScmResult( project.getScmResult() );
                 
                 buildResultDao.addBuildResult( project, buildResult );
             
@@ -650,6 +656,7 @@
                 buildResult.setBuildDefinition( buildDefinition );
                 buildResult.setBuildNumber( project.getBuildNumber() + 1 );
                 buildResult.setModifiedDependencies( getModifiedDependencies( oldBuildResult, result ) );
+                buildResult.setScmResult( project.getScmResult() );
 
                 String buildOutput = ContinuumBuildConstant.getBuildOutput( result );
                 
@@ -703,6 +710,58 @@
         return envVars;
     }
 
+    public void updateProject( Map context )
+        throws ContinuumException
+    {
+        try
+        {
+            Project project = projectDao.getProject( ContinuumBuildConstant.getProjectId( context ) );
+
+            if ( StringUtils.isNotBlank( ContinuumBuildConstant.getGroupId( context ) ) )
+            {
+                project.setGroupId( ContinuumBuildConstant.getGroupId( context ) );
+            }
+            if ( StringUtils.isNotBlank( ContinuumBuildConstant.getArtifactId( context ) ) )
+            {
+                project.setArtifactId( ContinuumBuildConstant.getArtifactId( context ) );
+            }
+            if ( StringUtils.isNotBlank( ContinuumBuildConstant.getVersion( context ) ) )
+            {
+                project.setVersion( ContinuumBuildConstant.getVersion( context ) );
+            }
+            if ( StringUtils.isNotBlank( ContinuumBuildConstant.getProjectName( context ) ) )
+            {
+                project.setName( ContinuumBuildConstant.getProjectName( context ) );
+            }
+            if ( StringUtils.isNotBlank( ContinuumBuildConstant.getProjectDescription( context ) ) )
+            {
+                project.setDescription( ContinuumBuildConstant.getProjectDescription( context ) );
+            }
+            if ( StringUtils.isNotBlank( ContinuumBuildConstant.getProjectUrl( context ) ) )
+            {
+                project.setUrl( ContinuumBuildConstant.getProjectUrl( context ) );
+            }
+            if ( StringUtils.isNotBlank( ContinuumBuildConstant.getScmUrl( context ) ) )
+            {
+                project.setScmUrl( ContinuumBuildConstant.getScmUrl( context ) );
+            }
+            if ( StringUtils.isNotBlank( ContinuumBuildConstant.getScmTag( context ) ) )
+            {
+                project.setScmTag( ContinuumBuildConstant.getScmTag( context ) );
+            }
+            project.setParent( getProjectParent( context ) );
+            project.setDependencies( getProjectDependencies( context ) );
+            project.setDevelopers( getProjectDevelopers( context ) );
+            project.setNotifiers( getProjectNotifiers( context ) );
+
+            projectDao.updateProject( project );
+        }
+        catch ( ContinuumStoreException e )
+        {
+            throw new ContinuumException( "Unable to update project from working copy", e );
+        }
+    }
+
     private String getBuildAgent( int projectId )
         throws ContinuumException
     {
@@ -773,4 +832,129 @@
         return envVars;
     }
 
+    private List getScmChanges( Map context )
+    {
+        List changes = new ArrayList();
+        List<Map> scmChanges = ContinuumBuildConstant.getScmChanges( context );
+
+        if ( scmChanges != null )
+        {
+            for ( Map map : scmChanges )
+            {
+                ChangeSet changeSet = new ChangeSet();
+                changeSet.setAuthor( ContinuumBuildConstant.getChangeSetAuthor( map ) );
+                changeSet.setComment( ContinuumBuildConstant.getChangeSetComment( map ) );
+                changeSet.setDate( ContinuumBuildConstant.getChangeSetDate( map ) );
+                setChangeFiles( changeSet, map );
+                changes.add( changeSet );
+            }
+        }
+
+        return changes;
+    }
+
+    private void setChangeFiles( ChangeSet changeSet, Map context )
+    {
+        List<Map> changeFiles = ContinuumBuildConstant.getChangeSetFiles( context );
+
+        if ( changeFiles != null )
+        {
+            for ( Map map : changeFiles )
+            {
+                ChangeFile changeFile = new ChangeFile();
+                changeFile.setName( ContinuumBuildConstant.getChangeFileName( map ) );
+                changeFile.setRevision( ContinuumBuildConstant.getChangeFileRevision( map ) );
+                changeFile.setStatus( ContinuumBuildConstant.getChangeFileStatus( map ) );
+
+                changeSet.addFile( changeFile );
+            }
+        }
+    }
+
+    private ProjectDependency getProjectParent( Map context )
+    {
+        Map map = ContinuumBuildConstant.getProjectParent( context );
+        
+        if ( map != null && map.size() > 0 )
+        {
+            ProjectDependency parent = new ProjectDependency();
+            parent.setGroupId( ContinuumBuildConstant.getGroupId( map ) );
+            parent.setArtifactId( ContinuumBuildConstant.getArtifactId( map ) );
+            parent.setVersion( ContinuumBuildConstant.getVersion( map ) );
+
+            return parent;
+        }
+
+        return null;
+    }
+
+    private List<ProjectDependency> getProjectDependencies( Map context )
+    {
+        List<ProjectDependency> projectDependencies = new ArrayList<ProjectDependency>();
+
+        List<Map> dependencies = ContinuumBuildConstant.getProjectDependencies( context );
+        
+        if ( dependencies != null )
+        {
+            for ( Map map : dependencies )
+            {
+                ProjectDependency dependency = new ProjectDependency();
+                dependency.setGroupId( ContinuumBuildConstant.getGroupId( map ) );
+                dependency.setArtifactId( ContinuumBuildConstant.getArtifactId( map ) );
+                dependency.setVersion( ContinuumBuildConstant.getVersion( map ) );
+
+                projectDependencies.add( dependency );
+            }
+        }
+        return projectDependencies;
+    }
+
+    private List<ProjectDeveloper> getProjectDevelopers( Map context )
+    {
+        List<ProjectDeveloper> projectDevelopers = new ArrayList<ProjectDeveloper>();
+
+        List<Map> developers = ContinuumBuildConstant.getProjectDevelopers( context );
+
+        if ( developers != null )
+        {
+            for ( Map map : developers )
+            {
+                ProjectDeveloper developer = new ProjectDeveloper();
+                developer.setName( ContinuumBuildConstant.getDeveloperName( map ) );
+                developer.setEmail( ContinuumBuildConstant.getDeveloperEmail( map ) );
+                developer.setScmId( ContinuumBuildConstant.getDeveloperScmId( map ) );
+
+                projectDevelopers.add( developer );
+            }
+        }
+        return projectDevelopers;
+    }
+
+    private List<ProjectNotifier> getProjectNotifiers( Map context )
+    {
+        List<ProjectNotifier> projectNotifiers = new ArrayList<ProjectNotifier>();
+
+        List<Map> notifiers = ContinuumBuildConstant.getProjectNotifiers( context );
+
+        if ( notifiers != null )
+        {
+            for ( Map map : notifiers )
+            {
+                ProjectNotifier notifier = new ProjectNotifier();
+                notifier.setConfiguration( ContinuumBuildConstant.getNotifierConfiguration( map ) );
+                notifier.setEnabled( ContinuumBuildConstant.isNotifierEnabled( map ) );
+                notifier.setFrom( ContinuumBuildConstant.getNotifierFrom( map ) );
+                notifier.setRecipientType( ContinuumBuildConstant.getNotifierRecipientType( map ) );
+                notifier.setSendOnError( ContinuumBuildConstant.isNotifierSendOnError( map ) );
+                notifier.setSendOnFailure( ContinuumBuildConstant.isNotifierSendOnFailure( map ) );
+                notifier.setSendOnScmFailure( ContinuumBuildConstant.isNotifierSendOnScmFailure( map ) );
+                notifier.setSendOnSuccess( ContinuumBuildConstant.isNotifierSendOnSuccess( map ) );
+                notifier.setSendOnWarning( ContinuumBuildConstant.isNotifierSendOnWarning( map ) );
+                notifier.setType( ContinuumBuildConstant.getNotifierType( map ) );
+
+                projectNotifiers.add( notifier );
+            }
+        }
+        return projectNotifiers;
+    }
 }

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java?rev=740587&r1=740586&r2=740587&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java Wed Feb  4 03:23:31 2009
@@ -284,6 +284,11 @@
 
     private void updateBuildResult( BuildResult build, BuildContext context )
     {
+        if ( build.getScmResult() == null && context.getScmResult() != null )
+        {
+            build.setScmResult( context.getScmResult() );
+        }
+
         if ( build.getModifiedDependencies() == null && context.getModifiedDependencies() != null )
         {
             build.setModifiedDependencies( context.getModifiedDependencies() );
@@ -347,7 +352,7 @@
             context.setOldBuildResult( oldBuildResult );
 
 		    context.setScmResult( project.getScmResult() );
-		    
+
             // 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
             // now we will load all BuildResult with an Id bigger or equals than the oldBuildResult one
@@ -376,6 +381,8 @@
 
         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() );
@@ -678,6 +685,8 @@
 
         updateBuildResult( build, context );
 
+        build.setScmResult( context.getScmResult() );
+
         build.setBuildDefinition( context.getBuildDefinition() );
 
         if ( error != null )

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java?rev=740587&r1=740586&r2=740587&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java Wed Feb  4 03:23:31 2009
@@ -30,7 +30,7 @@
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.BuildResult;
 import org.apache.maven.continuum.model.project.Project;
-//import org.apache.maven.continuum.model.scm.ScmResult;
+import org.apache.maven.continuum.model.scm.ScmResult;
 import org.apache.maven.continuum.notification.ContinuumNotificationDispatcher;
 import org.apache.maven.continuum.project.ContinuumProjectState;
 
@@ -86,6 +86,8 @@
 
         int trigger = getTrigger( context );
 
+        ScmResult scmResult = getScmResult( context );
+
         List updatedDependencies = getUpdatedDependencies( context );
 
         ContinuumBuildExecutor buildExecutor = buildExecutorManager.getBuildExecutor( project.getExecutorId() );
@@ -102,6 +104,8 @@
 
         buildResult.setTrigger( trigger );
 
+        buildResult.setScmResult( scmResult );
+
         buildResult.setModifiedDependencies( updatedDependencies );
 
         buildResult.setBuildDefinition( getBuildDefinition( context ) );

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java?rev=740587&r1=740586&r2=740587&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java Wed Feb  4 03:23:31 2009
@@ -26,6 +26,7 @@
 import java.util.Set;
 
 import org.apache.continuum.dao.BuildDefinitionDao;
+import org.apache.continuum.dao.BuildResultDao;
 import org.apache.continuum.dao.ProjectDao;
 import org.apache.continuum.dao.ProjectScmRootDao;
 import org.apache.continuum.model.project.ProjectScmRoot;
@@ -34,6 +35,7 @@
 import org.apache.continuum.utils.ProjectSorter;
 import org.apache.maven.continuum.core.action.AbstractContinuumAction;
 import org.apache.maven.continuum.model.project.BuildDefinition;
+import org.apache.maven.continuum.model.project.BuildResult;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.model.scm.ChangeSet;
@@ -82,7 +84,12 @@
      * @plexus.requirement
      */
     private ProjectScmRootDao projectScmRootDao;
-    
+
+    /**
+     * @plexus.requirement
+     */
+    private BuildResultDao buildResultDao;
+
     /**
      * @plexus.requirement
      */
@@ -191,8 +198,19 @@
     
             context.put( AbstractContinuumAction.KEY_BUILD_DEFINITION_ID, buildDefinitionId );
             context.put( AbstractContinuumAction.KEY_BUILD_DEFINITION, buildDefinitionDao.getBuildDefinition( buildDefinitionId ) );
-            
-            context.put( AbstractContinuumAction.KEY_OLD_SCM_RESULT, project.getScmResult() );
+
+            BuildResult oldBuildResult =
+                buildResultDao.getLatestBuildResultForBuildDefinition( projectId, buildDefinitionId );
+
+            if ( oldBuildResult != null )
+            {
+                context.put( AbstractContinuumAction.KEY_OLD_SCM_RESULT, 
+                             getOldScmResults( projectId, oldBuildResult.getBuildNumber(), oldBuildResult.getEndTime() ) );
+            }
+            else
+            {
+                context.put( AbstractContinuumAction.KEY_OLD_SCM_RESULT, null );
+            }
         }
         catch ( ContinuumStoreException e )
         {
@@ -323,7 +341,45 @@
             throw new TaskExecutionException( "Error storing the project", e );
         }
     }
+
+    private ScmResult getOldScmResults( int projectId, long startId, long fromDate )
+        throws ContinuumStoreException
+    {
+        List<BuildResult> results = buildResultDao.getBuildResultsForProjectFromId( projectId, startId );
     
+        ScmResult res = new ScmResult();
+
+        if ( results != null && results.size() > 0 )
+        {
+            for ( BuildResult result : results )
+            {
+                ScmResult scmResult = result.getScmResult();
+    
+                if ( scmResult != null )
+                {
+                    List<ChangeSet> changes = scmResult.getChanges();
+    
+                    if ( changes != null )
+                    {
+                        for ( ChangeSet changeSet : changes )
+                        {
+                            if ( changeSet.getDate() < fromDate )
+                            {
+                                continue;
+                            }
+                            if ( !res.getChanges().contains( changeSet ) )
+                            {
+                                res.addChange( changeSet );
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    
+        return res;
+    }
+
     /**
      * Merges scm results so we'll have all changes since last execution of current build definition
      *
@@ -522,7 +578,7 @@
             context.put( AbstractContinuumAction.KEY_PROJECTS, projectsToBeBuilt );
             context.put( AbstractContinuumAction.KEY_PROJECTS_BUILD_DEFINITIONS_MAP, projectsBuildDefinitionsMap );
             context.put( AbstractContinuumAction.KEY_TRIGGER, trigger );
-            
+
             log.info( "Performing action create-build-project-task" );
             actionManager.lookup( "create-build-project-task" ).execute( context );
         }

Modified: continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-api/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportService.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-api/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportService.java?rev=740587&r1=740586&r2=740587&view=diff
==============================================================================
--- continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-api/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportService.java (original)
+++ continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-api/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportService.java Wed Feb  4 03:23:31 2009
@@ -41,5 +41,7 @@
 
     public Map<String, String> getEnvironments( Integer buildDefinitionId, String installationType ) throws Exception;
 
+    public Boolean updateProject( Map project ) throws Exception;
+
     public Boolean ping() throws Exception;
 }

Modified: continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-client/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportClient.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-client/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportClient.java?rev=740587&r1=740586&r2=740587&view=diff
==============================================================================
--- continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-client/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportClient.java (original)
+++ continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-client/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportClient.java Wed Feb  4 03:23:31 2009
@@ -194,4 +194,23 @@
 
         return result;
     }
+
+    public Boolean updateProject( Map project )
+        throws Exception
+    {
+        Boolean result = null;
+
+        try
+        {
+            result = master.updateProject( project );
+            log.info( "Updating project" );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Failed to update project", e );
+            throw new Exception( "Failed to update project", e );
+        }
+
+        return result;
+    }
 }

Modified: continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-server/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportServer.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-server/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportServer.java?rev=740587&r1=740586&r2=740587&view=diff
==============================================================================
--- continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-server/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportServer.java (original)
+++ continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-server/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportServer.java Wed Feb  4 03:23:31 2009
@@ -95,4 +95,12 @@
         log.info( "Retrieving environments" );
         return distributedBuildManager.getEnvironments( buildDefinitionId, installationType );
     }
+
+    public Boolean updateProject( Map project )
+        throws Exception
+    {
+        log.info( "Start updating project" );
+        distributedBuildManager.updateProject( project );
+        return Boolean.TRUE;
+    }
 }

Modified: continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-api/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportService.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-api/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportService.java?rev=740587&r1=740586&r2=740587&view=diff
==============================================================================
--- continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-api/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportService.java (original)
+++ continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-api/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportService.java Wed Feb  4 03:23:31 2009
@@ -41,4 +41,6 @@
     public Boolean ping() throws Exception;
 
     public Boolean cancelBuild() throws Exception;
+
+    public Boolean updateProjects( List<Map> projectsBuildContext ) throws Exception;
 }

Modified: continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportClient.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportClient.java?rev=740587&r1=740586&r2=740587&view=diff
==============================================================================
--- continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportClient.java (original)
+++ continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportClient.java Wed Feb  4 03:23:31 2009
@@ -177,4 +177,23 @@
 
         return null;
     }
+
+    public Boolean updateProjects( List<Map> projectsBuildContext )
+        throws Exception
+    {
+        Boolean result = null;
+
+        try
+        {
+            result = slave.updateProjects( projectsBuildContext );
+            log.info( "Updating projects" );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Error updating projects" );
+            throw new Exception( "Error updating projects", e );
+        }
+
+        return result;
+    }
 }

Modified: continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-server/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportServer.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-server/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportServer.java?rev=740587&r1=740586&r2=740587&view=diff
==============================================================================
--- continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-server/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportServer.java (original)
+++ continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-server/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportServer.java Wed Feb  4 03:23:31 2009
@@ -135,4 +135,23 @@
 
         return result;
     }
+
+    public Boolean updateProjects( List<Map> projectsBuildContext )
+        throws Exception
+    {
+        Boolean result = Boolean.FALSE;
+
+        try
+        {
+            continuumBuildAgentService.updateProjects( projectsBuildContext );
+            result = Boolean.TRUE;
+            log.info( "Updating projects" );
+        }
+        catch ( ContinuumBuildAgentException e )
+        {
+            log.error( "Failed to update projects", e );
+        }
+
+        return result;
+    }
 }

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java?rev=740587&r1=740586&r2=740587&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java (original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java Wed Feb  4 03:23:31 2009
@@ -128,7 +128,7 @@
             {
                 hasSurefireResults = files.length > 0;
             }
-            changeSet = getContinuum().getChangesSinceLastUpdate( getProjectId() );
+            changeSet = getContinuum().getChangesSinceLastSuccess( getProjectId(), getBuildId() );
 
             buildOutput = getBuildOutputText();
 



Mime
View raw message