brett       2004/05/19 03:22:12

  Modified:    src/java/org/apache/maven/plugin Tag: MAVEN-1_0-BRANCH
                        GoalToJellyScriptHousingMapper.java
                        PluginCacheManager.java
  Log:
  PR: MAVEN-1286
  pre/post goals can be defined more than once in a cache
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.3.4.15  +18 -0     
maven/src/java/org/apache/maven/plugin/GoalToJellyScriptHousingMapper.java
  
  Index: GoalToJellyScriptHousingMapper.java
  ===================================================================
  RCS file: 
/home/cvs/maven/src/java/org/apache/maven/plugin/GoalToJellyScriptHousingMapper.java,v
  retrieving revision 1.3.4.14
  retrieving revision 1.3.4.15
  diff -u -r1.3.4.14 -r1.3.4.15
  --- GoalToJellyScriptHousingMapper.java       28 Apr 2004 03:28:56 -0000      
1.3.4.14
  +++ GoalToJellyScriptHousingMapper.java       19 May 2004 10:22:12 -0000      
1.3.4.15
  @@ -17,6 +17,7 @@
    * ====================================================================
    */
   
  +import java.util.Arrays;
   import java.util.Collection;
   import java.util.HashMap;
   import java.util.HashSet;
  @@ -241,9 +242,12 @@
        */
       Set resolveJellyScriptHousings( String goal ) throws NoSuchGoalException
       {
  +        log.debug( "preparing goal: " + goal );
  +
           Set pluginSet = new InsertionOrderedSet();
   
           Goal[] chain = getExecutionChain( goal, goalProject );
  +        log.debug( "execution chain: " + Arrays.asList( chain ).toString() );
   
           for ( int i = 0; i < chain.length; i++ )
           {
  @@ -255,13 +259,25 @@
               }
               pluginSet.add( plugin );
               Collection decorators = getPostGoalDecorators( g.getName() );
  +            if ( log.isDebugEnabled() && !decorators.isEmpty() )
  +            {
  +                log.debug( "goal " + g.getName() + " has postGoal decorators " + 
decorators );
  +            }
               pluginSet.addAll( decorators );
               decorators = getPreGoalDecorators( g.getName() );
  +            if ( log.isDebugEnabled() && !decorators.isEmpty() )
  +            {
  +                log.debug( "goal " + g.getName() + " has preGoal decorators " + 
decorators );
  +            }
               pluginSet.addAll( decorators );
           }
   
           // Done like this as the dynatag plugin dependencies must be first in the 
list
           InsertionOrderedSet newPluginSet = resolveDynaTagPlugins( pluginSet );
  +        if ( log.isDebugEnabled() && !newPluginSet.isEmpty() )
  +        {
  +            log.debug( "dynatag dependencies: " + newPluginSet );
  +        }
           newPluginSet.addAll( pluginSet );
           pluginSet = newPluginSet;
   
  @@ -270,6 +286,8 @@
           // TODO: skip the remove step - don't add if it is already loaded
           pluginSet.removeAll( resolvedPlugins );
           resolvedPlugins.addAll( pluginSet );
  +
  +        log.debug( "final list of plugins to prepare: " + pluginSet );
   
           return pluginSet;
       }
  
  
  
  1.16.4.16 +45 -13    maven/src/java/org/apache/maven/plugin/PluginCacheManager.java
  
  Index: PluginCacheManager.java
  ===================================================================
  RCS file: /home/cvs/maven/src/java/org/apache/maven/plugin/PluginCacheManager.java,v
  retrieving revision 1.16.4.15
  retrieving revision 1.16.4.16
  diff -u -r1.16.4.15 -r1.16.4.16
  --- PluginCacheManager.java   28 Apr 2004 03:28:56 -0000      1.16.4.15
  +++ PluginCacheManager.java   19 May 2004 10:22:12 -0000      1.16.4.16
  @@ -22,9 +22,11 @@
   import java.io.FileNotFoundException;
   import java.io.FileOutputStream;
   import java.io.IOException;
  +import java.util.ArrayList;
   import java.util.HashMap;
   import java.util.HashSet;
   import java.util.Iterator;
  +import java.util.List;
   import java.util.Map;
   import java.util.Properties;
   import java.util.StringTokenizer;
  @@ -45,7 +47,7 @@
       /** Log. */
       private static final Log log = LogFactory.getLog( PluginCacheManager.class );
       /** Maven session log */
  -    private static final Log sessionLog = LogFactory.getLog(MavenSession.class);
  +    private static final Log sessionLog = LogFactory.getLog( MavenSession.class );
   
       /** Plug-in cache lock. */
       public static final String LOCK_CACHE = "lock.cache";
  @@ -485,6 +487,10 @@
                   clearCache();
                   return false;
               }
  +            //if ( log.isDebugEnabled() )
  +            //{
  +                //log.debug( "cached dynatag dep by " + pluginName + " for taglibs 
" + pluginDynaTagDepsCache.get( pluginName ) );
  +            //}
           }
           for ( Iterator i = pluginCache.keySet().iterator(); i.hasNext(); )
           {
  @@ -496,6 +502,10 @@
                   clearCache();
                   return false;
               }
  +            //if ( log.isDebugEnabled() )
  +            //{
  +                //log.debug( "cached goal " + goalName + " in plugin " + pluginName 
);
  +            //}
           }
           for ( Iterator i = artifactIdCache.keySet().iterator(); i.hasNext(); )
           {
  @@ -520,20 +530,22 @@
                       : callbackName.substring( 0, callbackName.length() - 5 ); 
               String pluginNames = callbackCache.getProperty( callbackName );
               StringTokenizer tok = new StringTokenizer( pluginNames, "," );
  +            List housings = new ArrayList();
  +            if ( isPreGoal )
  +            {
  +                preGoals.put( goalName, housings );
  +            }
  +            else
  +            {
  +                postGoals.put( goalName, housings );
  +            }
               while ( tok.hasMoreTokens() )
               {
                   String pluginName = tok.nextToken();
                   JellyScriptHousing housing = loadHousing( pluginName, manager, 
pluginDirs, "callbacks" );
                   if ( housing != null )
                   {
  -                    if ( isPreGoal )
  -                    {
  -                        preGoals.put( goalName, housing );
  -                    }
  -                    else
  -                    {
  -                        postGoals.put( goalName, housing );
  -                    }
  +                    housings.add( housing );
                   }
                   else
                   {
  @@ -553,20 +565,40 @@
                   clearCache();
                   return false;
               }
  +            //if ( log.isDebugEnabled() )
  +            //{
  +                //log.debug( "cached dynataglib " + uri + " in plugin " + 
pluginName );
  +            //}
           }
   
           // Now map the clean set of plugins
           for ( Iterator i = preGoals.keySet().iterator(); i.hasNext(); )
           {
               String goalName = ( String ) i.next();
  -            JellyScriptHousing housing = ( JellyScriptHousing ) preGoals.get( 
goalName );
  -            mapper.addPreGoal( goalName, housing );
  +            List housings = ( List ) preGoals.get( goalName );
  +            for ( Iterator j = housings.iterator(); j.hasNext(); )
  +            {
  +                JellyScriptHousing housing = ( JellyScriptHousing ) j.next();
  +                mapper.addPreGoal( goalName, housing );
  +                //if ( log.isDebugEnabled() )
  +                //{
  +                    //log.debug( "cached preGoal on " + goalName + " in plugin " + 
housing.getName() );
  +                //}
  +            }
           }
           for ( Iterator i = postGoals.keySet().iterator(); i.hasNext(); )
           {
               String goalName = ( String ) i.next();
  -            JellyScriptHousing housing = ( JellyScriptHousing ) postGoals.get( 
goalName );
  -            mapper.addPostGoal( goalName, housing );
  +            List housings = ( List ) postGoals.get( goalName );
  +            for ( Iterator j = housings.iterator(); j.hasNext(); )
  +            {
  +                JellyScriptHousing housing = ( JellyScriptHousing ) j.next();
  +                mapper.addPostGoal( goalName, housing );
  +                //if ( log.isDebugEnabled() )
  +                //{
  +                    //log.debug( "cached postGoal on " + goalName + " in plugin " + 
housing.getName() );
  +                //}
  +            }
           }
           
           for ( Iterator i = pluginDynaTagDepsCache.keySet().iterator(); i.hasNext(); 
)
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to