brett       2004/04/14 23:06:44

  Modified:    src/java/org/apache/maven/jelly/tags/maven Tag:
                        MAVEN-1_0-BRANCH ReactorTag.java
  Log:
  add extra tags to allow improved memory usage
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.36.4.9  +79 -13    maven/src/java/org/apache/maven/jelly/tags/maven/ReactorTag.java
  
  Index: ReactorTag.java
  ===================================================================
  RCS file: 
/home/cvs/maven/src/java/org/apache/maven/jelly/tags/maven/ReactorTag.java,v
  retrieving revision 1.36.4.8
  retrieving revision 1.36.4.9
  diff -u -r1.36.4.8 -r1.36.4.9
  --- ReactorTag.java   1 Mar 2004 22:36:37 -0000       1.36.4.8
  +++ ReactorTag.java   15 Apr 2004 06:06:44 -0000      1.36.4.9
  @@ -65,6 +65,14 @@
   
       /** project base directory */
       private File basedir;
  +    
  +    /** The name of the context variable to store the project collection in. */
  +    private String collectionVar = "reactorProjects";
  +    
  +    /** Whether to actually execute the default or specified goals, or 
  +     * simply collect the projects in order.
  +     */
  +    private boolean collectOnly = false;
   
       /**
        * Post processing flag. If this is set then we will hold on to the
  @@ -75,14 +83,32 @@
       /** Storage for projects that failed in the build. */
       private Collection failedProjects = new ArrayList();
   
  -    /** Storage for processed projects. */
  -    private ArrayList reactorProjects = new ArrayList();
  +    /** List of Project objects to use instead of glob or includes. */
  +    private List projectList = null;
   
       // ----------------------------------------------------------------------
       // A C C E S S O R S
       // ----------------------------------------------------------------------
   
       /**
  +     * Set the project list.
  +     * @param projectList the project list
  +     */
  +    public void setProjectList( List projectList )
  +    {
  +        this.projectList = projectList;
  +    }
  +
  +    /**
  +     * Get the project list.
  +     * @return the project list
  +     */
  +    public List getProjectList()
  +    {
  +        return projectList;
  +    }
  +
  +    /**
        * Setter for the basedir property
        * XXX if the method it overrides is deprecated, is this also deprecated?
        * @param basedir the base directory for execution of the project
  @@ -101,6 +127,33 @@
       {
           return this.basedir;
       }
  +    
  +    /** Set the collectOnly attribute. This controls whether reactor
  +     * will actually execute any goals on the projects, or simply 
  +     * collect the sorted set of projects included in this reactor
  +     * invocation.
  +     * 
  +     * @param collectOnly if true, don't execute project goals; simply 
  +     *  gather the sorted project collection and store. Otherwise, 
  +     *  operate as before (execute either specified goals or default goal
  +     *  for each project).
  +     */
  +    public void setCollectOnly( boolean collectOnly )
  +    {
  +        this.collectOnly = collectOnly;
  +    }
  +    
  +    /** Set the collectionVar attribute. This controls the context 
  +     * variable which will contain the sorted set of projects included
  +     * in this reactor invocation.
  +     * 
  +     * @param collectionVar The context variable for the project collection
  +     *  discovered here.
  +     */
  +    public void setCollectionVar( String collectionVar )
  +    {
  +        this.collectionVar = collectionVar;
  +    }
   
       /**
        * Set the postProcessing attribute.
  @@ -222,9 +275,9 @@
       {
           checkAttribute( getBasedir(), "basedir" );
   
  -        if ( getGlob() == null && getIncludes() == null )
  +        if ( getGlob() == null && getIncludes() == null && projectList == null )
           {
  -            throw new MissingAttributeException( "glob|includes" );
  +            throw new MissingAttributeException( "glob|includes|projectList" );
           }
   
           log.info( "Starting the reactor..." );
  @@ -247,6 +300,8 @@
               log.info( p.getName() );
           }
   
  +        ArrayList reactorProjects = new ArrayList();
  +
           Runtime r = Runtime.getRuntime();
           for ( Iterator i = sortedProjects.iterator(); i.hasNext();)
           {
  @@ -272,21 +327,26 @@
                       goalList = MavenUtils.getGoalListFromCsv( getGoals() );
                   }
   
  -                beforeLaunchGoals(project);
  -                getMavenContext().getMavenSession().attainGoals( project, goalList 
);
  -                afterLaunchGoals(project);
  +                beforeLaunchGoals( project );
  +                
  +                if( !collectOnly )
  +                {
  +                    getMavenContext().getMavenSession().attainGoals( project, 
goalList );
  +                }
  +                
  +                afterLaunchGoals( project );
               }
               catch ( Exception e )
               {
  -                onException(project, e);
  +                onException( project, e );
                   if ( !isIgnoreFailures() )
                   {
                       throw new JellyTagException( "Reactor subproject failure 
occurred", e );
                   }
               }
  -            afterProject(project);
  +            afterProject( project );
   
  -            if ( getPostProcessing() )
  +            if ( getPostProcessing() || collectOnly )
               {
                   reactorProjects.add( project );
               }
  @@ -296,8 +356,8 @@
               i.remove();
           }
   
  -        getContext().setVariable( "reactorProjects", reactorProjects );
  -        Collection c = (Collection) getContext().getVariable( 
MavenConstants.FAILED_PROJECTS );
  +        getContext().setVariable( collectionVar, reactorProjects );
  +        Collection c = ( Collection ) getContext().getVariable( 
MavenConstants.FAILED_PROJECTS );
           if ( c == null )
           {
               c = new ArrayList( failedProjects );
  @@ -317,6 +377,12 @@
        */
       private List getSortedProjects() throws Exception
       {
  +        if ( projectList != null )
  +        {
  +            log.debug( "using existing list of projects: " + projectList );
  +            return projectList;
  +        }
  +
           String projectIncludes;
           if ( getGlob() != null )
           {
  
  
  

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

Reply via email to