You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jv...@apache.org on 2004/03/12 20:47:04 UTC

cvs commit: maven-components/maven-core/src/java/org/apache/maven/plugin DefaultPluginManagerManager.java

jvanzyl     2004/03/12 11:47:04

  Modified:    maven-core/src/java/org/apache/maven/plugin
                        DefaultPluginManagerManager.java
  Log:
  o only perform the toposort if the vertex has edges.
  
  Revision  Changes    Path
  1.9       +33 -20    maven-components/maven-core/src/java/org/apache/maven/plugin/DefaultPluginManagerManager.java
  
  Index: DefaultPluginManagerManager.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/java/org/apache/maven/plugin/DefaultPluginManagerManager.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DefaultPluginManagerManager.java	15 Feb 2004 21:43:19 -0000	1.8
  +++ DefaultPluginManagerManager.java	12 Mar 2004 19:47:04 -0000	1.9
  @@ -142,22 +142,31 @@
           {
               String goal = (String) i.next();
   
  -            List goals = TopologicalSorter.sort( dag );
  +            if ( dag.getChildLabels( goal ).size() == 0 && dag.getParentLabels( goal ).size() == 0 )
  +            {
  +                System.out.println( "[" + goal + "]" );
   
  -            int goalIndex = goals.indexOf( goal );
  +                pluginManager.attainGoal( (String) goalToPluginMap.get( goal ), getGoalDescriptor( goal ), project );
  +            }
  +            else
  +            {
  +                List goals = TopologicalSorter.sort( dag );
   
  -            // execute all goalDescriptorsKeyedByName starting from the beginning of the chain
  -            // up to the goal specified.
  +                int goalIndex = goals.indexOf( goal );
   
  -            for ( int j = 0; j <= goalIndex; j++ )
  -            {
  -                // Now dealing with whether the goal as been attained.
  +                // execute all goalDescriptorsKeyedByName starting from the beginning of the chain
  +                // up to the goal specified.
   
  -                String g = (String) goals.get( j );
  +                for ( int j = 0; j <= goalIndex; j++ )
  +                {
  +                    // Now dealing with whether the goal as been attained.
   
  -                System.out.println( "[" + g + "]" );
  +                    String goalName = (String) goals.get( j );
   
  -                pluginManager.attainGoal( (String) goalToPluginMap.get( g ), getGoalDescriptor( g ), project );
  +                    System.out.println( "[" + goalName + "]" );
  +
  +                    pluginManager.attainGoal( (String) goalToPluginMap.get( goalName ), getGoalDescriptor( goalName ), project );
  +                }
               }
           }
       }
  @@ -187,29 +196,33 @@
   
           // Now lets go hunting for plugin descriptors
   
  -        List pds = findPlugins( null );
  +        List pluginDescriptors = findPlugins( null );
   
  -        for ( Iterator i = pds.iterator(); i.hasNext(); )
  +        for ( Iterator i = pluginDescriptors.iterator(); i.hasNext(); )
           {
  -            PluginDescriptor pd = (PluginDescriptor) i.next();
  +            PluginDescriptor pluginDescriptor = (PluginDescriptor) i.next();
   
  -            List goals = pd.getGoals();
  +            List goals = pluginDescriptor.getGoals();
   
               for ( Iterator j = goals.iterator(); j.hasNext(); )
               {
  -                PluginDescriptor.GoalDescriptor g = (PluginDescriptor.GoalDescriptor) j.next();
  +                PluginDescriptor.GoalDescriptor goalDescriptor = (PluginDescriptor.GoalDescriptor) j.next();
   
  -                if ( g.getPrereqs() != null )
  +                if ( goalDescriptor.getPrereqs() != null )
                   {
  -                    for ( Iterator k = g.getPrereqs().iterator(); k.hasNext(); )
  +                    for ( Iterator k = goalDescriptor.getPrereqs().iterator(); k.hasNext(); )
                       {
  -                        dag.addEdge( g.getName(), (String) k.next() );
  +                        dag.addEdge( goalDescriptor.getName(), (String) k.next() );
                       }
                   }
  +                else
  +                {
  +                    dag.addVertex( goalDescriptor.getName() );
  +                }
   
  -                goalDescriptorsKeyedByName.put( g.getName(), g );
  +                goalDescriptorsKeyedByName.put( goalDescriptor.getName(), goalDescriptor );
   
  -                goalToPluginMap.put( g.getName(), pd.getId() );
  +                goalToPluginMap.put( goalDescriptor.getName(), pluginDescriptor.getId() );
               }
           }
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org