continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r745357 - in /continuum/trunk: continuum-base/continuum-scm/src/main/java/org/apache/continuum/scm/ continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/ continuum-buildagent/continuum-buildagent-core...
Date Wed, 18 Feb 2009 02:11:54 GMT
Author: ctan
Date: Wed Feb 18 02:11:53 2009
New Revision: 745357

URL: http://svn.apache.org/viewvc?rev=745357&view=rev
Log:
[CONTINUUM-2070] added scm changelog to get the last commit date


Modified:
    continuum/trunk/continuum-base/continuum-scm/src/main/java/org/apache/continuum/scm/ContinuumScm.java
    continuum/trunk/continuum-base/continuum-scm/src/main/java/org/apache/continuum/scm/DefaultContinuumScm.java
    continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java
    continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/action/UpdateWorkingDirectoryAction.java
    continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/buildcontext/BuildContext.java
    continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/DefaultBuildAgentManager.java
    continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutor.java
    continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/utils/ContinuumBuildAgentUtil.java
    continuum/trunk/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/DistributedBuildProjectTaskExecutor.java
    continuum/trunk/continuum-builder/src/main/java/org/apache/continuum/builder/utils/ContinuumBuildConstant.java
    continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java
    continuum/trunk/continuum-core/src/main/java/org/apache/continuum/taskqueue/manager/DefaultTaskQueueManager.java
    continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
    continuum/trunk/continuum-model/src/main/mdo/continuum.xml
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/QueuesAction.java

Modified: continuum/trunk/continuum-base/continuum-scm/src/main/java/org/apache/continuum/scm/ContinuumScm.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-base/continuum-scm/src/main/java/org/apache/continuum/scm/ContinuumScm.java?rev=745357&r1=745356&r2=745357&view=diff
==============================================================================
--- continuum/trunk/continuum-base/continuum-scm/src/main/java/org/apache/continuum/scm/ContinuumScm.java
(original)
+++ continuum/trunk/continuum-base/continuum-scm/src/main/java/org/apache/continuum/scm/ContinuumScm.java
Wed Feb 18 02:11:53 2009
@@ -22,6 +22,7 @@
 import java.io.IOException;
 
 import org.apache.maven.scm.ScmException;
+import org.apache.maven.scm.command.changelog.ChangeLogScmResult;
 import org.apache.maven.scm.command.checkout.CheckOutScmResult;
 import org.apache.maven.scm.command.update.UpdateScmResult;
 import org.apache.maven.scm.manager.NoSuchScmProviderException;
@@ -58,4 +59,15 @@
      */
     UpdateScmResult update( ContinuumScmConfiguration config )
         throws ScmRepositoryException, NoSuchScmProviderException, ScmException;
+
+    /**
+     * Get change log for a project
+     * @param config
+     * @return the result of the change log
+     * @throws ScmRepositoryException if there is a problem with the configuration
+     * @throws NoSuchScmProviderException if there is a problem with the configuration
+     * @throws ScmException if there is a problem getting the change log
+     */
+    ChangeLogScmResult changeLog( ContinuumScmConfiguration config )
+        throws ScmRepositoryException, NoSuchScmProviderException, ScmException;
 }

Modified: continuum/trunk/continuum-base/continuum-scm/src/main/java/org/apache/continuum/scm/DefaultContinuumScm.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-base/continuum-scm/src/main/java/org/apache/continuum/scm/DefaultContinuumScm.java?rev=745357&r1=745356&r2=745357&view=diff
==============================================================================
--- continuum/trunk/continuum-base/continuum-scm/src/main/java/org/apache/continuum/scm/DefaultContinuumScm.java
(original)
+++ continuum/trunk/continuum-base/continuum-scm/src/main/java/org/apache/continuum/scm/DefaultContinuumScm.java
Wed Feb 18 02:11:53 2009
@@ -30,6 +30,7 @@
 import org.apache.maven.scm.ScmFileSet;
 import org.apache.maven.scm.ScmTag;
 import org.apache.maven.scm.ScmVersion;
+import org.apache.maven.scm.command.changelog.ChangeLogScmResult;
 import org.apache.maven.scm.command.checkout.CheckOutScmResult;
 import org.apache.maven.scm.command.update.UpdateScmResult;
 import org.apache.maven.scm.manager.NoSuchScmProviderException;
@@ -137,6 +138,25 @@
         return result;
     }
 
+    public ChangeLogScmResult changeLog( ContinuumScmConfiguration configuration )
+        throws ScmException
+    {
+        ScmVersion scmVersion = getScmVersion( configuration );
+
+        // TODO: probably need to base this from a working directory in the main configuration
+        File workingDirectory = configuration.getWorkingDirectory();
+
+        ScmRepository repository = getScmRepository( configuration );
+
+        ChangeLogScmResult result;
+
+        ScmFileSet fileSet = new ScmFileSet( workingDirectory );
+
+        result = scmManager.changeLog( repository, fileSet, scmVersion, scmVersion );
+
+        return result;
+    }
+
     /**
      * Create a Maven SCM repository for obtaining the checkout from.
      * 

Modified: continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java?rev=745357&r1=745356&r2=745357&view=diff
==============================================================================
--- continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java
(original)
+++ continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java
Wed Feb 18 02:11:53 2009
@@ -153,7 +153,7 @@
             result.put( ContinuumBuildAgentUtil.KEY_PROJECT_ID, new Integer( buildContext.getProjectId()
) );
             result.put( ContinuumBuildAgentUtil.KEY_BUILD_DEFINITION_ID, new Integer( buildContext.getBuildDefinitionId()
) );
             result.put( ContinuumBuildAgentUtil.KEY_TRIGGER, new Integer( buildContext.getTrigger()
) );
-            
+
             BuildResult buildResult = buildContext.getBuildResult();
 
             if ( buildResult != null )
@@ -257,6 +257,7 @@
             context.setLocalRepository( ContinuumBuildAgentUtil.getLocalRepository( map )
);
             context.setBuildNumber( ContinuumBuildAgentUtil.getBuildNumber( map ) );
             context.setOldScmResult( getScmResult( ContinuumBuildAgentUtil.getOldScmChanges(
map ) ) );
+            context.setLatestUpdateDate( ContinuumBuildAgentUtil.getLatestUpdateDate( map
) );
 
             buildContext.add( context );
         }

Modified: continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/action/UpdateWorkingDirectoryAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/action/UpdateWorkingDirectoryAction.java?rev=745357&r1=745356&r2=745357&view=diff
==============================================================================
--- continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/action/UpdateWorkingDirectoryAction.java
(original)
+++ continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/action/UpdateWorkingDirectoryAction.java
Wed Feb 18 02:11:53 2009
@@ -20,6 +20,7 @@
  */
 
 import java.io.File;
+import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -61,18 +62,15 @@
     {
         Project project = ContinuumBuildAgentUtil.getProject( context );
 
-        BuildDefinition buildDefinition = ContinuumBuildAgentUtil.getBuildDefinition( context
);
-
         UpdateScmResult scmResult;
 
         ScmResult result;
         
         try
         {
-            // TODO: not sure why this is different to the context, but it all needs to change
             File workingDirectory = buildAgentConfigurationService.getWorkingDirectory( project.getId()
);
             ContinuumScmConfiguration config = createScmConfiguration( project, workingDirectory
);
-            //config.setLatestUpdateDate( latestUpdateDate );
+            config.setLatestUpdateDate( ContinuumBuildAgentUtil.getLatestUpdateDate( context
) );
             String tag = config.getTag();
             String msg = project.getName() + "', id: '" + project.getId() + "' to '" +
                 workingDirectory.getAbsolutePath() + "'" + ( tag != null ? " with branch/tag
" + tag + "." : "." );
@@ -128,6 +126,7 @@
         }
 
         context.put( ContinuumBuildAgentUtil.KEY_UPDATE_SCM_RESULT, result );
+        context.put( ContinuumBuildAgentUtil.KEY_LATEST_UPDATE_DATE, getLatestUpdateDate(
result ) );
     }
 
     private ContinuumScmConfiguration createScmConfiguration( Project project, File workingDirectory
)
@@ -267,4 +266,29 @@
         }
         return message.toString();
     }
+
+    private Date getLatestUpdateDate( ScmResult result )
+    {
+        List<ChangeSet> changes = result.getChanges();
+
+        if ( changes != null && !changes.isEmpty() )
+        {
+            long date = 0;
+
+            for ( ChangeSet change : changes )
+            {
+                if ( date < change.getDate() )
+                {
+                    date = change.getDate();
+                }
+            }
+
+            if ( date != 0 )
+            {
+                return new Date( date );
+            }
+        }
+
+        return null;
+    }
 }

Modified: continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/buildcontext/BuildContext.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/buildcontext/BuildContext.java?rev=745357&r1=745356&r2=745357&view=diff
==============================================================================
--- continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/buildcontext/BuildContext.java
(original)
+++ continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/buildcontext/BuildContext.java
Wed Feb 18 02:11:53 2009
@@ -19,6 +19,7 @@
  * under the License.
  */
 
+import java.util.Date;
 import java.util.Map;
 
 import org.apache.maven.continuum.model.project.BuildResult;
@@ -74,6 +75,8 @@
 
     private ScmResult oldScmResult;
 
+    private Date latestUpdateDate;
+
     public int getProjectGroupId()
     {
         return projectGroupId;
@@ -313,4 +316,14 @@
     {
         return oldScmResult;
     }
+
+    public void setLatestUpdateDate( Date latestUpdateDate )
+    {
+        this.latestUpdateDate = latestUpdateDate;
+    }
+
+    public Date getLatestUpdateDate()
+    {
+        return latestUpdateDate;
+    }
 }

Modified: continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/DefaultBuildAgentManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/DefaultBuildAgentManager.java?rev=745357&r1=745356&r2=745357&view=diff
==============================================================================
--- continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/DefaultBuildAgentManager.java
(original)
+++ continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/DefaultBuildAgentManager.java
Wed Feb 18 02:11:53 2009
@@ -21,11 +21,11 @@
 
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.continuum.buildagent.build.execution.manager.BuildAgentBuildExecutorManager;
 import org.apache.continuum.buildagent.buildcontext.BuildContext;
 import org.apache.continuum.buildagent.configuration.BuildAgentConfigurationService;
 import org.apache.continuum.buildagent.taskqueue.manager.BuildAgentTaskQueueManager;
@@ -71,11 +71,6 @@
      */
     private BuildAgentTaskQueueManager buildAgentTaskQueueManager;
 
-    /**
-     * @plexus.requirement
-     */
-    private BuildAgentBuildExecutorManager executorManager;
-
     public void prepareBuildProjects( List<BuildContext> buildContexts)
         throws ContinuumException
     {
@@ -288,6 +283,7 @@
         actionContext.put( ContinuumBuildAgentUtil.KEY_PROJECT_GROUP_ID, buildContext.getProjectGroupId()
);
         actionContext.put( ContinuumBuildAgentUtil.KEY_SCM_ROOT_ADDRESS, buildContext.getScmRootAddress()
);
         actionContext.put( ContinuumBuildAgentUtil.KEY_OLD_SCM_RESULT, buildContext.getOldScmResult()
);
+        actionContext.put( ContinuumBuildAgentUtil.KEY_LATEST_UPDATE_DATE, buildContext.getLatestUpdateDate()
);
 
         buildContext.setActionContext( actionContext );
     }
@@ -305,7 +301,7 @@
     private void cleanWorkingDirectory( BuildContext buildContext )
         throws ContinuumException
     {
-        performAction( "clean-agent-work-directory", buildContext );
+        performAction( "clean-agent-working-directory", buildContext );
     }
 
     private void updateWorkingDirectory( BuildContext buildContext )
@@ -319,12 +315,24 @@
             ContinuumBuildAgentUtil.getBoolean( actionContext, ContinuumBuildAgentUtil.KEY_WORKING_DIRECTORY_EXISTS
);
     
         ScmResult scmResult;
-    
+
+        Date date = null;
+
         if ( workingDirectoryExists )
         {
             performAction( "update-agent-working-directory", buildContext );
     
             scmResult = ContinuumBuildAgentUtil.getUpdateScmResult( actionContext, null );
+
+            date = ContinuumBuildAgentUtil.getLatestUpdateDate( actionContext );
+
+            if ( date == null )
+            {
+                // try to get latest update date from change log because sometimes date in
the changefile is 0
+                performAction( "changelog-agent-project", buildContext );
+
+                date = ContinuumBuildAgentUtil.getLatestUpdateDate( actionContext );
+            }
         }
         else
         {
@@ -332,13 +340,18 @@
     
             actionContext.put( ContinuumBuildAgentUtil.KEY_WORKING_DIRECTORY,
                                buildAgentConfigurationService.getWorkingDirectory( project.getId()
).getAbsolutePath() );
-    
+
             performAction( "checkout-agent-project", buildContext );
-    
+
             scmResult = ContinuumBuildAgentUtil.getCheckoutScmResult( actionContext, null
);
+
+            performAction( "changelog-agent-project", buildContext );
+
+            date = ContinuumBuildAgentUtil.getLatestUpdateDate( actionContext );
         }
-    
+
         buildContext.setScmResult( scmResult );
+        buildContext.setLatestUpdateDate( date );
         actionContext.put( ContinuumBuildAgentUtil.KEY_SCM_RESULT, scmResult );
     }
 

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=745357&r1=745356&r2=745357&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 18 02:11:53 2009
@@ -213,7 +213,11 @@
         result.put( ContinuumBuildAgentUtil.KEY_BUILD_START, new Long( buildResult.getStartTime()
).toString() );
         result.put( ContinuumBuildAgentUtil.KEY_BUILD_END, new Long( buildResult.getEndTime()
).toString() );
         result.put( ContinuumBuildAgentUtil.KEY_BUILD_EXIT_CODE, new Integer( buildResult.getExitCode()
) );
-        
+        if ( buildContext.getLatestUpdateDate() != null )
+        {
+            result.put( ContinuumBuildAgentUtil.KEY_LATEST_UPDATE_DATE, buildContext.getLatestUpdateDate()
);
+        }
+
         String buildOutput = getBuildOutputText( buildContext.getProjectId() );
         if ( buildOutput == null )
         {
@@ -399,6 +403,10 @@
         map.put( ContinuumBuildAgentUtil.KEY_TRIGGER, new Integer( context.getTrigger() )
);
         map.put( ContinuumBuildAgentUtil.KEY_SCM_CHANGES, getScmChanges( context.getScmResult()
) );
         map.put( ContinuumBuildAgentUtil.KEY_MAVEN_PROJECT, getMavenProject( context ) );
+        if ( context.getLatestUpdateDate() != null )
+        {
+            map.put( ContinuumBuildAgentUtil.KEY_LATEST_UPDATE_DATE, context.getLatestUpdateDate()
);
+        }
 
         try
         {

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=745357&r1=745356&r2=745357&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 18 02:11:53 2009
@@ -200,6 +200,8 @@
 
     public static final String KEY_MAVEN_PROJECT = "maven-project";
 
+    public static final String KEY_LATEST_UPDATE_DATE = "latest-update-date";
+
     public static Integer getProjectId( Map context )
     {
         return getInteger( context, KEY_PROJECT_ID );
@@ -394,6 +396,11 @@
         return getList( context, KEY_SCM_CHANGES );
     }
 
+    public static Date getLatestUpdateDate( Map context )
+    {
+        return getDate( context, KEY_LATEST_UPDATE_DATE );
+    }
+
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
@@ -463,7 +470,7 @@
 
     public static Date getDate( Map context, String key )
     {
-        Object obj = getObject( context, key );
+        Object obj = getObject( context, key, null );
 
         if ( obj == null )
         {

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=745357&r1=745356&r2=745357&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 18 02:11:53 2009
@@ -22,6 +22,7 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -153,6 +154,7 @@
             {                
                 int buildDefinitionId = projectsAndBuildDefinitions.get( project.getId()
);
                 BuildDefinition buildDef = buildDefinitionDao.getBuildDefinition( buildDefinitionId
);
+                BuildResult buildResult = buildResultDao.getLatestBuildResultForProject(
project.getId() );
 
                 Map context = new HashMap();
                 
@@ -166,6 +168,10 @@
                 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()
) );
+                if ( buildResult != null )
+                {
+                    context.put( ContinuumBuildConstant.KEY_LATEST_UPDATE_DATE, new Date(
buildResult.getStartTime() ) );
+                }
 
                 LocalRepository localRepo = project.getProjectGroup().getLocalRepository();
 

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=745357&r1=745356&r2=745357&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 18 02:11:53 2009
@@ -172,6 +172,8 @@
 
     public static final String KEY_PROJECT_MODULES = "project-modules";
 
+    public static final String KEY_LATEST_UPDATE_DATE = "latest-update-date";
+
     public static int getProjectId( Map context )
     {
         return getInteger( context, KEY_PROJECT_ID );
@@ -472,6 +474,10 @@
         return getList( context, KEY_PROJECT_MODULES );
     }
 
+    public static Date getLatestUpdateDate( Map context )
+    {
+        return getDate( context, KEY_LATEST_UPDATE_DATE );
+    }
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------

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=745357&r1=745356&r2=745357&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 18 02:11:53 2009
@@ -27,6 +27,7 @@
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -222,7 +223,7 @@
         }
     }
 
-    public void removeAgentFromTaskQueueExecutor( String buildAgentUrl)
+    public void removeAgentFromTaskQueueExecutor( String buildAgentUrl )
         throws ContinuumException
     {
         log.info( "remove TaskQueueExecutor for build agent '" + buildAgentUrl + "'" );
@@ -372,7 +373,17 @@
                 buildResult.setBuildNumber( buildNumber );
                 buildResult.setModifiedDependencies( getModifiedDependencies( oldBuildResult,
context ) );
                 buildResult.setScmResult( getScmResult( context ) );
-                
+
+                Date date = ContinuumBuildConstant.getLatestUpdateDate( context );
+                if ( date != null )
+                {
+                    buildResult.setLastChangedDate( date.getTime() );
+                }
+                else if ( oldBuildResult != null )
+                {
+                    buildResult.setLastChangedDate( oldBuildResult.getLastChangedDate() );
+                }
+
                 buildResultDao.addBuildResult( project, buildResult );
             
                 project.setOldState( project.getState() );
@@ -718,6 +729,19 @@
                 return true;
             }
 
+            Date date = ContinuumBuildConstant.getLatestUpdateDate( context );
+            if ( date != null && oldBuildResult.getLastChangedDate() >= date.getTime()
)
+            {
+                log.info( "No changes found,not building" );
+                return false;
+            }
+            else if ( date != null && changes.isEmpty() )
+            {
+                // fresh checkout from build agent that's why changes is empty
+                log.info( "Changes found in the current project, building" );
+                return true;
+            }
+
             boolean shouldBuild = false;
 
             boolean allChangesUnknown = true;

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/continuum/taskqueue/manager/DefaultTaskQueueManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/continuum/taskqueue/manager/DefaultTaskQueueManager.java?rev=745357&r1=745356&r2=745357&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/continuum/taskqueue/manager/DefaultTaskQueueManager.java
(original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/continuum/taskqueue/manager/DefaultTaskQueueManager.java
Wed Feb 18 02:11:53 2009
@@ -295,7 +295,7 @@
         throws TaskQueueManagerException
     {
         List<PrepareBuildProjectsTask> queue = getDistributedBuildProjectsInQueue();
-
+        
         for ( PrepareBuildProjectsTask task : queue )
         {
             if ( task.getProjectGroupId() == projectGroupId && task.getScmRootAddress().equals(
scmRootAddress ) )

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java?rev=745357&r1=745356&r2=745357&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
(original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
Wed Feb 18 02:11:53 2009
@@ -87,14 +87,6 @@
 
         BuildDefinition buildDefinition = getBuildDefinition( context );
 
-        // do not set state of project to updating
-
-        //int state = project.getState();
-
-        //project.setState( ContinuumProjectState.UPDATING );
-
-        //projectDao.updateProject( project );
-
         UpdateScmResult scmResult;
 
         ScmResult result;

Modified: continuum/trunk/continuum-model/src/main/mdo/continuum.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-model/src/main/mdo/continuum.xml?rev=745357&r1=745356&r2=745357&view=diff
==============================================================================
--- continuum/trunk/continuum-model/src/main/mdo/continuum.xml (original)
+++ continuum/trunk/continuum-model/src/main/mdo/continuum.xml Wed Feb 18 02:11:53 2009
@@ -602,6 +602,11 @@
             <multiplicity>*</multiplicity>
           </association>
         </field>
+        <field>
+          <name>lastChangedDate</name>
+          <version>1.1.4+</version>
+          <type>long</type>
+        </field>
       </fields>
       <codeSegments>
         <codeSegment>

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/QueuesAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/QueuesAction.java?rev=745357&r1=745356&r2=745357&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/QueuesAction.java
(original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/QueuesAction.java
Wed Feb 18 02:11:53 2009
@@ -661,4 +661,14 @@
     {
         this.selectedDistributedBuildTaskHashCodes = selectedDistributedBuildTaskHashCodes;
     }
+
+    public String getScmRootAddress()
+    {
+        return scmRootAddress;
+    }
+
+    public void setScmRootAddress( String scmRootAddress )
+    {
+        this.scmRootAddress = scmRootAddress;
+    }
 }



Mime
View raw message