continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From epunza...@apache.org
Subject svn commit: r501366 - in /maven/continuum/trunk/continuum-release/src/main: java/org/apache/maven/continuum/release/executors/ java/org/apache/maven/continuum/release/phase/ resources/META-INF/plexus/
Date Tue, 30 Jan 2007 11:05:10 GMT
Author: epunzalan
Date: Tue Jan 30 03:05:05 2007
New Revision: 501366

URL: http://svn.apache.org/viewvc?view=rev&rev=501366
Log:
[CONTINUUM-1149]

- do an scm update prior to release:prepare
- improved the release progress reporting by introducing generate-reactor-projects phase (a
todo for release:perform bec it doesn't use the phases list still)

Added:
    maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/phase/
    maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/phase/GenerateReactorProjectsPhase.java
  (with props)
    maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/phase/UpdateWorkingCopyPhase.java
  (with props)
Modified:
    maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/AbstractReleaseTaskExecutor.java
    maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PerformReleaseTaskExecutor.java
    maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutor.java
    maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/RollbackReleaseTaskExecutor.java
    maven/continuum/trunk/continuum-release/src/main/resources/META-INF/plexus/components.xml

Modified: maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/AbstractReleaseTaskExecutor.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/AbstractReleaseTaskExecutor.java?view=diff&rev=501366&r1=501365&r2=501366
==============================================================================
--- maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/AbstractReleaseTaskExecutor.java
(original)
+++ maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/AbstractReleaseTaskExecutor.java
Tue Jan 30 03:05:05 2007
@@ -19,47 +19,24 @@
  * under the License.
  */
 
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.DefaultArtifactRepository;
-import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
-import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
-import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 import org.apache.maven.continuum.release.ContinuumReleaseException;
 import org.apache.maven.continuum.release.ContinuumReleaseManager;
 import org.apache.maven.continuum.release.tasks.ReleaseProjectTask;
-import org.apache.maven.profiles.DefaultProfileManager;
-import org.apache.maven.profiles.ProfileManager;
-import org.apache.maven.project.DuplicateProjectException;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.MavenProjectBuilder;
-import org.apache.maven.project.ProjectBuildingException;
-import org.apache.maven.project.ProjectSorter;
 import org.apache.maven.settings.MavenSettingsBuilder;
 import org.apache.maven.settings.Settings;
 import org.apache.maven.shared.release.ReleaseManager;
 import org.apache.maven.shared.release.ReleaseResult;
-import org.apache.maven.shared.release.config.ReleaseDescriptor;
-import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusContainer;
-import org.codehaus.plexus.context.Context;
-import org.codehaus.plexus.context.ContextException;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
 import org.codehaus.plexus.taskqueue.Task;
 import org.codehaus.plexus.taskqueue.execution.TaskExecutionException;
-import org.codehaus.plexus.util.dag.CycleDetectedException;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
-import java.io.File;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
 
 /**
  * @author Edwin Punzalan
  */
 public abstract class AbstractReleaseTaskExecutor
-    implements ReleaseTaskExecutor, Contextualizable
+    implements ReleaseTaskExecutor
 {
     /**
      * @plexus.requirement
@@ -69,27 +46,13 @@
     /**
      * @plexus.requirement
      */
-    protected ReleaseManager releasePluginManager;
-
-    /**
-     * @plexus.requirement
-     */
-    private MavenProjectBuilder projectBuilder;
+    protected ReleaseManager releaseManager;
 
     /**
      * @plexus.requirement
      */
     private MavenSettingsBuilder settingsBuilder;
 
-    /**
-     * @plexus.configuration
-     */
-    private String localRepository;
-
-    private ProfileManager profileManager;
-
-    private PlexusContainer container;
-
     protected Settings settings;
 
     private long startTime;
@@ -132,91 +95,6 @@
     protected abstract void execute( ReleaseProjectTask releaseTask )
         throws TaskExecutionException;
 
-    protected List getReactorProjects( ReleaseProjectTask releaseTask )
-        throws TaskExecutionException
-    {
-        List reactorProjects;
-        try
-        {
-            reactorProjects = getReactorProjects( releaseTask.getDescriptor() );
-        }
-        catch ( ContinuumReleaseException e )
-        {
-            ReleaseResult result = createReleaseResult();
-
-            result.appendError( e );
-
-            continuumReleaseManager.getReleaseResults().put( releaseTask.getReleaseId(),
result );
-
-            releaseTask.getListener().error( e.getMessage() );
-
-            throw new TaskExecutionException( "Failed to build reactor projects.", e );
-        }
-
-        return reactorProjects;
-    }
-
-    protected List getReactorProjects( ReleaseDescriptor descriptor )
-        throws ContinuumReleaseException
-    {
-        List reactorProjects = new ArrayList();
-
-        MavenProject project;
-        try
-        {
-            project = projectBuilder.buildWithDependencies( getProjectDescriptorFile( descriptor
),
-                                            getLocalRepository(), getProfileManager( settings
) );
-
-            reactorProjects.add( project );
-        }
-        catch ( ProjectBuildingException e )
-        {
-            throw new ContinuumReleaseException( "Failed to build project.", e );
-        }
-        catch ( ArtifactNotFoundException e )
-        {
-            throw new ContinuumReleaseException( "Failed to build project.", e );
-        }
-        catch ( ArtifactResolutionException e )
-        {
-            throw new ContinuumReleaseException( "Failed to build project.", e );
-        }
-
-        for( Iterator modules = project.getModules().iterator(); modules.hasNext(); )
-        {
-            String moduleDir = modules.next().toString();
-
-            File pomFile = new File( project.getBasedir(), moduleDir + "/pom.xml" );
-
-            try
-            {
-                MavenProject reactorProject = projectBuilder.build( pomFile, getLocalRepository(),
-                                                                    getProfileManager( settings
) );
-
-                reactorProjects.add( reactorProject );
-            }
-            catch ( ProjectBuildingException e )
-            {
-                throw new ContinuumReleaseException( "Failed to build project.", e );
-            }
-        }
-
-        try
-        {
-            reactorProjects = new ProjectSorter( reactorProjects ).getSortedProjects();
-        }
-        catch ( CycleDetectedException e )
-        {
-            throw new ContinuumReleaseException( "Failed to sort projects.", e );
-        }
-        catch ( DuplicateProjectException e )
-        {
-            throw new ContinuumReleaseException( "Failed to sort projects.", e );
-        }
-
-        return reactorProjects;
-    }
-
     private Settings getSettings()
         throws ContinuumReleaseException
     {
@@ -234,41 +112,6 @@
         }
 
         return settings;
-    }
-
-    private File getProjectDescriptorFile( ReleaseDescriptor descriptor )
-    {
-        String parentPath = descriptor.getWorkingDirectory();
-
-        String pomFilename = descriptor.getPomFileName();
-        if ( pomFilename == null )
-        {
-            pomFilename = "pom.xml";
-        }
-
-        return new File( parentPath, pomFilename );
-    }
-
-    private ArtifactRepository getLocalRepository()
-    {
-        return new DefaultArtifactRepository( "local-repository", "file://" + localRepository,
-                                                                                   new DefaultRepositoryLayout()
);
-    }
-
-    private ProfileManager getProfileManager( Settings settings )
-    {
-        if ( profileManager == null )
-        {
-            profileManager = new DefaultProfileManager( container, settings );
-        }
-
-        return profileManager;
-    }
-
-    public void contextualize( Context context )
-        throws ContextException
-    {
-        container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
     }
 
     protected ReleaseResult createReleaseResult()

Modified: maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PerformReleaseTaskExecutor.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PerformReleaseTaskExecutor.java?view=diff&rev=501366&r1=501365&r2=501366
==============================================================================
--- maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PerformReleaseTaskExecutor.java
(original)
+++ maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PerformReleaseTaskExecutor.java
Tue Jan 30 03:05:05 2007
@@ -21,19 +21,59 @@
 
 import org.apache.maven.continuum.release.tasks.PerformReleaseProjectTask;
 import org.apache.maven.continuum.release.tasks.ReleaseProjectTask;
+import org.apache.maven.continuum.release.ContinuumReleaseException;
 import org.apache.maven.shared.release.ReleaseManagerListener;
 import org.apache.maven.shared.release.ReleaseResult;
 import org.apache.maven.shared.release.config.ReleaseDescriptor;
+import org.apache.maven.project.ProjectBuildingException;
+import org.apache.maven.project.ProjectSorter;
+import org.apache.maven.project.DuplicateProjectException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectBuilder;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.repository.DefaultArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
+import org.apache.maven.settings.Settings;
+import org.apache.maven.profiles.DefaultProfileManager;
+import org.apache.maven.profiles.ProfileManager;
 import org.codehaus.plexus.taskqueue.execution.TaskExecutionException;
+import org.codehaus.plexus.util.dag.CycleDetectedException;
+import org.codehaus.plexus.context.Context;
+import org.codehaus.plexus.context.ContextException;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.PlexusConstants;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
 
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Iterator;
+import java.io.File;
 
 /**
+ *
+ *
  * @author Edwin Punzalan
  */
 public class PerformReleaseTaskExecutor
     extends AbstractReleaseTaskExecutor
+    implements Contextualizable
 {
+    /**
+     * @plexus.requirement
+     */
+    private MavenProjectBuilder projectBuilder;
+
+    /**
+     * @plexus.configuration
+     */
+    private String localRepository;
+
+    private ProfileManager profileManager;
+
+    private PlexusContainer container;
+
     public void execute( ReleaseProjectTask task )
         throws TaskExecutionException
     {
@@ -46,7 +86,7 @@
         List reactorProjects = getReactorProjects( performTask );
 
         ReleaseResult result =
-            releasePluginManager.performWithResult( descriptor, settings, reactorProjects,
+            releaseManager.performWithResult( descriptor, settings, reactorProjects,
                                                     performTask.getBuildDirectory(), performTask.getGoals(),
                                                     performTask.isUseReleaseProfile(), listener
);
 
@@ -59,5 +99,129 @@
         }
 
         continuumReleaseManager.getReleaseResults().put( performTask.getReleaseId(), result
);
+    }
+
+    protected List getReactorProjects( ReleaseProjectTask releaseTask )
+        throws TaskExecutionException
+    {
+        List reactorProjects;
+        try
+        {
+            reactorProjects = getReactorProjects( releaseTask.getDescriptor() );
+        }
+        catch ( ContinuumReleaseException e )
+        {
+            ReleaseResult result = createReleaseResult();
+
+            result.appendError( e );
+
+            continuumReleaseManager.getReleaseResults().put( releaseTask.getReleaseId(),
result );
+
+            releaseTask.getListener().error( e.getMessage() );
+
+            throw new TaskExecutionException( "Failed to build reactor projects.", e );
+        }
+
+        return reactorProjects;
+    }
+
+    /**
+     * @todo remove and use generate-reactor-projects phase
+     */
+    protected List getReactorProjects( ReleaseDescriptor descriptor )
+        throws ContinuumReleaseException
+    {
+        List reactorProjects = new ArrayList();
+
+        MavenProject project;
+        try
+        {
+            project = projectBuilder.buildWithDependencies( getProjectDescriptorFile( descriptor
),
+                                            getLocalRepository(), getProfileManager( settings
) );
+
+            reactorProjects.add( project );
+        }
+        catch ( ProjectBuildingException e )
+        {
+            throw new ContinuumReleaseException( "Failed to build project.", e );
+        }
+        catch ( ArtifactNotFoundException e )
+        {
+            throw new ContinuumReleaseException( "Failed to build project.", e );
+        }
+        catch ( ArtifactResolutionException e )
+        {
+            throw new ContinuumReleaseException( "Failed to build project.", e );
+        }
+
+        for( Iterator modules = project.getModules().iterator(); modules.hasNext(); )
+        {
+            String moduleDir = modules.next().toString();
+
+            File pomFile = new File( project.getBasedir(), moduleDir + "/pom.xml" );
+
+            try
+            {
+                MavenProject reactorProject = projectBuilder.build( pomFile, getLocalRepository(),
+                                                                    getProfileManager( settings
) );
+
+                reactorProjects.add( reactorProject );
+            }
+            catch ( ProjectBuildingException e )
+            {
+                throw new ContinuumReleaseException( "Failed to build project.", e );
+            }
+        }
+
+        try
+        {
+            reactorProjects = new ProjectSorter( reactorProjects ).getSortedProjects();
+        }
+        catch ( CycleDetectedException e )
+        {
+            throw new ContinuumReleaseException( "Failed to sort projects.", e );
+        }
+        catch ( DuplicateProjectException e )
+        {
+            throw new ContinuumReleaseException( "Failed to sort projects.", e );
+        }
+
+        return reactorProjects;
+    }
+
+
+    private File getProjectDescriptorFile( ReleaseDescriptor descriptor )
+    {
+        String parentPath = descriptor.getWorkingDirectory();
+
+        String pomFilename = descriptor.getPomFileName();
+        if ( pomFilename == null )
+        {
+            pomFilename = "pom.xml";
+        }
+
+        return new File( parentPath, pomFilename );
+    }
+
+    private ArtifactRepository getLocalRepository()
+    {
+        return new DefaultArtifactRepository( "local-repository", "file://" + localRepository,
+                                                                                   new DefaultRepositoryLayout()
);
+    }
+
+    private ProfileManager getProfileManager( Settings settings )
+    {
+        if ( profileManager == null )
+        {
+            profileManager = new DefaultProfileManager( container, settings );
+        }
+
+        return profileManager;
+    }
+
+    public void contextualize( Context context )
+        throws ContextException
+    {
+        container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
     }
 }

Modified: maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutor.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutor.java?view=diff&rev=501366&r1=501365&r2=501366
==============================================================================
--- maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutor.java
(original)
+++ maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutor.java
Tue Jan 30 03:05:05 2007
@@ -25,7 +25,7 @@
 import org.apache.maven.shared.release.config.ReleaseDescriptor;
 import org.codehaus.plexus.taskqueue.execution.TaskExecutionException;
 
-import java.util.List;
+import java.util.ArrayList;
 
 /**
  * @author Edwin Punzalan
@@ -40,10 +40,8 @@
 
         ReleaseDescriptor descriptor = prepareTask.getDescriptor();
 
-        List reactorProjects = getReactorProjects( prepareTask );
-
-        ReleaseResult result = releasePluginManager.prepareWithResult( descriptor, settings,
reactorProjects,
-                                                                       false, false, prepareTask.getListener()
);
+        ReleaseResult result = releaseManager.prepareWithResult( descriptor, settings, new
ArrayList(),
+                                                                 false, false, prepareTask.getListener()
);
 
         //override to show the actual start time
         result.setStartTime( getStartTime() );

Modified: maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/RollbackReleaseTaskExecutor.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/RollbackReleaseTaskExecutor.java?view=diff&rev=501366&r1=501365&r2=501366
==============================================================================
--- maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/RollbackReleaseTaskExecutor.java
(original)
+++ maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/RollbackReleaseTaskExecutor.java
Tue Jan 30 03:05:05 2007
@@ -24,7 +24,7 @@
 import org.apache.maven.shared.release.ReleaseFailureException;
 import org.codehaus.plexus.taskqueue.execution.TaskExecutionException;
 
-import java.util.List;
+import java.util.ArrayList;
 
 /**
  * @author Edwin Punzalan
@@ -35,12 +35,10 @@
     protected void execute( ReleaseProjectTask releaseTask )
         throws TaskExecutionException
     {
-        List reactorProjects = getReactorProjects( releaseTask );
-
         try
         {
-            releasePluginManager.rollback( releaseTask.getDescriptor(), settings, reactorProjects,
-                                           releaseTask.getListener() );
+            releaseManager.rollback( releaseTask.getDescriptor(), settings,
+                                     new ArrayList(), releaseTask.getListener() );
         }
         catch ( ReleaseExecutionException e )
         {

Added: maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/phase/GenerateReactorProjectsPhase.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/phase/GenerateReactorProjectsPhase.java?view=auto&rev=501366
==============================================================================
--- maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/phase/GenerateReactorProjectsPhase.java
(added)
+++ maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/phase/GenerateReactorProjectsPhase.java
Tue Jan 30 03:05:05 2007
@@ -0,0 +1,205 @@
+package org.apache.maven.continuum.release.phase;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.shared.release.phase.AbstractReleasePhase;
+import org.apache.maven.shared.release.ReleaseResult;
+import org.apache.maven.shared.release.ReleaseExecutionException;
+import org.apache.maven.shared.release.ReleaseFailureException;
+import org.apache.maven.shared.release.config.ReleaseDescriptor;
+import org.apache.maven.settings.Settings;
+import org.apache.maven.settings.MavenSettingsBuilder;
+import org.apache.maven.continuum.release.ContinuumReleaseException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.ProjectBuildingException;
+import org.apache.maven.project.ProjectSorter;
+import org.apache.maven.project.DuplicateProjectException;
+import org.apache.maven.project.MavenProjectBuilder;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.DefaultArtifactRepository;
+import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
+import org.apache.maven.profiles.ProfileManager;
+import org.apache.maven.profiles.DefaultProfileManager;
+import org.codehaus.plexus.util.dag.CycleDetectedException;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.PlexusConstants;
+import org.codehaus.plexus.context.Context;
+import org.codehaus.plexus.context.ContextException;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Generate the reactor projects
+ *
+ * @author Edwin Punzalan
+ */
+public class GenerateReactorProjectsPhase
+    extends AbstractReleasePhase
+    implements Contextualizable
+{
+    private MavenProjectBuilder projectBuilder;
+
+    private MavenSettingsBuilder settingsBuilder;
+
+    private PlexusContainer container;
+
+    private String localRepository;
+
+    public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, Settings settings,
List reactorProjects )
+        throws ReleaseExecutionException, ReleaseFailureException
+    {
+        ReleaseResult result = new ReleaseResult();
+
+        try
+        {
+            reactorProjects.addAll( getReactorProjects( releaseDescriptor ) );
+        }
+        catch ( ContinuumReleaseException e )
+        {
+            throw new ReleaseExecutionException( "Unable to get reactor projects: " + e.getMessage(),
e );
+        }
+
+        result.setResultCode( ReleaseResult.SUCCESS );
+
+        return result;
+    }
+
+    public ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, Settings settings,
List reactorProjects )
+        throws ReleaseExecutionException, ReleaseFailureException
+    {
+        return execute( releaseDescriptor, settings, reactorProjects );
+    }
+
+    private List getReactorProjects( ReleaseDescriptor descriptor )
+        throws ContinuumReleaseException
+    {
+        List reactorProjects = new ArrayList();
+
+        MavenProject project;
+        try
+        {
+            project = projectBuilder.buildWithDependencies( getProjectDescriptorFile( descriptor
),
+                                            getLocalRepository(), getProfileManager( getSettings()
) );
+
+            reactorProjects.add( project );
+        }
+        catch ( ProjectBuildingException e )
+        {
+            throw new ContinuumReleaseException( "Failed to build project.", e );
+        }
+        catch ( ArtifactNotFoundException e )
+        {
+            throw new ContinuumReleaseException( "Failed to build project.", e );
+        }
+        catch ( ArtifactResolutionException e )
+        {
+            throw new ContinuumReleaseException( "Failed to build project.", e );
+        }
+
+        for( Iterator modules = project.getModules().iterator(); modules.hasNext(); )
+        {
+            String moduleDir = modules.next().toString();
+
+            File pomFile = new File( project.getBasedir(), moduleDir + "/pom.xml" );
+
+            try
+            {
+                MavenProject reactorProject = projectBuilder.build( pomFile, getLocalRepository(),
+                                                                    getProfileManager( getSettings()
) );
+
+                reactorProjects.add( reactorProject );
+            }
+            catch ( ProjectBuildingException e )
+            {
+                throw new ContinuumReleaseException( "Failed to build project.", e );
+            }
+        }
+
+        try
+        {
+            reactorProjects = new ProjectSorter( reactorProjects ).getSortedProjects();
+        }
+        catch ( CycleDetectedException e )
+        {
+            throw new ContinuumReleaseException( "Failed to sort projects.", e );
+        }
+        catch ( DuplicateProjectException e )
+        {
+            throw new ContinuumReleaseException( "Failed to sort projects.", e );
+        }
+
+        return reactorProjects;
+    }
+
+    private File getProjectDescriptorFile( ReleaseDescriptor descriptor )
+    {
+        String parentPath = descriptor.getWorkingDirectory();
+
+        String pomFilename = descriptor.getPomFileName();
+        if ( pomFilename == null )
+        {
+            pomFilename = "pom.xml";
+        }
+
+        return new File( parentPath, pomFilename );
+    }
+
+    private ArtifactRepository getLocalRepository()
+    {
+        return new DefaultArtifactRepository( "local-repository", "file://" + localRepository,
+                                                                                   new DefaultRepositoryLayout()
);
+    }
+
+    private ProfileManager getProfileManager( Settings settings )
+    {
+        return new DefaultProfileManager( container, settings );
+    }
+
+    private Settings getSettings()
+        throws ContinuumReleaseException
+    {
+        try
+        {
+            return settingsBuilder.buildSettings();
+        }
+        catch ( IOException e )
+        {
+            throw new ContinuumReleaseException( "Failed to get Maven Settings.", e );
+        }
+        catch ( XmlPullParserException e )
+        {
+            throw new ContinuumReleaseException( "Failed to get Maven Settings.", e );
+        }
+    }
+
+    public void contextualize( Context context )
+        throws ContextException
+    {
+        container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
+    }
+}

Propchange: maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/phase/GenerateReactorProjectsPhase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/phase/UpdateWorkingCopyPhase.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/phase/UpdateWorkingCopyPhase.java?view=auto&rev=501366
==============================================================================
--- maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/phase/UpdateWorkingCopyPhase.java
(added)
+++ maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/phase/UpdateWorkingCopyPhase.java
Tue Jan 30 03:05:05 2007
@@ -0,0 +1,121 @@
+package org.apache.maven.continuum.release.phase;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.shared.release.ReleaseResult;
+import org.apache.maven.shared.release.ReleaseExecutionException;
+import org.apache.maven.shared.release.ReleaseFailureException;
+import org.apache.maven.shared.release.phase.AbstractReleasePhase;
+import org.apache.maven.shared.release.scm.ScmRepositoryConfigurator;
+import org.apache.maven.shared.release.scm.ReleaseScmRepositoryException;
+import org.apache.maven.shared.release.scm.ReleaseScmCommandException;
+import org.apache.maven.shared.release.config.ReleaseDescriptor;
+import org.apache.maven.settings.Settings;
+import org.apache.maven.scm.repository.ScmRepository;
+import org.apache.maven.scm.repository.ScmRepositoryException;
+import org.apache.maven.scm.provider.ScmProvider;
+import org.apache.maven.scm.manager.NoSuchScmProviderException;
+import org.apache.maven.scm.ScmFileSet;
+import org.apache.maven.scm.ScmException;
+import org.apache.maven.scm.command.update.UpdateScmResult;
+
+import java.util.List;
+import java.io.File;
+
+/**
+ * Update working copy
+ *
+ * @author Edwin Punzalan
+ */
+public class UpdateWorkingCopyPhase
+    extends AbstractReleasePhase
+{
+    /**
+     * Tool that gets a configured SCM repository from release configuration.
+     */
+    private ScmRepositoryConfigurator scmRepositoryConfigurator;
+
+    private boolean copyUpdated = false;
+
+    public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, Settings settings,
List reactorProjects )
+        throws ReleaseExecutionException, ReleaseFailureException
+    {
+        ReleaseResult relResult = new ReleaseResult();
+
+        logInfo( relResult, "Updating local copy against the scm..." );
+
+        ScmRepository repository;
+        ScmProvider provider;
+        try
+        {
+            repository = scmRepositoryConfigurator.getConfiguredRepository( releaseDescriptor,
settings );
+
+            provider = scmRepositoryConfigurator.getRepositoryProvider( repository );
+        }
+        catch ( ScmRepositoryException e )
+        {
+            throw new ReleaseScmRepositoryException(
+                e.getMessage() + " for URL: " + releaseDescriptor.getScmSourceUrl(), e.getValidationMessages()
);
+        }
+        catch ( NoSuchScmProviderException e )
+        {
+            throw new ReleaseExecutionException( "Unable to configure SCM repository: " +
e.getMessage(), e );
+        }
+
+        UpdateScmResult result;
+        try
+        {
+            result = provider.update(
+                repository, new ScmFileSet( new File( releaseDescriptor.getWorkingDirectory()
) ), null );
+        }
+        catch ( ScmException e )
+        {
+            throw new ReleaseExecutionException( "An error occurred while updating your local
copy: "
+                + e.getMessage(), e );
+        }
+
+        if ( !result.isSuccess() )
+        {
+            throw new ReleaseScmCommandException( "Unable to update current working copy",
result );
+        }
+
+        copyUpdated = ( result.getUpdatedFiles().size() > 0 );
+
+        relResult.setResultCode( ReleaseResult.SUCCESS );
+
+        return relResult;
+    }
+
+    public ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, Settings settings,
List reactorProjects )
+        throws ReleaseExecutionException, ReleaseFailureException
+    {
+        return execute( releaseDescriptor, settings, reactorProjects );
+    }
+
+    public boolean isCopyUpdated()
+    {
+        return copyUpdated;
+    }
+
+    public void setCopyUpdated( boolean copyUpdated )
+    {
+        this.copyUpdated = copyUpdated;
+    }
+}

Propchange: maven/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/phase/UpdateWorkingCopyPhase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/continuum/trunk/continuum-release/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-release/src/main/resources/META-INF/plexus/components.xml?view=diff&rev=501366&r1=501365&r2=501366
==============================================================================
--- maven/continuum/trunk/continuum-release/src/main/resources/META-INF/plexus/components.xml
(original)
+++ maven/continuum/trunk/continuum-release/src/main/resources/META-INF/plexus/components.xml
Tue Jan 30 03:05:05 2007
@@ -77,17 +77,12 @@
         </requirement>
         <requirement>
           <role>org.apache.maven.shared.release.ReleaseManager</role>
-        </requirement>
-        <requirement>
-          <role>org.apache.maven.project.MavenProjectBuilder</role>
+          <role-hint>continuum</role-hint>
         </requirement>
         <requirement>
           <role>org.apache.maven.settings.MavenSettingsBuilder</role>
         </requirement>
       </requirements>
-      <configuration>
-        <local-repository>${plexus.home}/local-repository</local-repository>
-      </configuration>
     </component>
 
     <component>
@@ -140,6 +135,7 @@
         </requirement>
         <requirement>
           <role>org.apache.maven.shared.release.ReleaseManager</role>
+          <role-hint>continuum</role-hint>
         </requirement>
         <requirement>
           <role>org.apache.maven.project.MavenProjectBuilder</role>
@@ -203,17 +199,12 @@
         </requirement>
         <requirement>
           <role>org.apache.maven.shared.release.ReleaseManager</role>
-        </requirement>
-        <requirement>
-          <role>org.apache.maven.project.MavenProjectBuilder</role>
+          <role-hint>continuum</role-hint>
         </requirement>
         <requirement>
           <role>org.apache.maven.settings.MavenSettingsBuilder</role>
         </requirement>
       </requirements>
-      <configuration>
-        <local-repository>${plexus.home}/local-repository</local-repository>
-      </configuration>
     </component>
 
     <component>
@@ -232,6 +223,94 @@
       </requirements>
       <configuration>
         <name>rollback-release</name>
+      </configuration>
+    </component>
+
+    <!--
+     | Override Release Manager components
+     |-->
+    <component>
+      <role>org.apache.maven.shared.release.ReleaseManager</role>
+      <role-hint>continuum</role-hint>
+      <implementation>org.apache.maven.shared.release.DefaultReleaseManager</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.shared.release.phase.ReleasePhase</role>
+          <field-name>releasePhases</field-name>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.shared.release.config.ReleaseDescriptorStore</role>
+          <role-hint>properties</role-hint>
+          <field-name>configStore</field-name>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.shared.release.scm.ScmRepositoryConfigurator</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.shared.release.exec.MavenExecutor</role>
+        </requirement>
+      </requirements>
+      <configuration>
+        <preparePhases>
+          <phase>update-working-copy</phase>
+          <phase>generate-reactor-projects</phase>
+          <phase>check-poms</phase>
+          <phase>scm-check-modifications</phase>
+          <phase>check-dependency-snapshots</phase>
+          <phase>create-backup-poms</phase>
+          <phase>map-release-versions</phase>
+          <phase>input-variables</phase>
+          <phase>map-development-versions</phase>
+          <phase>rewrite-poms-for-release</phase>
+          <phase>generate-release-poms</phase>
+          <phase>run-preparation-goals</phase>
+          <phase>scm-commit-release</phase>
+          <phase>scm-tag</phase>
+          <phase>rewrite-poms-for-development</phase>
+          <phase>remove-release-poms</phase>
+          <phase>scm-commit-development</phase>
+          <phase>end-release</phase>
+        </preparePhases>
+        <performPhases>
+          <phase>verify-release-configuration</phase>
+          <phase>verify-completed-prepare-phases</phase>
+          <phase>configure-repositories</phase>
+          <phase>checkout-project-from-scm</phase>
+          <phase>build-project</phase>
+          <phase>cleanup</phase>
+        </performPhases>
+        <rollbackPhases>
+          <phase>generate-reactor-projects</phase>
+          <phase>restore-backup-poms</phase>
+          <phase>scm-commit-rollback</phase>
+          <phase>remove-scm-tag</phase>
+        </rollbackPhases>
+      </configuration>
+    </component>
+    <component>
+      <role>org.apache.maven.shared.release.phase.ReleasePhase</role>
+      <role-hint>update-working-copy</role-hint>
+      <implementation>org.apache.maven.continuum.release.phase.UpdateWorkingCopyPhase</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.shared.release.scm.ScmRepositoryConfigurator</role>
+        </requirement>
+      </requirements>
+    </component>
+    <component>
+      <role>org.apache.maven.shared.release.phase.ReleasePhase</role>
+      <role-hint>generate-reactor-projects</role-hint>
+      <implementation>org.apache.maven.continuum.release.phase.GenerateReactorProjectsPhase</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.project.MavenProjectBuilder</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.settings.MavenSettingsBuilder</role>
+        </requirement>
+      </requirements>
+      <configuration>
+        <local-repository>${plexus.home}/local-repository</local-repository>
       </configuration>
     </component>
 



Mime
View raw message