You are viewing a plain text version of this content. The canonical link for it is here.
Posted to m2-dev@maven.apache.org by jd...@apache.org on 2004/07/14 06:27:25 UTC

cvs commit: maven-components/maven-core/src/test/java/org/apache/maven/project ProjectBaseDirectoryAlignmentTest.java

jdcasey     2004/07/13 21:27:25

  Modified:    maven-plugin/src/main/java/org/apache/maven/plugin/generator
                        PluginDescriptorGenerator.java
                        AbstractGenerator.java
               maven-plugin/src/main/java/org/apache/maven/plugin/descriptor
                        MojoDescriptor.java
               maven-core/src/main/java/org/apache/maven/lifecycle
                        MavenLifecycleContext.java
               maven-core/src/main/java/org/apache/maven/lifecycle/phase
                        GoalDecorationPhase.java GoalResolutionPhase.java
               maven-core pom.xml
               maven-core/src/test/resources maven.xml
               maven-core/src/test/java/org/apache/maven/project
                        ProjectBaseDirectoryAlignmentTest.java
  Added:       maven-core/src/main/java/org/apache/maven/decoration
                        GoalDecorator.java DefaultGoalDecorator.java
                        GoalDecorationParser.java
                        GoalDecoratorBindings.java
  Removed:     maven-core/src/main/java/org/apache/maven/script/taglib
                        PreGoalTag.java MavenTag.java PostGoalTag.java
                        MavenScriptTagLibrary.java
                        AbstractGoalDecoratorTag.java
               maven-core/src/main/java/org/apache/maven/script
                        GoalDecorator.java DefaultGoalDecorator.java
                        MavenScript.java
  Log:
  o Added: GoalDecorator, DefaultGoalDecorator, GoalDecoratorBindings, GoalDecorationParser
  o Modified: GoalDecorationPhase, GoalResolutionPhase
  o Added logic to calculate pre- and post-goals for each goal in the original list from DAG
  
  Integration tests run, but no tests specifically target the goal decorations yet. Will add tests tomorrow.
  
  Revision  Changes    Path
  1.21      +10 -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.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- PluginDescriptorGenerator.java	27 Jun 2004 07:39:08 -0000	1.20
  +++ PluginDescriptorGenerator.java	14 Jul 2004 04:27:24 -0000	1.21
  @@ -113,6 +113,16 @@
           w.writeText( mojoDescriptor.getInstantiationStrategy() );
   
           w.endElement();
  +        
  +        // ----------------------------------------------------------------------
  +        // Strategy for handling repeated reference to mojo in 
  +        // the calculated (decorated, resolved) execution stack 
  +        // ----------------------------------------------------------------------
  +        w.startElement( "executionStrategy" );
  +        
  +        w.writeText( mojoDescriptor.getExecutionStrategy() );
  +        
  +        w.endElement();
   
           // ----------------------------------------------------------------------
           // Parameters
  
  
  
  1.18      +13 -0     maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/generator/AbstractGenerator.java
  
  Index: AbstractGenerator.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/generator/AbstractGenerator.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- AbstractGenerator.java	24 Jun 2004 16:36:16 -0000	1.17
  +++ AbstractGenerator.java	14 Jul 2004 04:27:24 -0000	1.18
  @@ -56,6 +56,8 @@
   
       public static final String GOAL_REQUIRES_DEPENDENCY_RESOLUTION = "requiresDependencyResolution";
   
  +    public static final String GOAL_SINGLE_EXECUTION_STRATEGY = "singleExecution";
  +
       protected abstract void processPluginDescriptors( MojoDescriptor[] pluginDescriptors, String destinationDirectory, Xpp3Dom pomDom )
           throws Exception;
   
  @@ -193,6 +195,17 @@
           if ( tag != null )
           {
               mojoDescriptor.setInstantiationStrategy( tag.getValue() );
  +        }
  +
  +        tag = javaClass.getTagByName( GOAL_SINGLE_EXECUTION_STRATEGY );
  +
  +        if ( tag != null )
  +        {
  +            mojoDescriptor.setExecutionStrategy( MojoDescriptor.SINGLE_PASS_EXEC_STRATEGY );
  +        }
  +        else
  +        {
  +            mojoDescriptor.setExecutionStrategy( MojoDescriptor.MULTI_PASS_EXEC_STRATEGY );
           }
   
           // ----------------------------------------------------------------------
  
  
  
  1.1                  maven-components/maven-core/src/main/java/org/apache/maven/decoration/GoalDecorator.java
  
  Index: GoalDecorator.java
  ===================================================================
  /* Created on Apr 5, 2004 */
  package org.apache.maven.decoration;
  
  import org.apache.maven.plugin.PluginExecutionRequest;
  import org.apache.maven.plugin.PluginExecutionResponse;
  
  /**
   * Represents a decorator which executes around the main execution of a goal, but which
   * fits outside the DAG, since it (a) cannot have prereqs, and (b) should decorate the execution
   * of all prereqs of the goal, to encapsulate the entire process.
   *
   * @author <a href="mailto:jdcasey@commonjava.org">John Casey</a>
   */
  public interface GoalDecorator
  {
  
      /** The goal to which this decorator is bound. */
      String getGoalToDecorate();
      
      /** The goal to execute when this decorator is triggered by execution of the bound goal target. 
       */
      String getDecoratorGoal();
      
      /** Whether to force the execution of the decorator goal. The default action is NOT to force 
       * decorator-goal execution...in other words, fire each goal once-and-only-once.
       */
      boolean forceExecute();
  }
  
  
  
  1.1                  maven-components/maven-core/src/main/java/org/apache/maven/decoration/DefaultGoalDecorator.java
  
  Index: DefaultGoalDecorator.java
  ===================================================================
  /* Created on Apr 6, 2004 */
  package org.apache.maven.decoration;
  
  import org.apache.maven.plugin.PluginExecutionRequest;
  import org.apache.maven.plugin.PluginExecutionResponse;
  
  import java.util.Map;
  
  /**
   * Default implementation of a goal decorator.
   *
   * @author <a href="mailto:jdcasey@commonjava.org">John Casey</a>
   */
  public class DefaultGoalDecorator implements GoalDecorator
  {
  
      private String goal;
      private String decoratorGoal;
      private boolean forceExecution = false;
  
      public DefaultGoalDecorator( String goal, String decoratorGoal )
      {
          this.goal = goal;
          this.decoratorGoal = decoratorGoal;
      }
  
      public String getGoalToDecorate()
      {
          return goal;
      }
  
      public String getDecoratorGoal()
      {
          return decoratorGoal;
      }
      
      public void forceExecute( boolean forceExecution ) {
          this.forceExecution = forceExecution;
      }
      
      public boolean forceExecute() {
          return forceExecution;
      }
      
      public String toString()
      {
          return "DefaultGoalDecorator[decorate: " + goal + 
          	" with: " + decoratorGoal + " and force? " + 
          	forceExecution + "]"; 
      }
  
  }
  
  
  
  1.1                  maven-components/maven-core/src/main/java/org/apache/maven/decoration/GoalDecorationParser.java
  
  Index: GoalDecorationParser.java
  ===================================================================
  /* Created on Jul 2, 2004 */
  package org.apache.maven.decoration;
  
  import java.io.IOException;
  import java.io.Reader;
  
  import org.xmlpull.v1.XmlPullParser;
  import org.xmlpull.v1.XmlPullParserException;
  import org.xmlpull.v1.XmlPullParserFactory;
  
  /**
   * @author jdcasey
   */
  public class GoalDecorationParser {
      
      public static final String ROOT_TAG = "project";
      public static final String DEFAULT_GOAL_ATTRIBUTE = "default";
      
      public static final String PREGOAL_TAG = "preGoal";
      public static final String POSTGOAL_TAG = "postGoal";
      
      public static final String NAME_ATTRIBUTE = "name";
      public static final String ATTAIN_ATTRIBUTE = "attain";
  
      public GoalDecorationParser() {
      }
      
      public GoalDecoratorBindings parse(Reader reader) throws XmlPullParserException, IOException {
          XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
          XmlPullParser parser = factory.newPullParser();
          
          parser.setInput(reader);
          
          GoalDecoratorBindings bindings = null;
          
          int eventType = parser.getEventType();
          while(eventType != XmlPullParser.END_DOCUMENT) {
              
              if(eventType == XmlPullParser.START_TAG) {
                  String tagName = parser.getName();
                  if(ROOT_TAG.equals(tagName)) {
                      bindings = new GoalDecoratorBindings();
                      
                      String defaultGoal = parser.getAttributeValue("", DEFAULT_GOAL_ATTRIBUTE);
                      if(defaultGoal != null && defaultGoal.length() > 0) {
                          bindings.setDefaultGoal(defaultGoal);
                      }
                  }
                  else if(PREGOAL_TAG.equals(tagName)) {
                      String name = parser.getAttributeValue("", NAME_ATTRIBUTE);
                      String attain = parser.getAttributeValue("", ATTAIN_ATTRIBUTE);
                      DefaultGoalDecorator decorator = new DefaultGoalDecorator(name, attain);
                      
                      bindings.addPreGoal(decorator);
                  }
                  else if(POSTGOAL_TAG.equals(tagName)) {
                      String name = parser.getAttributeValue("", NAME_ATTRIBUTE);
                      String attain = parser.getAttributeValue("", ATTAIN_ATTRIBUTE);
                      DefaultGoalDecorator decorator = new DefaultGoalDecorator(name, attain);
                      
                      bindings.addPostGoal(decorator);
                  }
                  else {
                      throw new IllegalArgumentException(tagName + " is not allowed.");
                  }
              }
              
              eventType = parser.next();
          }
          
          return bindings;
      }
  
  }
  
  
  
  1.1                  maven-components/maven-core/src/main/java/org/apache/maven/decoration/GoalDecoratorBindings.java
  
  Index: GoalDecoratorBindings.java
  ===================================================================
  /* Created on Apr 9, 2004 */
  package org.apache.maven.decoration;
  
  import java.util.ArrayList;
  import java.util.Collections;
  import java.util.HashMap;
  import java.util.List;
  import java.util.Map;
  
  /**
   * @author jdcasey
   */
  public class GoalDecoratorBindings
  {
  
      public static final String PARSE_CTX_KEY = "maven-script";
  
      private Map preGoals = new HashMap();
      private Map postGoals = new HashMap();
      private String defaultGoal = "jar";
  
      /**
       */
      public GoalDecoratorBindings()
      {
      }
  
      public void addPreGoal( GoalDecorator decorator )
      {
          addGoalDecorator( decorator, preGoals );
      }
  
      public void addPostGoal( GoalDecorator decorator )
      {
          addGoalDecorator( decorator, postGoals );
      }
  
      public List getPreGoals( String goal )
      {
          List result = (List) preGoals.get( goal );
          if ( result == null )
          {
              result = Collections.EMPTY_LIST;
          }
          
          return Collections.unmodifiableList( result );
      }
  
      public List getPostGoals( String goal )
      {
          List result = (List) postGoals.get( goal );
          if ( result == null )
          {
              result = Collections.EMPTY_LIST;
          }
          
          return Collections.unmodifiableList( result );
      }
  
      private void addGoalDecorator( GoalDecorator decorator, Map decoratorMap )
      {
          String goal = decorator.getGoalToDecorate();
  
          List decorators = (List) decoratorMap.get( goal );
          if ( decorators == null )
          {
              decorators = new ArrayList();
              decoratorMap.put( goal, decorators );
          }
  
          decorators.add( decorator );
      }
  
      /**
       * @param defGoal
       */
      public void setDefaultGoal( String defGoal )
      {
          this.defaultGoal = defGoal;
      }
  
      public String getDefaultGoal()
      {
          return defaultGoal;
      }
  
  }
  
  
  
  1.3       +13 -0     maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java
  
  Index: MojoDescriptor.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MojoDescriptor.java	21 Jun 2004 19:40:20 -0000	1.2
  +++ MojoDescriptor.java	14 Jul 2004 04:27:25 -0000	1.3
  @@ -25,6 +25,9 @@
   
   public class MojoDescriptor
   {
  +    public static final String SINGLE_PASS_EXEC_STRATEGY = "single-pass";
  +    public static final String MULTI_PASS_EXEC_STRATEGY = "multi-pass";
  +    
       private String implementation;
   
       private String description;
  @@ -36,6 +39,8 @@
       private Map parameterMap;
   
       private String instantiationStrategy = "singleton";
  +    
  +    private String executionStrategy = SINGLE_PASS_EXEC_STRATEGY;
   
       private String goal;
   
  @@ -179,5 +184,13 @@
       public void setGoal( String goal )
       {
           this.goal = goal;
  +    }
  +
  +    public String getExecutionStrategy() {
  +        return executionStrategy;
  +    }
  +
  +    public void setExecutionStrategy(String executionStrategy) {
  +        this.executionStrategy = executionStrategy;
       }
   }
  
  
  
  1.11      +40 -54    maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/MavenLifecycleContext.java
  
  Index: MavenLifecycleContext.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/MavenLifecycleContext.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- MavenLifecycleContext.java	27 Jun 2004 17:02:17 -0000	1.10
  +++ MavenLifecycleContext.java	14 Jul 2004 04:27:25 -0000	1.11
  @@ -1,5 +1,13 @@
   package org.apache.maven.lifecycle;
   
  +import org.apache.maven.decoration.GoalDecoratorBindings;
  +import org.apache.maven.plugin.FailureResponse;
  +import org.apache.maven.plugin.PluginManager;
  +import org.apache.maven.plugin.descriptor.MojoDescriptor;
  +import org.apache.maven.project.MavenProject;
  +import org.codehaus.plexus.PlexusContainer;
  +import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
  +
   /*
    * Copyright 2001-2004 The Apache Software Foundation.
    *
  @@ -15,19 +23,12 @@
    * See the License for the specific language governing permissions and
    * limitations under the License.
    */
  -
  +import java.util.Collections;
   import java.util.HashSet;
   import java.util.List;
  -import java.util.Set;
   
  -import org.apache.maven.plugin.FailureResponse;
  -import org.apache.maven.plugin.PluginManager;
  -import org.apache.maven.plugin.descriptor.MojoDescriptor;
  -import org.apache.maven.project.MavenProject;
  -import org.apache.maven.script.MavenScript;
  -
  -import org.codehaus.plexus.PlexusContainer;
  -import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
  +//import java.util.List;
  +import java.util.Set;
   
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  @@ -36,24 +37,17 @@
   public class MavenLifecycleContext
   {
       private String failedGoal;
  -
       private FailureResponse failureResponse;
  -
       private PlexusContainer container;
  -
       private MavenProject project;
  -
  -    private MavenScript script;
  -
       private MojoDescriptor mojoDescriptor;
  -
       private List resolvedGoals;
  -
       private PluginManager pluginManager;
  -
       private Set pluginDependencies;
  +    private GoalDecoratorBindings goalDecoratorBindings;
   
  -    public MavenLifecycleContext( PlexusContainer container, MavenProject project, MojoDescriptor goal )
  +    public MavenLifecycleContext( PlexusContainer container,
  +        MavenProject project, MojoDescriptor goal )
           throws Exception
       {
           this.container = container;
  @@ -62,15 +56,14 @@
   
           this.mojoDescriptor = goal;
   
  -        pluginManager = (PluginManager) lookup( PluginManager.ROLE );
  +        pluginManager = ( PluginManager ) lookup( PluginManager.ROLE );
   
  -        pluginDependencies = new HashSet();
  +        pluginDependencies = new HashSet(  );
       }
   
       // ----------------------------------------------------------------------
       // Provide an easy way to lookup plexus components
       // ----------------------------------------------------------------------
  -
       public Object lookup( String role )
           throws ComponentLookupException
       {
  @@ -83,7 +76,6 @@
           return container.lookup( role, roleHint );
       }
   
  -
       public void release( Object component )
       {
           if ( component != null )
  @@ -94,36 +86,33 @@
               }
               catch ( Exception e )
               {
  -                 //@todo what to do here?
  -            }    
  +                //@todo what to do here?
  +            }
           }
  -
       }
   
       // ----------------------------------------------------------------------
       //
       // ----------------------------------------------------------------------
  -
  -    public boolean requiresDependencyResolution()
  +    public boolean requiresDependencyResolution(  )
       {
  -        return mojoDescriptor.requiresDependencyResolution();
  +        return mojoDescriptor.requiresDependencyResolution(  );
       }
   
       // ----------------------------------------------------------------------
       //
       // ----------------------------------------------------------------------
  -
  -    public PlexusContainer getContainer()
  +    public PlexusContainer getContainer(  )
       {
           return container;
       }
   
  -    public MavenProject getProject()
  +    public MavenProject getProject(  )
       {
           return project;
       }
   
  -    public MojoDescriptor getMojoDescriptor()
  +    public MojoDescriptor getMojoDescriptor(  )
       {
           return mojoDescriptor;
       }
  @@ -133,21 +122,10 @@
           this.mojoDescriptor = mojoDescriptor;
       }
   
  -    public MavenScript getScript()
  -    {
  -        return script;
  -    }
  -
  -    public void setScript( MavenScript script )
  -    {
  -        this.script = script;
  -    }
  -
       // ----------------------------------------------------------------------
       // Resolved MojoDescriptors
       // ----------------------------------------------------------------------
  -
  -    public List getResolvedGoals()
  +    public List getResolvedGoals(  )
       {
           return resolvedGoals;
       }
  @@ -160,7 +138,6 @@
       // ----------------------------------------------------------------------
       // Delegation to the plugin manager
       // ----------------------------------------------------------------------
  -
       public MojoDescriptor getMojoDescriptor( String MojoDescriptorName )
       {
           return pluginManager.getMojoDescriptor( MojoDescriptorName );
  @@ -168,13 +145,12 @@
   
       public String getPluginId( MojoDescriptor mojoDescriptor )
       {
  -        return mojoDescriptor.getId();
  +        return mojoDescriptor.getId(  );
       }
   
       // ----------------------------------------------------------------------
       // Execution failure
       // ----------------------------------------------------------------------
  -
       public void setExecutionFailure( String failedGoal, FailureResponse response )
       {
           this.failedGoal = failedGoal;
  @@ -182,12 +158,12 @@
           this.failureResponse = response;
       }
   
  -    public boolean isExecutionFailure()
  +    public boolean isExecutionFailure(  )
       {
           return ( failedGoal != null );
       }
   
  -    public String getFailedGoal()
  +    public String getFailedGoal(  )
       {
           return failedGoal;
       }
  @@ -197,7 +173,7 @@
           this.failedGoal = failedGoal;
       }
   
  -    public FailureResponse getFailureResponse()
  +    public FailureResponse getFailureResponse(  )
       {
           return failureResponse;
       }
  @@ -207,7 +183,7 @@
           this.failureResponse = failureResponse;
       }
   
  -    public Set getPluginDependencies()
  +    public Set getPluginDependencies(  )
       {
           return pluginDependencies;
       }
  @@ -215,5 +191,15 @@
       public void setPluginDependencies( Set pluginDependencies )
       {
           this.pluginDependencies = pluginDependencies;
  +    }
  +
  +    public GoalDecoratorBindings getGoalDecoratorBindings(  )
  +    {
  +        return goalDecoratorBindings;
  +    }
  +
  +    public void setGoalDecoratorBindings( GoalDecoratorBindings goalDecoratorBindings )
  +    {
  +        this.goalDecoratorBindings = goalDecoratorBindings;
       }
   }
  
  
  
  1.3       +56 -30    maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/phase/GoalDecorationPhase.java
  
  Index: GoalDecorationPhase.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/phase/GoalDecorationPhase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- GoalDecorationPhase.java	24 Jun 2004 16:27:23 -0000	1.2
  +++ GoalDecorationPhase.java	14 Jul 2004 04:27:25 -0000	1.3
  @@ -1,5 +1,6 @@
   package org.apache.maven.lifecycle.phase;
   
  +
   /*
    * Copyright 2001-2004 The Apache Software Foundation.
    *
  @@ -15,63 +16,88 @@
    * See the License for the specific language governing permissions and
    * limitations under the License.
    */
  -
  +import org.apache.maven.decoration.GoalDecorationParser;
  +import org.apache.maven.decoration.GoalDecoratorBindings;
   import org.apache.maven.lifecycle.AbstractMavenLifecyclePhase;
   import org.apache.maven.lifecycle.MavenLifecycleContext;
   import org.apache.maven.project.MavenProject;
  -import org.apache.maven.script.MavenScript;
  -import org.apache.maven.script.taglib.MavenScriptTagLibrary;
  -import org.codehaus.marmalade.MarmaladeFBTaglibResolver;
  -import org.codehaus.tagalog.ParserConfiguration;
  -import org.codehaus.tagalog.TagalogParser;
  -import org.codehaus.tagalog.xpp.TagalogXmlPullParserFactory;
  +import org.xmlpull.v1.XmlPullParserException;
   
   import java.io.BufferedInputStream;
  +import java.io.BufferedReader;
   import java.io.File;
   import java.io.FileInputStream;
  +import java.io.FileNotFoundException;
  +import java.io.FileReader;
  +import java.io.IOException;
  +
  +import java.util.ArrayList;
  +import java.util.Iterator;
  +import java.util.List;
   
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
    * @author <a href="mailto:jdcasey@commonjava.org">John Casey</a>
    * @version $Id$
    */
  -public class GoalDecorationPhase
  -    extends AbstractMavenLifecyclePhase
  +public class GoalDecorationPhase extends AbstractMavenLifecyclePhase
   {
       public static final String MAVEN_XML_DEFAULT_NAMESPACE = "mavenxml";
  -
       public static final String MAVEN_SCRIPT = "maven.xml";
  +    private GoalDecoratorBindings decorators;
  +    private boolean decoratorsInitialized = false;
   
       public void execute( MavenLifecycleContext context )
           throws Exception
       {
  -        MavenProject project = context.getProject();
  -
  -        File pom = project.getFile();
  -
  -        File dir = pom.getParentFile();
  -
  -        File scriptFile = new File( dir, MAVEN_SCRIPT );
  -
  -        if ( scriptFile.exists() )
  +        synchronized ( this )
           {
  -            ParserConfiguration configuration = new ParserConfiguration( new MarmaladeFBTaglibResolver( "" ) );
  -
  -            configuration.setDefaultNamespace( MAVEN_XML_DEFAULT_NAMESPACE );
  +            if ( !decoratorsInitialized )
  +            {
  +                initializeDecorators( context );
  +            }
  +        }
   
  -            configuration.addTagLibrary( MAVEN_XML_DEFAULT_NAMESPACE, new MavenScriptTagLibrary() );
  +        context.setGoalDecoratorBindings(decorators);
  +    }
   
  -            BufferedInputStream stream = new BufferedInputStream( new FileInputStream( scriptFile ) );
  +    private void initializeDecorators( MavenLifecycleContext context )
  +        throws XmlPullParserException, IOException
  +    {
  +        MavenProject project = context.getProject(  );
   
  -            TagalogXmlPullParserFactory factory = new TagalogXmlPullParserFactory( configuration );
  +        File pom = project.getFile(  );
   
  -            TagalogParser parser = factory.createParser( stream );
  +        File dir = pom.getParentFile(  );
   
  -            MavenScript script = (MavenScript) parser.parse();
  +        File scriptFile = new File( dir, MAVEN_SCRIPT );
   
  -            context.setScript( script );
  +        if ( scriptFile.exists(  ) )
  +        {
  +            BufferedReader reader = null;
   
  -            stream.close();
  +            try
  +            {
  +                reader = new BufferedReader( new FileReader( scriptFile ) );
  +
  +                GoalDecorationParser parser = new GoalDecorationParser(  );
  +                this.decorators = parser.parse( reader );
  +            }
  +            finally
  +            {
  +                if ( reader != null )
  +                {
  +                    try
  +                    {
  +                        reader.close(  );
  +                    }
  +                    catch ( IOException e )
  +                    {
  +                    }
  +                }
  +            }
           }
  +        
  +        decoratorsInitialized = true;
       }
   }
  
  
  
  1.8       +108 -18   maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/phase/GoalResolutionPhase.java
  
  Index: GoalResolutionPhase.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/phase/GoalResolutionPhase.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- GoalResolutionPhase.java	2 Jul 2004 03:31:08 -0000	1.7
  +++ GoalResolutionPhase.java	14 Jul 2004 04:27:25 -0000	1.8
  @@ -1,5 +1,6 @@
   package org.apache.maven.lifecycle.phase;
   
  +
   /*
    * Copyright 2001-2004 The Apache Software Foundation.
    *
  @@ -15,19 +16,24 @@
    * See the License for the specific language governing permissions and
    * limitations under the License.
    */
  -
  +import org.apache.maven.decoration.GoalDecorator;
  +import org.apache.maven.decoration.GoalDecoratorBindings;
   import org.apache.maven.lifecycle.AbstractMavenLifecyclePhase;
   import org.apache.maven.lifecycle.MavenLifecycleContext;
   import org.apache.maven.plugin.PluginManager;
  +import org.apache.maven.plugin.descriptor.MojoDescriptor;
   
  +import java.util.ArrayList;
  +import java.util.HashSet;
  +import java.util.Iterator;
   import java.util.List;
  +import java.util.Set;
   
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
    * @version $Id$
    */
  -public class GoalResolutionPhase
  -    extends AbstractMavenLifecyclePhase
  +public class GoalResolutionPhase extends AbstractMavenLifecyclePhase
   {
       public void execute( MavenLifecycleContext context )
           throws Exception
  @@ -36,27 +42,111 @@
   
           try
           {
  -            // Here will will end up getting information about preGoals and postGoals and
  -            // the calculation here will get more sophisticated.
  -
  -            pluginManager = (PluginManager) context.getContainer().lookup( PluginManager.ROLE );
  +            pluginManager = ( PluginManager ) context.getContainer(  ).lookup( PluginManager.ROLE );
   
  -            List goals = pluginManager.getGoals( context.getMojoDescriptor().getId() );
  +            // First, start by retrieving the currently-requested goal.
  +            String goal = context.getMojoDescriptor(  ).getId(  );
   
  -            // Once we have the list of goals that the user has specified then we must process
  -            // this list and determine the decorations, then for each of the decorations we
  -            // must calculate the goal chain it produces. Then we mesh together all the graphs
  -            // and we can probably optimize.
  -            //
  -            // We will most likely have goals like "clean" which are executed regardless of whether
  -            // it has been executed or not and we may have goals for which duplicate execution can
  -            // be eliminated.
  +            // Initialize the set we'll use to track goals which have already
  +            // been included.
  +            Set includedGoals = new HashSet(  );
  +            
  +            // Retrieve the preGoals implied by this goal, with this goal appended
  +            // to the end of the list.
  +            List originalGoals = pluginManager.getGoals( goal );
  +            
  +            // Initialize the results list.
  +            List resolvedGoals = new ArrayList(  );
  +
  +            // Iterate over each goal (original and those implied by prereq's)
  +            for ( Iterator it = originalGoals.iterator(  ); it.hasNext(  ); )
  +            {
  +                String preReq = ( String ) it.next(  );
  +
  +                MojoDescriptor descriptor = context.getMojoDescriptor( preReq );
  +
  +                // If the mojo's execution strategy allows multiple execution, 
  +                // or if we haven't seen this mojo yet, "resolve" its goal
  +                // decorators.
  +                if ( MojoDescriptor.MULTI_PASS_EXEC_STRATEGY.equals( 
  +                        descriptor.getExecutionStrategy(  ) )
  +                    || !includedGoals.contains( descriptor ) )
  +                {
  +                    resolvedGoals.addAll( resolve( descriptor, context,
  +                            includedGoals ) );
  +                }
  +            }
   
  -            context.setResolvedGoals( goals );
  +            context.setResolvedGoals( resolvedGoals );
           }
           finally
           {
               context.release( pluginManager );
           }
  +    }
  +
  +    private List resolve( MojoDescriptor descriptor,
  +        MavenLifecycleContext context, Set includedGoals )
  +    {
  +        // Initialize results for this resolve call
  +        List result = new ArrayList(  );
  +
  +        String goal = descriptor.getId(  );
  +        GoalDecoratorBindings decorators = context.getGoalDecoratorBindings(  );
  +
  +        // If the decorator bindings are null, don't bother
  +        if ( decorators != null )
  +        {
  +            // Otherwise, repeat the process for all pre-goals, with the added
  +            // ability to specify force-execute inside the preGoal descriptor.
  +            result.addAll( resolveAllAsDecorators( decorators.getPreGoals( goal ),
  +                    context, includedGoals ) );
  +        }
  +
  +        // The actual goal execution gets sandwiched between pre- and post-goals
  +        result.add( goal );
  +        includedGoals.add(goal);
  +
  +        // If the decorator bindings are null, don't bother
  +        if ( decorators != null )
  +        {
  +            // Otherwise, repeat the process for all post-goals, with the added
  +            // ability to specify force-execute inside the postGoal descriptor.
  +            result.addAll( resolveAllAsDecorators( decorators.getPostGoals( 
  +                        goal ), context, includedGoals ) );
  +        }
  +
  +        // Return all the goals, in order, that we resolved for the specified 
  +        // input goal.
  +        return result;
  +    }
  +
  +    private List resolveAllAsDecorators( List goals,
  +        MavenLifecycleContext context, Set includedGoals )
  +    {
  +        // Initialize the results for this call
  +        List result = new ArrayList(  );
  +
  +        // Iterate over each decorator, and if it qualifies, resolve it to the
  +        // results list.
  +        for ( Iterator it = goals.iterator(  ); it.hasNext(  ); )
  +        {
  +            GoalDecorator decorator = ( GoalDecorator ) it.next(  );
  +            String preGoal = ( String ) decorator.getGoalToDecorate(  );
  +
  +            MojoDescriptor descriptor = context.getMojoDescriptor( preGoal );
  +
  +            // NOTE: This adds a check to account for the ability to force
  +            // execution via the pre- or post-goal specification.
  +            if ( decorator.forceExecute(  )
  +                || MojoDescriptor.MULTI_PASS_EXEC_STRATEGY.equals( 
  +                    descriptor.getExecutionStrategy(  ) )
  +                || !includedGoals.contains( descriptor ) )
  +            {
  +                result.addAll( resolve( descriptor, context, includedGoals ) );
  +            }
  +        }
  +
  +        return result;
       }
   }
  
  
  
  1.7       +0 -5      maven-components/maven-core/pom.xml
  
  Index: pom.xml
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/pom.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- pom.xml	3 Jul 2004 13:35:01 -0000	1.6
  +++ pom.xml	14 Jul 2004 04:27:25 -0000	1.7
  @@ -58,11 +58,6 @@
         <artifactId>marmalade-el-ognl</artifactId>
         <version>0.1</version>
       </dependency>
  -    <dependency>
  -      <groupId>tagalog</groupId>
  -      <artifactId>tagalog</artifactId>
  -      <version>0.1</version>
  -    </dependency>
       <!-- This will eventually be removed -->
       <dependency>
         <groupId>plexus</groupId>
  
  
  
  1.2       +5 -7      maven-components/maven-core/src/test/resources/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/test/resources/maven.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- maven.xml	11 Jun 2004 15:11:56 -0000	1.1
  +++ maven.xml	14 Jul 2004 04:27:25 -0000	1.2
  @@ -1,13 +1,11 @@
   <?xml version="1.0" encoding="UTF-8"?>
   
   <project default="compile" xmlns:c="marmalade:jstl-core">
  -  <preGoal name="dummy">
  -    <c:set var="testPreGoal" value="TestValue"/>
  -  </preGoal>
  -
  -  <postGoal name="dummy">
  -    <c:set var="testPostGoal" value="TestValue"/>
  -  </postGoal>
  +  
  +  <preGoal name="compile" attain="init"/>
  +  
  +  <postGoal name="compile" attain="jar"/>
  +  
   </project>
                   
   
  
  
  
  1.6       +1 -0      maven-components/maven-core/src/test/java/org/apache/maven/project/ProjectBaseDirectoryAlignmentTest.java
  
  Index: ProjectBaseDirectoryAlignmentTest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/project/ProjectBaseDirectoryAlignmentTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ProjectBaseDirectoryAlignmentTest.java	30 Jun 2004 22:03:37 -0000	1.5
  +++ ProjectBaseDirectoryAlignmentTest.java	14 Jul 2004 04:27:25 -0000	1.6
  @@ -8,6 +8,7 @@
   public class ProjectBaseDirectoryAlignmentTest
       extends AbstractProjectTestCase
   {        
  +    
       private String dir = "src/test/resources/projects/base-directory-alignment/";
           
       public void testProjectDirectoryBaseDirectoryAlignment()