continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r370565 - in /maven/continuum/trunk: continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/ continuum-core/src/main/java/org/apache/maven/continuum/scm/ continuum-model/src/main/mdo/
Date Thu, 19 Jan 2006 18:32:35 GMT
Author: evenisse
Date: Thu Jan 19 10:32:29 2006
New Revision: 370565

URL: http://svn.apache.org/viewcvs?rev=370565&view=rev
Log:
[CONTINUUM-535] Trigger a build if change set doesn't contains only files with unknown status
Submitted by Nick Gonzalez

Modified:
    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/scm/DefaultContinuumScm.java
    maven/continuum/trunk/continuum-model/src/main/mdo/continuum.mdo

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=370565&r1=370564&r2=370565&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
Thu Jan 19 10:32:29 2006
@@ -27,11 +27,15 @@
 import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.apache.maven.continuum.utils.ContinuumUtils;
 import org.apache.maven.continuum.utils.WorkingDirectoryService;
+import org.apache.maven.continuum.model.scm.ChangeFile;
+import org.apache.maven.continuum.model.scm.ChangeSet;
 import org.codehaus.plexus.action.ActionManager;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.util.StringUtils;
 
 import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -166,6 +170,61 @@
 
                 scmResult = (ScmResult) actionContext.get( AbstractContinuumAction.KEY_UPDATE_SCM_RESULT
);
 
+                List changes = scmResult.getChanges();
+
+                Iterator iterChanges = changes.iterator();
+
+                ChangeSet changeSet;
+
+                List changeFiles;
+
+                Iterator iterFiles;
+
+                ChangeFile changeFile;
+
+                boolean allChangesUnknown = true;
+
+                while ( iterChanges.hasNext() )
+                {
+
+                    changeSet = (ChangeSet) iterChanges.next();
+
+                    changeFiles = changeSet.getFiles();
+
+                    iterFiles = changeFiles.iterator();
+
+                    while ( iterFiles.hasNext() )
+                    {
+                        changeFile = (ChangeFile) iterFiles.next();
+
+                        if ( !"unknown".equalsIgnoreCase( changeFile.getStatus() ) )
+                        {
+                            allChangesUnknown = false;
+                            break;
+                        }
+                    }
+
+                    if ( !allChangesUnknown )
+                    {
+                        break;
+                    }
+                }
+
+                if ( allChangesUnknown )
+                {
+
+                    getLogger().info( "The project was not built because all changes are
unknown." );
+
+                    project.setState( project.getOldState() );
+
+                    project.setOldState( 0 );
+
+                    store.updateProject( project );
+
+                    return;
+
+                }
+
                 actionManager.lookup( "update-project-from-working-directory" ).execute(
actionContext );
 
                 actionManager.lookup( "execute-builder" ).execute( actionContext );
@@ -261,10 +320,9 @@
                 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 )
+            if ( project.getState() != ContinuumProjectState.NEW && project.getState()
!= ContinuumProjectState.OK &&
+                project.getState() != ContinuumProjectState.FAILED &&
+                project.getState() != ContinuumProjectState.ERROR )
             {
                 try
                 {

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java?rev=370565&r1=370564&r2=370565&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java
Thu Jan 19 10:32:29 2006
@@ -327,6 +327,8 @@
 
                 // TODO: revision?
 
+                file.setStatus(scmFile.getStatus().toString());
+
                 changeSet.addFile( file );
             }
         }

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=370565&r1=370564&r2=370565&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-model/src/main/mdo/continuum.mdo (original)
+++ maven/continuum/trunk/continuum-model/src/main/mdo/continuum.mdo Thu Jan 19 10:32:29 2006
@@ -533,6 +533,11 @@
           <version>1.0.0+</version>
           <type>String</type>
         </field>
+        <field>
+          <name>status</name>
+          <version>1.0.0+</version>
+          <type>String</type>
+        </field>
       </fields>
     </class>
 



Mime
View raw message