maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ifedore...@apache.org
Subject svn commit: r1061589 - in /maven/maven-3/trunk: maven-compat/src/test/java/org/apache/maven/project/ maven-core/src/main/java/org/apache/maven/lifecycle/ maven-core/src/main/java/org/apache/maven/lifecycle/internal/ maven-core/src/test/java/org/apache/...
Date Fri, 21 Jan 2011 00:52:21 GMT
Author: ifedorenko
Date: Fri Jan 21 00:52:20 2011
New Revision: 1061589

URL: http://svn.apache.org/viewvc?rev=1061589&view=rev
Log:
MNG-4988  API to calculate execution plan without full mojo execution configuration

Modified:
    maven/maven-3/trunk/maven-compat/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultSchedules.java
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutor.java
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleExecutionPlanCalculator.java
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTaskSegmentCalculator.java
    maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/LifecycleExecutionPlanCalculatorStub.java
    maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java

Modified: maven/maven-3/trunk/maven-compat/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-compat/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java?rev=1061589&r1=1061588&r2=1061589&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-compat/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java
(original)
+++ maven/maven-3/trunk/maven-compat/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java
Fri Jan 21 00:52:20 2011
@@ -25,7 +25,9 @@ import java.util.List;
 import java.util.Set;
 
 import org.apache.maven.execution.MavenSession;
-import org.apache.maven.lifecycle.*;
+import org.apache.maven.lifecycle.DefaultLifecycles;
+import org.apache.maven.lifecycle.LifecycleExecutor;
+import org.apache.maven.lifecycle.MavenExecutionPlan;
 import org.apache.maven.model.Plugin;
 import org.apache.maven.model.PluginExecution;
 import org.apache.maven.plugin.MojoExecution;
@@ -45,6 +47,11 @@ public class EmptyLifecycleExecutor
         return new MavenExecutionPlan( null, new DefaultLifecycles() );
     }
 
+    public MavenExecutionPlan calculateExecutionPlan( MavenSession session, boolean setup,
String... tasks )
+    {
+        return new MavenExecutionPlan( null, new DefaultLifecycles() );
+    }
+
     public void execute( MavenSession session )
     {
     }

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java?rev=1061589&r1=1061588&r2=1061589&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
(original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
Fri Jan 21 00:52:20 2011
@@ -42,6 +42,7 @@ import org.apache.maven.project.MavenPro
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.annotations.Requirement;
 
+import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -128,14 +129,14 @@ public class DefaultLifecycleExecutor
     // Used by m2eclipse
 
     @SuppressWarnings( { "UnusedDeclaration" } )
-    public MavenExecutionPlan calculateExecutionPlan( MavenSession session, String... tasks
)
+    public MavenExecutionPlan calculateExecutionPlan( MavenSession session, boolean setup,
String... tasks )
         throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
         MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
         PluginManagerException, LifecyclePhaseNotFoundException, LifecycleNotFoundException,
         PluginVersionResolutionException
     {
-
-        List<TaskSegment> taskSegments = lifecycleTaskSegmentCalculator.calculateTaskSegments(
session );
+        List<TaskSegment> taskSegments =
+            lifecycleTaskSegmentCalculator.calculateTaskSegments( session, Arrays.asList(
tasks ) );
 
         TaskSegment mergedSegment = new TaskSegment( false );
 
@@ -145,7 +146,16 @@ public class DefaultLifecycleExecutor
         }
 
         return lifecycleExecutionPlanCalculator.calculateExecutionPlan( session, session.getCurrentProject(),
-                                                                        mergedSegment.getTasks()
);
+                                                                        mergedSegment.getTasks(),
setup );
+    }
+
+    public MavenExecutionPlan calculateExecutionPlan( MavenSession session, String... tasks
)
+        throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+        MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
+        PluginManagerException, LifecyclePhaseNotFoundException, LifecycleNotFoundException,
+        PluginVersionResolutionException
+    {
+        return calculateExecutionPlan( session, true, tasks );
     }
 
     // Site 3.x

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultSchedules.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultSchedules.java?rev=1061589&r1=1061588&r2=1061589&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultSchedules.java
(original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultSchedules.java
Fri Jan 21 00:52:20 2011
@@ -54,7 +54,7 @@ public class DefaultSchedules
         List<ExecutionPlanItem> result = new ArrayList<ExecutionPlanItem>();
         for ( MojoExecution mojoExecution : executions )
         {
-            String lifeCyclePhase = mojoExecution.getMojoDescriptor().getPhase();
+            String lifeCyclePhase = mojoExecution.getLifecyclePhase();
             final Scheduling scheduling = getScheduling( "default" );
             Schedule schedule = null;
             if ( scheduling != null )

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutor.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutor.java?rev=1061589&r1=1061588&r2=1061589&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutor.java
(original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutor.java
Fri Jan 21 00:52:20 2011
@@ -71,6 +71,12 @@ public interface LifecycleExecutor
         PluginManagerException, LifecyclePhaseNotFoundException, LifecycleNotFoundException,
         PluginVersionResolutionException;
 
+    MavenExecutionPlan calculateExecutionPlan( MavenSession session, boolean setup, String...
tasks )
+        throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+        MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
+        PluginManagerException, LifecyclePhaseNotFoundException, LifecycleNotFoundException,
+        PluginVersionResolutionException;
+
     void execute( MavenSession session );
 
     // used by the site plugin 3.x

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java?rev=1061589&r1=1061588&r2=1061589&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java
(original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java
Fri Jan 21 00:52:20 2011
@@ -14,6 +14,16 @@
  */
 package org.apache.maven.lifecycle.internal;
 
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.lifecycle.DefaultLifecycles;
 import org.apache.maven.lifecycle.DefaultSchedules;
@@ -45,18 +55,6 @@ import org.codehaus.plexus.util.StringUt
 import org.codehaus.plexus.util.xml.Xpp3Dom;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.TreeSet;
-
 /**
  * @since 3.0
  * @author Benjamin Bentmann
@@ -104,7 +102,7 @@ public class DefaultLifecycleExecutionPl
         this.defaultSchedules = defaultSchedules;
     }
 
-    public MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenProject
project, List<Object> tasks )
+    public MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenProject
project, List<Object> tasks, boolean setup )
         throws PluginNotFoundException, PluginResolutionException, LifecyclePhaseNotFoundException,
         PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException,
         NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException
@@ -113,42 +111,61 @@ public class DefaultLifecycleExecutionPl
 
         final List<MojoExecution> executions = calculateMojoExecutions( session, project,
tasks );
 
-        setupMojoExections( session, project, executions );
+        if ( setup )
+        {
+            setupMojoExecutions( session, project, executions );
+        }
 
         final List<ExecutionPlanItem> planItem = defaultSchedules.createExecutionPlanItem(
project, executions );
 
         return new MavenExecutionPlan( planItem, defaultLifeCycles );
     }
 
-    private void setupMojoExections( MavenSession session, MavenProject project, List<MojoExecution>
mojoExecutions )
+    public MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenProject
project, List<Object> tasks )
+        throws PluginNotFoundException, PluginResolutionException, LifecyclePhaseNotFoundException,
+        PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException,
+        NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException
+    {
+        return calculateExecutionPlan( session, project, tasks, true );
+    }
+
+    private void setupMojoExecutions( MavenSession session, MavenProject project, List<MojoExecution>
mojoExecutions )
         throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
         MojoNotFoundException, InvalidPluginDescriptorException, NoPluginFoundForPrefixException,
         LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException
     {
         for ( MojoExecution mojoExecution : mojoExecutions )
         {
-            MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
+            setupMojoExecution( session, project, mojoExecution );
+        }
+    }
 
-            if ( mojoDescriptor == null )
-            {
-                mojoDescriptor =
-                    pluginManager.getMojoDescriptor( mojoExecution.getPlugin(), mojoExecution.getGoal(),
-                                                     project.getRemotePluginRepositories(),
-                                                     session.getRepositorySession() );
+    public void setupMojoExecution( MavenSession session, MavenProject project, MojoExecution
mojoExecution )
+        throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+        MojoNotFoundException, InvalidPluginDescriptorException, NoPluginFoundForPrefixException,
+        LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException
+    {
+        MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
 
-                mojoExecution.setMojoDescriptor( mojoDescriptor );
-            }
+        if ( mojoDescriptor == null )
+        {
+            mojoDescriptor =
+                pluginManager.getMojoDescriptor( mojoExecution.getPlugin(), mojoExecution.getGoal(),
+                                                 project.getRemotePluginRepositories(),
+                                                 session.getRepositorySession() );
 
-            populateMojoExecutionConfiguration( project, mojoExecution,
-                                                MojoExecution.Source.CLI.equals( mojoExecution.getSource()
) );
+            mojoExecution.setMojoDescriptor( mojoDescriptor );
+        }
 
-            finalizeMojoConfiguration( mojoExecution );
+        populateMojoExecutionConfiguration( project, mojoExecution,
+                                            MojoExecution.Source.CLI.equals( mojoExecution.getSource()
) );
 
-            calculateForkedExecutions( mojoExecution, session, project, new HashSet<MojoDescriptor>()
);
-        }
-    }
+        finalizeMojoConfiguration( mojoExecution );
 
-    private List<MojoExecution> calculateMojoExecutions( MavenSession session, MavenProject
project,
+        calculateForkedExecutions( mojoExecution, session, project, new HashSet<MojoDescriptor>()
);
+    }
+    
+    public List<MojoExecution> calculateMojoExecutions( MavenSession session, MavenProject
project,
                                                          List<Object> tasks )
         throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
         MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleExecutionPlanCalculator.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleExecutionPlanCalculator.java?rev=1061589&r1=1061588&r2=1061589&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleExecutionPlanCalculator.java
(original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleExecutionPlanCalculator.java
Fri Jan 21 00:52:20 2011
@@ -48,11 +48,20 @@ public interface LifecycleExecutionPlanC
         PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException,
         NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException;
 
+    MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenProject project,
List<Object> tasks,
+                                               boolean setup )
+        throws PluginNotFoundException, PluginResolutionException, LifecyclePhaseNotFoundException,
+        PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException,
+        NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException;
+
     void calculateForkedExecutions( MojoExecution mojoExecution, MavenSession session )
         throws MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
         PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
         LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException;
 
-
+    void setupMojoExecution( MavenSession session, MavenProject project, MojoExecution mojoExecution
)
+        throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+        MojoNotFoundException, InvalidPluginDescriptorException, NoPluginFoundForPrefixException,
+        LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException;
 
 }

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTaskSegmentCalculator.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTaskSegmentCalculator.java?rev=1061589&r1=1061588&r2=1061589&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTaskSegmentCalculator.java
(original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTaskSegmentCalculator.java
Fri Jan 21 00:52:20 2011
@@ -51,6 +51,11 @@ public interface LifecycleTaskSegmentCal
         MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
         PluginVersionResolutionException, LifecyclePhaseNotFoundException, LifecycleNotFoundException;
 
+    public List<TaskSegment> calculateTaskSegments( MavenSession session, List<String>
tasks )
+        throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+        MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
+        PluginVersionResolutionException;
+
     boolean requiresProject( MavenSession session );
 
 }

Modified: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/LifecycleExecutionPlanCalculatorStub.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/LifecycleExecutionPlanCalculatorStub.java?rev=1061589&r1=1061588&r2=1061589&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/LifecycleExecutionPlanCalculatorStub.java
(original)
+++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/LifecycleExecutionPlanCalculatorStub.java
Fri Jan 21 00:52:20 2011
@@ -111,7 +111,8 @@ public class LifecycleExecutionPlanCalcu
         // Maybe do something ?
     }
 
-    public MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenProject
project, List<Object> tasks )
+    public MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenProject
project, List<Object> tasks,
+                                                      boolean setup )
         throws PluginNotFoundException, PluginResolutionException, LifecyclePhaseNotFoundException,
         PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException,
         NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException
@@ -131,6 +132,21 @@ public class LifecycleExecutionPlanCalcu
         return createExecutionPlan( project, me );
     }
 
+    public MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenProject
project, List<Object> tasks )
+        throws PluginNotFoundException, PluginResolutionException, LifecyclePhaseNotFoundException,
+        PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException,
+        NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException
+    {
+        return calculateExecutionPlan( session, project, tasks, true );
+    }
+
+    public void setupMojoExecution( MavenSession session, MavenProject project, MojoExecution
mojoExecution )
+        throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+        MojoNotFoundException, InvalidPluginDescriptorException, NoPluginFoundForPrefixException,
+        LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException
+    {
+    }
+
     public static MavenExecutionPlan getProjectAExceutionPlan()
         throws PluginNotFoundException, PluginResolutionException, LifecyclePhaseNotFoundException,
         PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException,

Modified: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java?rev=1061589&r1=1061588&r2=1061589&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java
(original)
+++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java
Fri Jan 21 00:52:20 2011
@@ -46,6 +46,11 @@ public class EmptyLifecycleExecutor
         return new MavenExecutionPlan( null, null );
     }
 
+    public MavenExecutionPlan calculateExecutionPlan( MavenSession session, boolean setup,
String... tasks )
+    {
+        return new MavenExecutionPlan( null, null );
+    }
+    
     public void execute( MavenSession session )
     {
     }



Mime
View raw message