continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r572384 - in /maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum: core/action/ scm/
Date Mon, 03 Sep 2007 16:30:52 GMT
Author: evenisse
Date: Mon Sep  3 09:30:51 2007
New Revision: 572384

URL: http://svn.apache.org/viewvc?rev=572384&view=rev
Log:
[CONTINUUM-1218] Set the relative path to the project directory when the scm returns one like
Clearcase

Modified:
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.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/UpdateWorkingDirectoryFromScmContinuumAction.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/ContinuumScm.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java?rev=572384&r1=572383&r2=572384&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java
Mon Sep  3 09:30:51 2007
@@ -71,6 +71,8 @@
 
     public static final String KEY_FIRST_RUN = "first-run";
 
+    public static final String KEY_PROJECT_RELATIVE_PATH = "project-relative-path";
+
     // ----------------------------------------------------------------------
     // Utils
     // ----------------------------------------------------------------------

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java?rev=572384&r1=572383&r2=572384&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 Sep  3 09:30:51 2007
@@ -19,14 +19,18 @@
  * under the License.
  */
 
+import org.apache.maven.continuum.Continuum;
+import org.apache.maven.continuum.model.project.BuildDefinition;
 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.scm.ContinuumScmException;
 import org.apache.maven.continuum.store.ContinuumStore;
 import org.apache.maven.continuum.utils.ContinuumUtils;
 import org.apache.maven.scm.manager.NoSuchScmProviderException;
+import org.codehaus.plexus.util.StringUtils;
 
 import java.io.File;
 import java.util.Map;
@@ -43,6 +47,11 @@
     /**
      * @plexus.requirement
      */
+    private ContinuumNotificationDispatcher notifier;
+
+    /**
+     * @plexus.requirement
+     */
     private ContinuumScm scm;
 
     /**
@@ -50,11 +59,20 @@
      */
     private ContinuumStore store;
 
+    /**
+     * @plexus.requirement
+     */
+    private Continuum continuum;
+
     public void execute( Map context )
         throws Exception
     {
         Project project = getProject( context );
 
+        int oldState = project.getState();
+
+        BuildDefinition buildDefinition = getBuildDefinition( context );
+
         project.setState( ContinuumProjectState.CHECKING_OUT );
 
         store.updateProject( project );
@@ -69,7 +87,7 @@
 
         try
         {
-            result = scm.checkOut( project, workingDirectory );
+            result = scm.checkOut( project, workingDirectory, context );
             //CONTINUUM-1394
             result.setChanges( null );
         }
@@ -110,9 +128,22 @@
         }
         finally
         {
+            if ( oldState == ContinuumProjectState.NEW )
+            {
+                String relativePath = (String) getObject( context, KEY_PROJECT_RELATIVE_PATH,
"" );
+                if ( StringUtils.isNotEmpty( relativePath ) )
+                {
+                    //CONTINUUM-1218 : updating only the default build definition only for
new projects
+                    BuildDefinition bd = continuum.getDefaultBuildDefinition( project.getId()
);
+                    bd.setBuildFile( relativePath + "/" + "pom.xml" );
+                    store.storeBuildDefinition( bd );
+                }
+            }
             project.setState( ContinuumProjectState.CHECKEDOUT );
 
             store.updateProject( project );
+
+            notifier.checkoutComplete( project, buildDefinition );
         }
 
         context.put( KEY_CHECKOUT_SCM_RESULT, result );

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java?rev=572384&r1=572383&r2=572384&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 Sep  3 09:30:51 2007
@@ -72,7 +72,7 @@
         {
             notifier.checkoutStarted( project, buildDefinition );
 
-            scmResult = scm.updateProject( project );
+            scmResult = scm.updateProject( project, context );
 
             context.put( KEY_UPDATE_SCM_RESULT, scmResult );
         }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/ContinuumScm.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/ContinuumScm.java?rev=572384&r1=572383&r2=572384&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/ContinuumScm.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/ContinuumScm.java
Mon Sep  3 09:30:51 2007
@@ -23,6 +23,7 @@
 import org.apache.maven.continuum.model.scm.ScmResult;
 
 import java.io.File;
+import java.util.Map;
 
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
@@ -32,12 +33,12 @@
 {
     String ROLE = ContinuumScm.class.getName();
 
-    ScmResult checkOut( Project project, File workingDirectory )
+    ScmResult checkOut( Project project, File workingDirectory, Map context )
         throws ContinuumScmException;
 
-    ScmResult checkOutProject( Project project )
+    ScmResult checkOutProject( Project project, Map context )
         throws ContinuumScmException;
 
-    ScmResult updateProject( Project project )
+    ScmResult updateProject( Project project, Map context )
         throws ContinuumScmException;
 }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java?rev=572384&r1=572383&r2=572384&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
Mon Sep  3 09:30:51 2007
@@ -45,6 +45,7 @@
 import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 import java.util.Properties;
 
 /**
@@ -79,7 +80,7 @@
     // ContinuumScm implementation
     // ----------------------------------------------------------------------
 
-    public ScmResult checkOut( Project project, File workingDirectory )
+    public ScmResult checkOut( Project project, File workingDirectory, Map context )
         throws ContinuumScmException
     {
         String tag = project.getScmTag();
@@ -131,8 +132,15 @@
 
                 ScmFileSet fileSet = new ScmFileSet( workingDirectory );
 
-                result = convertScmResult(
-                    scmManager.getProviderByRepository( repository ).checkOut( repository,
fileSet, tag ) );
+                CheckOutScmResult res =
+                    scmManager.getProviderByRepository( repository ).checkOut( repository,
fileSet, tag );
+
+                if ( StringUtils.isNotEmpty( res.getRelativePathProjectDirectory() ) )
+                {
+                    context.put( "pomRelativePath", res.getRelativePathProjectDirectory()
);
+                }
+
+                result = convertScmResult( res );
             }
 
             if ( !result.isSuccess() )
@@ -174,7 +182,7 @@
      * @param project The project to check out.
      * @throws ContinuumScmException Thrown in case of a exception while checking out the
sources.
      */
-    public ScmResult checkOutProject( Project project )
+    public ScmResult checkOutProject( Project project, Map context )
         throws ContinuumScmException
     {
         File workingDirectory = workingDirectoryService.getWorkingDirectory( project );
@@ -185,10 +193,10 @@
                 project.getName() + "', id: '" + project.getId() + "'." );
         }
 
-        return checkOut( project, workingDirectory );
+        return checkOut( project, workingDirectory, context );
     }
 
-    public ScmResult updateProject( Project project )
+    public ScmResult updateProject( Project project, Map context )
         throws ContinuumScmException
     {
         String tag = project.getScmTag();



Mime
View raw message