ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adammurd...@apache.org
Subject cvs commit: jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/builder DefaultProjectBuilder.java
Date Fri, 05 Jul 2002 06:54:25 GMT
adammurdoch    2002/07/04 23:54:25

  Modified:    container/src/java/org/apache/myrmidon/components/builder
                        DefaultProjectBuilder.java
  Log:
  Revert to parsing top level <target> elements.
  
  Revision  Changes    Path
  1.87      +25 -5     jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/builder/DefaultProjectBuilder.java
  
  Index: DefaultProjectBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/builder/DefaultProjectBuilder.java,v
  retrieving revision 1.86
  retrieving revision 1.87
  diff -u -r1.86 -r1.87
  --- DefaultProjectBuilder.java	5 Jul 2002 03:21:55 -0000	1.86
  +++ DefaultProjectBuilder.java	5 Jul 2002 06:54:25 -0000	1.87
  @@ -10,6 +10,7 @@
   import java.io.File;
   import java.net.MalformedURLException;
   import java.net.URL;
  +import java.util.ArrayList;
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.excalibur.io.FileUtil;
  @@ -102,7 +103,6 @@
               final String systemID = extractURL( file );
               final ModelElement model =
                   getModelBuilder( systemID ).build( systemID );
  -            model.makeReadOnly();
   
               verifyTopLevelProject( model );
   
  @@ -148,6 +148,10 @@
        */
       protected Target createTarget( final ModelElement model )
       {
  +        // Change the name of the model to <target-impl>, which is the task
  +        // that executes the target body
  +        model.setName( "target-impl" );
  +        model.makeReadOnly();
           final String name = model.getAttribute( "name" );
           final String description = model.getAttribute( "description" );
           return new Target( name, description, model );
  @@ -269,13 +273,29 @@
       protected Target[] buildTopLevelProject( final ModelElement model )
           throws Exception
       {
  -        final ModelElement implicit = new ModelElement( "target-impl", model.getLocation()
);
  +        final ArrayList targets = new ArrayList();
  +
  +        final ModelElement implicit = new ModelElement( "target", model.getLocation() );
           implicit.setAttribute( "name", Project.IMPLICIT_TARGET_NAME );
   
           final ModelElement[] children = model.getChildren();
  -        implicit.addChildren( children );
   
  -        return new Target[]{createTarget( implicit )};
  +        for( int pos = 0; pos < children.length; pos++ )
  +        {
  +            final ModelElement element = children[ pos ];
  +            final String name = element.getName();
  +            if( name.equals( "target" ) )
  +            {
  +                targets.add( createTarget( element ) );
  +            }
  +            else
  +            {
  +                implicit.addChild( children[ pos ] );
  +            }
  +        }
  +        targets.add( createTarget( implicit ) );
  +
  +        return (Target[])targets.toArray( new Target[ targets.size() ] );
       }
   
       /**
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message