jvanzyl 2004/06/15 19:51:37
Modified: maven-core/src/main/java/org/apache/maven/plugin
DefaultPluginManager.java
maven-plugin/src/main/java/org/apache/maven/plugin/generator
PluginDescriptorGenerator.java
maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin
CompilerMojo.java TestCompilerMojo.java
maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin
JellyGeneratorMojo.java
maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources
TestResourcesMojo.java
maven-plugins/maven-surefire-plugin/src/main/java/org/apache/maven/test
SurefirePlugin.java
Log:
o Ok, this set of changes has been tested against the integration tests in
maven-core-it and it is now a requirement that the integration tests be
done before checking in any changes. They are not super rigourous but
they do test the minimal functionality of compiling, processing resources
and testing.
I'm going to make another release this week and things should now be
in a stable enough form to actually use m2 for the basics.
Revision Changes Path
1.4 +22 -89 maven-components/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
Index: DefaultPluginManager.java
===================================================================
RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DefaultPluginManager.java 15 Jun 2004 19:24:10 -0000 1.3
+++ DefaultPluginManager.java 16 Jun 2004 02:51:37 -0000 1.4
@@ -21,7 +21,6 @@
import org.apache.maven.plugin.descriptor.Parameter;
import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder;
import org.apache.maven.project.MavenProject;
-import org.apache.maven.script.GoalDecorator;
import org.codehaus.plexus.PlexusConstants;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.discovery.ComponentDiscoveryEvent;
@@ -39,7 +38,6 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Stack;
public class DefaultPluginManager
extends AbstractLogEnabled
@@ -82,99 +80,32 @@
List goals = TopologicalSorter.sort( dag.getVertex( goalToAttain ) );
- PluginExecutionResponse response = new PluginExecutionResponse();
-
int goalIndex = goals.indexOf( goalToAttain );
List goalList = goals.subList( 0, goalIndex + 1 );
- Stack execStack = new Stack();
-
- for ( Iterator it = goalList.iterator(); it.hasNext(); )
- {
- execStack.push( it.next() );
- }
-
- attainGoalStack( context, execStack, response );
+ PluginExecutionResponse response = new PluginExecutionResponse();
- return response;
- }
+ PluginExecutionRequest request;
- /**
- * The presumption is that a goal and all of its prerequisites are considered to be
an atomic
- * whole. Therefore, execution should proceed in the manner:
- * preGoals, prereqs, goal, postGoals
- *
- * @param goals The stack of goals to execute, in reverse-dependency ordering. This
allows
- * us easier access to the pregoals before we execute the prerequisites.
- * @param response The execution response to send through the pre-goal, post-goal,
prereq, and
- * actual goal executions.
- */
- private void attainGoalStack( MavenLifecycleContext context, Stack goals, PluginExecutionResponse
response )
- {
- if ( !goals.isEmpty() )
+ for ( Iterator it = goalList.iterator(); it.hasNext(); )
{
- String goalName = (String) goals.pop();
-
- String goal = context.getGoal().getName();
-
- context.setGoal( getGoalDescriptor( goalName ) );
-
- System.out.println( "[" + goal + "]" );
-
- Goal goalDescriptor = getGoalDescriptor( goal );
-
- PluginExecutionRequest request = new PluginExecutionRequest( createParameters(
goalDescriptor, context.getProject() ) );
-
- request.addContextValue( "id", getPluginDescriptor( goal ).getId() );
+ String goalName = (String) it.next();
- if ( context.getScript() != null )
- {
- List preGoals = context.getScript().getPreGoals( goal );
-
- for ( Iterator it = preGoals.iterator(); it.hasNext(); )
- {
- GoalDecorator preGoal = (GoalDecorator) it.next();
+ Goal goal = getGoalDescriptor( goalName );
- preGoal.execute( request, response );
+ //if ( goal == null ) continue;
- if ( response.exceptionOccurred() )
- {
- break;
- }
- }
- }
+ System.out.println( "[" + goal.getName() + "]" );
- if ( !response.exceptionOccurred() )
- {
- attainGoalStack( context, goals, response );
- }
-
- if ( !response.exceptionOccurred() )
- {
- attainGoal( request, response );
- }
+ request = new PluginExecutionRequest( createParameters( goal, context.getProject()
) );
- if ( !response.exceptionOccurred() )
- {
- if ( context.getScript() != null )
- {
- List postGoals = context.getScript().getPostGoals( goal );
+ request.addContextValue( "id", getPluginDescriptor( goal.getName() ).getId()
);
- for ( Iterator it = postGoals.iterator(); it.hasNext(); )
- {
- GoalDecorator postGoal = (GoalDecorator) it.next();
-
- postGoal.execute( request, response );
-
- if ( response.exceptionOccurred() )
- {
- break;
- }
- }
- }
- }
+ attainGoal( request, response );
}
+
+ return response;
}
public void attainGoal( PluginExecutionRequest request, PluginExecutionResponse response
)
@@ -265,23 +196,25 @@
for ( Iterator j = goals.iterator(); j.hasNext(); )
{
- Goal goalDescriptor = (Goal) j.next();
+ Goal goal = (Goal) j.next();
- if ( goalDescriptor.getPrereqs() != null )
- {
- for ( Iterator k = goalDescriptor.getPrereqs().iterator(); k.hasNext();
)
+ if ( goal.getPrereqs() != null )
+ {
+ for ( Iterator k = goal.getPrereqs().iterator(); k.hasNext(); )
{
- dag.addEdge( goalDescriptor.getName(), (String) k.next() );
+ String prereq = (String) k.next();
+
+ dag.addEdge( goal.getName(), prereq );
}
}
else
{
- dag.addVertex( goalDescriptor.getName() );
+ dag.addVertex( goal.getName() );
}
- goalDescriptors.put( goalDescriptor.getName(), goalDescriptor );
+ goalDescriptors.put( goal.getName(), goal );
- goalToPluginMap.put( goalDescriptor.getName(), pluginDescriptor );
+ goalToPluginMap.put( goal.getName(), pluginDescriptor );
}
pluginDescriptors.put( pluginDescriptor.getId(), pluginDescriptor );
1.11 +2 -0 maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/generator/PluginDescriptorGenerator.java
Index: PluginDescriptorGenerator.java
===================================================================
RCS file: /home/cvs/maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/generator/PluginDescriptorGenerator.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- PluginDescriptorGenerator.java 15 Jun 2004 04:07:17 -0000 1.10
+++ PluginDescriptorGenerator.java 16 Jun 2004 02:51:37 -0000 1.11
@@ -105,6 +105,8 @@
w.startElement( "parameters" );
+ System.out.println( "parameters.size() = " + parameters.size() );
+
for ( int j = 0; j < parameters.size(); j++ )
{
Parameter parameter = (Parameter) parameters.get( j );
1.5 +2 -2 maven-components/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/CompilerMojo.java
Index: CompilerMojo.java
===================================================================
RCS file: /home/cvs/maven-components/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/CompilerMojo.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- CompilerMojo.java 15 Jun 2004 04:07:57 -0000 1.4
+++ CompilerMojo.java 16 Jun 2004 02:51:37 -0000 1.5
@@ -11,7 +11,7 @@
/**
* @goal compile
*
- * @requiresDependencyResolution
+ * @requiresDependencyResolutionXX
*
* @description Compiles application sources
*
1.4 +2 -2 maven-components/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/TestCompilerMojo.java
Index: TestCompilerMojo.java
===================================================================
RCS file: /home/cvs/maven-components/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/TestCompilerMojo.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TestCompilerMojo.java 15 Jun 2004 04:34:31 -0000 1.3
+++ TestCompilerMojo.java 16 Jun 2004 02:51:37 -0000 1.4
@@ -9,7 +9,7 @@
import java.util.List;
/**
- * @goal test:compile
+ * @goal testCompile
*
* @description Compiles test sources
*
1.2 +4 -4 maven-components/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/JellyGeneratorMojo.java
Index: JellyGeneratorMojo.java
===================================================================
RCS file: /home/cvs/maven-components/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/JellyGeneratorMojo.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JellyGeneratorMojo.java 15 Jun 2004 05:27:03 -0000 1.1
+++ JellyGeneratorMojo.java 16 Jun 2004 02:51:37 -0000 1.2
@@ -13,21 +13,21 @@
* required="true"
* validator=""
* expression="#project.build.sourceDirectory"
- * description=""
+ * description="x"
* @parameter
* name="outputDirectory"
* type="String"
* required="true"
* validator=""
* expression="#project.build.output
- * description=""
+ * description="x"
* @parameter
* name="pom"
* type="String"
* required="true"
* validator=""
* expression="#project.getFile().getPath()"
- * description=""
+ * description="x"
*
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @version $Id$
1.5 +2 -2 maven-components/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources/TestResourcesMojo.java
Index: TestResourcesMojo.java
===================================================================
RCS file: /home/cvs/maven-components/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources/TestResourcesMojo.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TestResourcesMojo.java 14 Jun 2004 23:22:47 -0000 1.4
+++ TestResourcesMojo.java 16 Jun 2004 02:51:37 -0000 1.5
@@ -29,7 +29,7 @@
import java.util.List;
/**
- * @goal test:resources
+ * @goal testResources
*
* @description copy test resources
*
1.9 +3 -3 maven-components/maven-plugins/maven-surefire-plugin/src/main/java/org/apache/maven/test/SurefirePlugin.java
Index: SurefirePlugin.java
===================================================================
RCS file: /home/cvs/maven-components/maven-plugins/maven-surefire-plugin/src/main/java/org/apache/maven/test/SurefirePlugin.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- SurefirePlugin.java 14 Jun 2004 20:47:08 -0000 1.8
+++ SurefirePlugin.java 16 Jun 2004 02:51:37 -0000 1.9
@@ -14,9 +14,9 @@
* @description Run tests using surefire
*
* @prereq compiler:compile
- * @prereq compiler:test:compile
+ * @prereq compiler:testCompile
* @prereq resources:resources
- * @prereq resources:test:resources
+ * @prereq resources:testResources
*
* @parameter
* name="mavenRepoLocal"
|