continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r328019 - in /maven/continuum/trunk: continuum-core/src/main/java/org/apache/maven/continuum/ continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/ continuum-core/src/main/java/org/apache/maven/continuum/core/action/ cont...
Date Mon, 24 Oct 2005 09:55:03 GMT
Author: evenisse
Date: Mon Oct 24 02:54:55 2005
New Revision: 328019

URL: http://svn.apache.org/viewcvs?rev=328019&view=rev
Log:
[CONTINUUM-268] Set project state before build request returns

Modified:
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
    maven/continuum/trunk/continuum-model/src/main/mdo/continuum.mdo

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=328019&r1=328018&r2=328019&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Mon Oct 24 02:54:55 2005
@@ -341,6 +341,12 @@
         {
             Project project = store.getProject( projectId );
 
+            project.setOldState( project.getState() );
+
+            project.setState( ContinuumProjectState.BUILDING );
+
+            store.updateProject( project );
+
             getLogger().info( "Enqueuing '" + project.getName() + "' (Build definition id="
+ buildDefinitionId + "." );
 
             buildQueue.put( new BuildProjectTask( projectId, buildDefinitionId, trigger )
);

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java?rev=328019&r1=328018&r2=328019&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
Mon Oct 24 02:54:55 2005
@@ -232,6 +232,32 @@
         }
         finally
         {
+            try
+            {
+                project = store.getProject( projectId );
+            }
+            catch ( ContinuumStoreException ex )
+            {
+                getLogger().error( "Internal error while building the project.", ex );
+            }
+
+            if ( project.getState() != ContinuumProjectState.NEW &&
+                 project.getState() != ContinuumProjectState.OK &&
+                 project.getState() != ContinuumProjectState.FAILED &&
+                 project.getState() != ContinuumProjectState.ERROR )
+            {
+                try
+                {
+                    project.setState( ContinuumProjectState.ERROR );
+
+                    store.updateProject( project );
+                }
+                catch ( ContinuumStoreException e )
+                {
+                    getLogger().error( "Internal error while storing the project.", e );
+                }
+            }
+
             notifierDispatcher.buildComplete( project, build );
         }
     }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java?rev=328019&r1=328018&r2=328019&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java
Mon Oct 24 02:54:55 2005
@@ -18,6 +18,7 @@
 
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.scm.ScmResult;
+import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.continuum.scm.ContinuumScm;
 import org.apache.maven.continuum.scm.ContinuumScmException;
 import org.apache.maven.continuum.store.ContinuumStore;
@@ -43,6 +44,12 @@
     {
         Project project = store.getProject( getProjectId( context ) );
 
+        int state = project.getState();
+
+        project.setState( ContinuumProjectState.CHECKING_OUT );
+
+        store.updateProject( project );
+
         File workingDirectory = getWorkingDirectory( context );
 
         // ----------------------------------------------------------------------
@@ -82,6 +89,12 @@
             result = new ScmResult();
             result.setSuccess( false );
             result.setException( ContinuumUtils.throwableMessagesToString( t ) );
+        }
+        finally
+        {
+            project.setState( state );
+
+            store.updateProject( project );
         }
         context.put( KEY_CHECKOUT_SCM_RESULT, result );
     }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java?rev=328019&r1=328018&r2=328019&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
Mon Oct 24 02:54:55 2005
@@ -80,10 +80,18 @@
         // This is really a precondition for this action to execute
         // ----------------------------------------------------------------------
 
-        if ( scmResult.getChanges().size() == 0 && trigger != ContinuumProjectState.TRIGGER_FORCED
&&
+        if ( project.getOldState() != ContinuumProjectState.NEW &&
+             scmResult.getChanges().size() == 0 &&
+             trigger != ContinuumProjectState.TRIGGER_FORCED &&
             !isNew( project ) )
         {
             getLogger().info( "No files updated, not building. Project id '" + project.getId()
+ "'." );
+
+            project.setState( project.getOldState() );
+
+            project.setOldState( 0 );
+
+            store.updateProject( project );
 
             return;
         }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java?rev=328019&r1=328018&r2=328019&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
Mon Oct 24 02:54:55 2005
@@ -19,6 +19,7 @@
 import org.apache.maven.continuum.model.project.Project;
 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.scm.ContinuumScm;
 import org.apache.maven.continuum.store.ContinuumStore;
 
@@ -42,6 +43,12 @@
     {
         Project project = store.getProject( getProjectId( context ) );
 
+        int state = project.getState();
+
+        project.setState( ContinuumProjectState.UPDATING );
+
+        store.updateProject( project );
+
         ScmResult scmResult;
 
         try
@@ -54,6 +61,10 @@
         }
         finally
         {
+            project.setState( state );
+
+            store.updateProject( project );
+
             notifier.checkoutComplete( project );
         }
     }

Modified: maven/continuum/trunk/continuum-model/src/main/mdo/continuum.mdo
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-model/src/main/mdo/continuum.mdo?rev=328019&r1=328018&r2=328019&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-model/src/main/mdo/continuum.mdo (original)
+++ maven/continuum/trunk/continuum-model/src/main/mdo/continuum.mdo Mon Oct 24 02:54:55 2005
@@ -144,6 +144,11 @@
           <type>int</type>
           <defaultValue>1</defaultValue>
         </field>
+        <field>
+          <name>oldState</name>
+          <version>1.0.0+</version>
+          <type>int</type>
+        </field>
         <!-- TODO: maybe buildresult itself? -->
         <field>
           <name>latestBuildId</name>



Mime
View raw message