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/antlib/src/java/org/apache/antlib/project AddTargetTask.java
Date Tue, 02 Jul 2002 12:32:35 GMT
adammurdoch    2002/07/02 05:32:35

  Modified:    framework/src/java/org/apache/myrmidon/framework/project
                        TargetTask.java
               framework/src/test/org/apache/myrmidon/framework
                        expect-output.ant
               framework/src/test/org/apache/myrmidon/framework/project/test
                        TargetTaskTestCase.java target.ant
               container/src/java/org/apache/myrmidon/components/builder
                        ConvertingModelBuilder.java
                        DefaultProjectBuilder.java Resources.properties
               container/src/java/org/apache/myrmidon/components/workspace
                        Resources.properties
               container/src/java/org/apache/myrmidon/interfaces/model
                        AbstractUnit.java
               ant1compat/src/conf ant-types.xml
               ant1compat/src/java/org/apache/tools/ant
                        Ant1CompatTargetTask.java
  Added:       framework/src/java/org/apache/myrmidon/framework/project
                        TargetImplTask.java
  Removed:     antlib/src/java/org/apache/antlib/project AddTargetTask.java
  Log:
  - Renamed <add-target> task to <target>.  Now, using the <target> task
at any level, including
    in templates and <include>'d stuff, adds a target to the current project, but does
not
    execute it.  Added test cases.
  
  - Renamed old <target> to <target-impl>.  This task is used when targets are
actually
    executed by the workspace.  Also renamed the ant1compat <target> task, so that ant1
    projects use it to execute targets.
  
  - Changed DefaultProjectBuilder, so that it builds projects with a single <init> target,
    containing the entire project, including all the <target> elements (which get added
    as targets as the <init> target executes).  Also cleaned out ConvertingModelBuilder,
    since there is no longer any need for it to reorder the top-level elements.
  
  Revision  Changes    Path
  1.4       +34 -208   jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/project/TargetTask.java
  
  Index: TargetTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/project/TargetTask.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TargetTask.java	2 Jul 2002 09:56:25 -0000	1.3
  +++ TargetTask.java	2 Jul 2002 12:32:34 -0000	1.4
  @@ -2,240 +2,66 @@
    * Copyright (C) The Apache Software Foundation. All rights reserved.
    *
    * This software is published under the terms of the Apache Software License
  - * version 1.1, a copy of which has been included  with this distribution in
  + * version 1.1, a copy of which has been included with this distribution in
    * the LICENSE.txt file.
    */
   package org.apache.myrmidon.framework.project;
   
  +import org.apache.myrmidon.api.AbstractTask;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.api.metadata.ModelElement;
  -import org.apache.myrmidon.framework.project.Dependency;
  -import org.apache.myrmidon.framework.project.AbstractWorkspaceTask;
  -import org.apache.avalon.excalibur.i18n.Resources;
  -import org.apache.avalon.excalibur.i18n.ResourceManager;
  -import java.util.ArrayList;
  -import java.util.StringTokenizer;
  -import java.util.List;
  +import org.apache.myrmidon.api.metadata.Modeller;
  +import org.apache.myrmidon.api.metadata.ModelException;
  +import org.apache.myrmidon.framework.ModelElementUtil;
  +import org.apache.myrmidon.interfaces.model.Target;
  +import org.apache.myrmidon.interfaces.workspace.TargetSet;
   
   /**
  - * An abstract base class for implementing &gt;target&lt; tasks.
  + * Adds a target to the current project.
    *
  - * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @author <a href="mailto:darrell@apache.org">Darrell DeBoer</a>
  + * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
    * @version $Revision$ $Date$
    *
    * @ant.task name="target"
    */
   public class TargetTask
  -    extends AbstractWorkspaceTask
  +    extends AbstractTask
  +    implements Modeller
   {
  -    private static final Resources REZ =
  -        ResourceManager.getPackageResources( TargetTask.class );
  +    private ModelElement m_model;
   
       /**
  -     * The name of the target.
  -     */
  -    private String m_name;
  -
  -    /**
  -     * The array of ordered tasks which are contained
  -     * withing Target.
  -     */
  -    private final List m_tasks = new ArrayList();
  -
  -    /**
  -     * The list of dependencies to execute before this target.
  -     */
  -    private final List m_dependencies = new ArrayList();
  -
  -    /**
  -     * The name of target.
  +     * Pass the object a read-only instance of it's own
  +     * model.
        *
  -     * @param name the name of the target
  -     * @see #m_name
  +     * @param model the ModelElement representing object
  +     * @throws org.apache.myrmidon.api.metadata.ModelException if there is an error interpreting
model
        */
  -    public void setName( final String name )
  +    public void model( final ModelElement model )
  +        throws ModelException
       {
  -        m_name = name;
  +        m_model = model;
       }
   
       /**
  -     * The description of the target.
  -     */
  -    public void setDescription( final String desc )
  -    {
  -        // Ignore
  -    }
  -
  -    /**
  -     * The list of dependencies for target.
  +     * Executes the task.
        *
  -     * @param depends the list of dependencies for target
  -     * @see #m_dependencies
  +     * @throws org.apache.myrmidon.api.TaskException if an error occurs
        */
  -    public void setDepends( final String depends )
  -        throws TaskException
  -    {
  -        buildDependsList( depends );
  -    }
  -
  -    /**
  -     * Adds a nested task to execute.
  -     */
  -    public void add( final ModelElement taskModel )
  -    {
  -        m_tasks.add( taskModel );
  -    }
  -
       public void execute()
           throws TaskException
       {
  -        validate();
  -
  -        executeDependencies();
  -
  -        final String message =
  -            REZ.getString( "target.exec.notice", m_name );
  -        getContext().verbose( message );
  -
  -        final ModelElement[] tasks =
  -            (ModelElement[])m_tasks.toArray( new ModelElement[ m_tasks.size() ] );
  -        executeContainedTasks( tasks );
  -    }
  -
  -    /**
  -     * Make sure that the name is not null.
  -     *
  -     * @throws TaskException if name has not been set.
  -     */
  -    protected void validate()
  -        throws TaskException
  -    {
  -        if( null == m_name )
  -        {
  -            final String message =
  -                REZ.getString( "target.no-name.error" );
  -            throw new TaskException( message );
  -        }
  -    }
  -
  -    /**
  -     * Execute depencies of target (if any).
  -     *
  -     * @throws TaskException if theres an eror executing dependencies.
  -     */
  -    protected void executeDependencies()
  -        throws TaskException
  -    {
  -        final int count = m_dependencies.size();
  -        for( int i = 0; i < count; i++ )
  -        {
  -            final Dependency dependency = (Dependency)m_dependencies.get( i );
  -            executeDependency( dependency );
  -        }
  -    }
  -
  -    /**
  -     * Execute all the tasks contained within target.
  -     *
  -     * @throws TaskException if theres an eror executing contained tasks.
  -     */
  -    protected void executeContainedTasks( final ModelElement[] tasks )
  -        throws TaskException
  -    {
  -        for( int i = 0; i < tasks.length; i++ )
  -        {
  -            final ModelElement task = tasks[ i ];
  -
  -            final String message =
  -                REZ.getString( "target.task-exec.notice",
  -                               task.getName() );
  -            getContext().debug( message );
  -            executeTask( task );
  -        }
  -    }
  -
  -    public String toString()
  -    {
  -        return "Target['" + m_name + "]";
  -    }
  -
  -    /**
  -     * Utility method to parse a list of dependencies from depends
  -     * string, adding them to the Dependencies list.
  -     *
  -     * @param depends a comma separated string of dependencies
  -     * @throws TaskException on error
  -     */
  -    private void buildDependsList( final String depends )
  -        throws TaskException
  -    {
  -        m_dependencies.clear();
  -
  -        //apply depends attribute
  -        if( null == depends )
  -        {
  -            return;
  -        }
  -
  -        final String[] elements = split( depends, "," );
  -
  -        for( int i = 0; i < elements.length; i++ )
  -        {
  -            final String dependency = elements[ i ].trim();
  -
  -            // Split project->target dependencies
  -            final int sep = dependency.indexOf( "->" );
  -            final String projectName;
  -            final String targetName;
  -            if( sep != -1 )
  -            {
  -                projectName = dependency.substring( 0, sep );
  -                targetName = dependency.substring( sep + 2 );
  -            }
  -            else
  -            {
  -                projectName = null;
  -                targetName = dependency;
  -            }
  -
  -            if( targetName.length() == 0 ||
  -                ( projectName != null && projectName.length() == 0 ) )
  -            {
  -                final String message =
  -                    REZ.getString( "target.bad-dependency.error",
  -                                   getContext().getName(),
  -                                   getContext().getLocation() );
  -                throw new TaskException( message );
  -            }
  -
  -            m_dependencies.add( new Dependency( projectName, targetName ) );
  -        }
  -
  -        final String message =
  -            REZ.getString( "target.depends.notice",
  -                           m_name,
  -                           m_dependencies );
  -        getContext().debug( message );
  -    }
  -
  -    /**
  -     * Splits the string on every token into an array of strings.
  -     *
  -     * @param string the string
  -     * @param onToken the token
  -     * @return the resultant array
  -     */
  -    private String[] split( final String string, final String onToken )
  -    {
  -        final StringTokenizer tokenizer = new StringTokenizer( string, onToken );
  -        final String[] result = new String[ tokenizer.countTokens() ];
  -
  -        for( int i = 0; i < result.length; i++ )
  -        {
  -            result[ i ] = tokenizer.nextToken();
  -        }
  -
  -        return result;
  +        // Transform the model, to replace the name
  +        final ModelElement targetModel = new ModelElement( "target-impl", m_model.getLocation()
);
  +        ModelElementUtil.copyModel( m_model, targetModel );
  +
  +        // Build the target
  +        final String name = targetModel.getAttribute( "name" );
  +        final String description = targetModel.getAttribute( "description", "" );
  +        final Target target = new Target( name, description, targetModel );
  +
  +        // Add the target
  +        final TargetSet targetSet = (TargetSet)getContext().getProperty( TargetSet.KEY
);
  +        targetSet.addTarget( target );
       }
   }
  
  
  
  1.1                  jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/project/TargetImplTask.java
  
  Index: TargetImplTask.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included  with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.myrmidon.framework.project;
  
  import org.apache.myrmidon.api.TaskException;
  import org.apache.myrmidon.api.metadata.ModelElement;
  import org.apache.myrmidon.framework.project.Dependency;
  import org.apache.myrmidon.framework.project.AbstractWorkspaceTask;
  import org.apache.avalon.excalibur.i18n.Resources;
  import org.apache.avalon.excalibur.i18n.ResourceManager;
  import java.util.ArrayList;
  import java.util.StringTokenizer;
  import java.util.List;
  
  /**
   * An abstract base class for implementing &gt;target&lt; tasks.
   *
   * @author <a href="mailto:peter@apache.org">Peter Donald</a>
   * @author <a href="mailto:darrell@apache.org">Darrell DeBoer</a>
   * @version $Revision: 1.1 $ $Date: 2002/07/02 12:32:34 $
   *
   * @ant.task name="target-impl"
   */
  public class TargetImplTask
      extends AbstractWorkspaceTask
  {
      private static final Resources REZ =
          ResourceManager.getPackageResources( TargetImplTask.class );
  
      /**
       * The name of the target.
       */
      private String m_name;
  
      /**
       * The array of ordered tasks which are contained
       * withing Target.
       */
      private final List m_tasks = new ArrayList();
  
      /**
       * The list of dependencies to execute before this target.
       */
      private final List m_dependencies = new ArrayList();
  
      /**
       * The name of target.
       *
       * @param name the name of the target
       * @see #m_name
       */
      public void setName( final String name )
      {
          m_name = name;
      }
  
      /**
       * The description of the target.
       */
      public void setDescription( final String desc )
      {
          // Ignore
      }
  
      /**
       * The list of dependencies for target.
       *
       * @param depends the list of dependencies for target
       * @see #m_dependencies
       */
      public void setDepends( final String depends )
          throws TaskException
      {
          buildDependsList( depends );
      }
  
      /**
       * Adds a nested task to execute.
       */
      public void add( final ModelElement taskModel )
      {
          m_tasks.add( taskModel );
      }
  
      public void execute()
          throws TaskException
      {
          validate();
  
          executeDependencies();
  
          final String message =
              REZ.getString( "target.exec.notice", m_name );
          getContext().verbose( message );
  
          final ModelElement[] tasks =
              (ModelElement[])m_tasks.toArray( new ModelElement[ m_tasks.size() ] );
          executeContainedTasks( tasks );
      }
  
      /**
       * Make sure that the name is not null.
       *
       * @throws TaskException if name has not been set.
       */
      protected void validate()
          throws TaskException
      {
          if( null == m_name )
          {
              final String message =
                  REZ.getString( "target.no-name.error" );
              throw new TaskException( message );
          }
      }
  
      /**
       * Execute depencies of target (if any).
       *
       * @throws TaskException if theres an eror executing dependencies.
       */
      protected void executeDependencies()
          throws TaskException
      {
          final int count = m_dependencies.size();
          for( int i = 0; i < count; i++ )
          {
              final Dependency dependency = (Dependency)m_dependencies.get( i );
              executeDependency( dependency );
          }
      }
  
      /**
       * Execute all the tasks contained within target.
       *
       * @throws TaskException if theres an eror executing contained tasks.
       */
      protected void executeContainedTasks( final ModelElement[] tasks )
          throws TaskException
      {
          for( int i = 0; i < tasks.length; i++ )
          {
              final ModelElement task = tasks[ i ];
  
              final String message =
                  REZ.getString( "target.task-exec.notice",
                                 task.getName() );
              getContext().debug( message );
              executeTask( task );
          }
      }
  
      public String toString()
      {
          return "Target['" + m_name + "]";
      }
  
      /**
       * Utility method to parse a list of dependencies from depends
       * string, adding them to the Dependencies list.
       *
       * @param depends a comma separated string of dependencies
       * @throws TaskException on error
       */
      private void buildDependsList( final String depends )
          throws TaskException
      {
          m_dependencies.clear();
  
          //apply depends attribute
          if( null == depends )
          {
              return;
          }
  
          final String[] elements = split( depends, "," );
  
          for( int i = 0; i < elements.length; i++ )
          {
              final String dependency = elements[ i ].trim();
  
              // Split project->target dependencies
              final int sep = dependency.indexOf( "->" );
              final String projectName;
              final String targetName;
              if( sep != -1 )
              {
                  projectName = dependency.substring( 0, sep );
                  targetName = dependency.substring( sep + 2 );
              }
              else
              {
                  projectName = null;
                  targetName = dependency;
              }
  
              if( targetName.length() == 0 ||
                  ( projectName != null && projectName.length() == 0 ) )
              {
                  final String message =
                      REZ.getString( "target.bad-dependency.error",
                                     getContext().getName(),
                                     getContext().getLocation() );
                  throw new TaskException( message );
              }
  
              m_dependencies.add( new Dependency( projectName, targetName ) );
          }
  
          final String message =
              REZ.getString( "target.depends.notice",
                             m_name,
                             m_dependencies );
          getContext().debug( message );
      }
  
      /**
       * Splits the string on every token into an array of strings.
       *
       * @param string the string
       * @param onToken the token
       * @return the resultant array
       */
      private String[] split( final String string, final String onToken )
      {
          final StringTokenizer tokenizer = new StringTokenizer( string, onToken );
          final String[] result = new String[ tokenizer.countTokens() ];
  
          for( int i = 0; i < result.length; i++ )
          {
              result[ i ] = tokenizer.nextToken();
          }
  
          return result;
      }
  }
  
  
  
  1.4       +4 -4      jakarta-ant-myrmidon/framework/src/test/org/apache/myrmidon/framework/expect-output.ant
  
  Index: expect-output.ant
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/framework/src/test/org/apache/myrmidon/framework/expect-output.ant,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- expect-output.ant	27 Jun 2002 11:13:07 -0000	1.3
  +++ expect-output.ant	2 Jul 2002 12:32:34 -0000	1.4
  @@ -46,16 +46,16 @@
       <target name="nested">
           <expect-output>
               <out>
  -                <target>
  +                <target-impl>
                       <unit-test-log>log message 1</unit-test-log>
                       <unit-test-log>log message 2</unit-test-log>
  -                </target>
  +                </target-impl>
               </out>
               <tasks>
  -                <target name="this is shonky">
  +                <target-impl name="this is shonky">
                       <unit-test-log>log message 1</unit-test-log>
                       <unit-test-log>log message 2</unit-test-log>
  -                </target>
  +                </target-impl>
               </tasks>
           </expect-output>
       </target>
  
  
  
  1.2       +5 -1      jakarta-ant-myrmidon/framework/src/test/org/apache/myrmidon/framework/project/test/TargetTaskTestCase.java
  
  Index: TargetTaskTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/framework/src/test/org/apache/myrmidon/framework/project/test/TargetTaskTestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TargetTaskTestCase.java	27 Jun 2002 11:13:07 -0000	1.1
  +++ TargetTaskTestCase.java	2 Jul 2002 12:32:34 -0000	1.2
  @@ -32,5 +32,9 @@
           executeTarget( projectFile, "depend-cycle" );
           executeTarget( projectFile, "unknown-depend" );
           executeTarget( projectFile, "no-name" );
  +        executeTarget( projectFile, "duplicate-name" );
  +        executeTarget( projectFile, "invalid-name1" );
  +        executeTarget( projectFile, "invalid-name2" );
  +        executeTarget( projectFile, "invalid-name3" );
       }
   }
  
  
  
  1.2       +44 -3     jakarta-ant-myrmidon/framework/src/test/org/apache/myrmidon/framework/project/test/target.ant
  
  Index: target.ant
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/framework/src/test/org/apache/myrmidon/framework/project/test/target.ant,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- target.ant	27 Jun 2002 11:13:07 -0000	1.1
  +++ target.ant	2 Jul 2002 12:32:34 -0000	1.2
  @@ -22,7 +22,8 @@
           <expect-error>
               <exc>Cycle in dependencies for target cycle2.</exc>
               <tasks>
  -                <target name="cycle1" depends="cycle2"/>
  +                <!-- use <target-impl> instead of <depends> -->
  +                <target-impl name="dummy" depends="cycle2"/>
               </tasks>
           </expect-error>
       </target>
  @@ -30,20 +31,60 @@
       <target name="cycle2" depends="cycle3"/>
       <target name="cycle3" depends="cycle2"/>
   
  +    <!--
  +    VALIDATION TESTS
  +    -->
  +
       <target name="unknown-depend">
           <expect-error>
               <exc>No target named "no-such-target" in project "${myrmidon.project/projectDescriptor/uri}".</exc>
               <tasks>
  -                <target name="unknown" depends="no-such-target"/>
  +                <target-impl name="dummy" depends="unknown"/>
               </tasks>
           </expect-error>
       </target>
   
  +    <target name="unknown" depends="no-such-target"/>
  +
       <target name="no-name">
           <expect-error>
  -            <exc>Target does not specify the name attribute.</exc>
  +            <exc>No target name specified.</exc>
               <tasks>
                   <target/>
  +            </tasks>
  +        </expect-error>
  +    </target>
  +
  +    <target name="duplicate-name">
  +        <expect-error>
  +            <exc>Multiple targets with name "duplicate-name".</exc>
  +            <tasks>
  +                <target name="duplicate-name"/>
  +            </tasks>
  +        </expect-error>
  +    </target>
  +
  +    <target name="invalid-name1">
  +        <expect-error>
  +            <exc>Invalid target name "a->b".</exc>
  +            <tasks>
  +                <target name="a->b"/>
  +            </tasks>
  +        </expect-error>
  +    </target>
  +    <target name="invalid-name2">
  +        <expect-error>
  +            <exc>Invalid target name "??".</exc>
  +            <tasks>
  +                <target name="??"/>
  +            </tasks>
  +        </expect-error>
  +    </target>
  +    <target name="invalid-name3">
  +        <expect-error>
  +            <exc>Invalid target name "".</exc>
  +            <tasks>
  +                <target name=""/>
               </tasks>
           </expect-error>
       </target>
  
  
  
  1.3       +1 -20     jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/builder/ConvertingModelBuilder.java
  
  Index: ConvertingModelBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/builder/ConvertingModelBuilder.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ConvertingModelBuilder.java	13 Jun 2002 07:27:01 -0000	1.2
  +++ ConvertingModelBuilder.java	2 Jul 2002 12:32:34 -0000	1.3
  @@ -39,25 +39,6 @@
           // Put a new version attribute.
           model.setAttribute( DefaultProjectBuilder.VERSION_ATTRIBUTE, "2.0" );
   
  -        // Move all the non <target> elements (implicit target) to before
  -        // any <target> elements.
  -        final ModelElement[] children = model.getChildren();
  -        int insertPos = 0;
  -        for( int i = 0; i < children.length; i++ )
  -        {
  -            final ModelElement child = children[ i ];
  -
  -            if( !child.getName().equals( "target" ) )
  -            {
  -                if( i > insertPos )
  -                {
  -                    model.removeChild( child );
  -                    model.addChild( insertPos, child );
  -                }
  -                insertPos++;
  -            }
  -        }
  -
           // Add an "import" task for the ant1 tasks - this is the first
           // Task in the implicit target.
           final ModelElement typelibDeclaration =
  
  
  
  1.85      +6 -35     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.84
  retrieving revision 1.85
  diff -u -r1.84 -r1.85
  --- DefaultProjectBuilder.java	2 Jul 2002 10:47:20 -0000	1.84
  +++ DefaultProjectBuilder.java	2 Jul 2002 12:32:34 -0000	1.85
  @@ -10,8 +10,6 @@
   import java.io.File;
   import java.net.MalformedURLException;
   import java.net.URL;
  -import java.util.ArrayList;
  -import java.util.List;
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.excalibur.io.FileUtil;
  @@ -117,11 +115,7 @@
   
               verifyVersion( version );
   
  -            final ArrayList targetList = new ArrayList();
  -            buildTopLevelProject( model, targetList );
  -
  -            final Target[] targets =
  -                (Target[])targetList.toArray( new Target[ targetList.size() ] );
  +            final Target[] targets = buildTopLevelProject( model );
   
               return new Project( projectName,
                                   description,
  @@ -272,39 +266,16 @@
        * @param model the model
        * @throws ProjectException if an error occurs
        */
  -    private void buildTopLevelProject( final ModelElement model,
  -                                       final List targets )
  +    protected Target[] buildTopLevelProject( final ModelElement model )
           throws Exception
       {
  -        final ModelElement implicit = new ModelElement( "target", model.getLocation() );
  +        final ModelElement implicit = new ModelElement( "target-impl", model.getLocation()
);
           implicit.setAttribute( "name", Project.IMPLICIT_TARGET_NAME );
   
           final ModelElement[] children = model.getChildren();
  +        implicit.addChildren( children );
   
  -        int pos = 0;
  -        for( ; pos < children.length && ! children[ pos ].getName().equals(
"target" ); pos++ )
  -        {
  -            implicit.addChild( children[ pos ] );
  -        }
  -        targets.add( createTarget( implicit ) );
  -
  -        for( ; pos < children.length; pos++ )
  -        {
  -            final ModelElement element = children[ pos ];
  -            final String name = element.getName();
  -            if( name.equals( "target" ) )
  -            {
  -                targets.add( createTarget( element ) );
  -            }
  -            else
  -            {
  -                final String message =
  -                    REZ.getString( "ant.unknown-toplevel-element.error",
  -                                   name,
  -                                   element.getLocation() );
  -                throw new ProjectException( message );
  -            }
  -        }
  +        return new Target[] { createTarget( implicit ) };
       }
   
       /**
  
  
  
  1.18      +0 -1      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/builder/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/builder/Resources.properties,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- Resources.properties	27 Jun 2002 11:13:07 -0000	1.17
  +++ Resources.properties	2 Jul 2002 12:32:34 -0000	1.18
  @@ -12,7 +12,6 @@
   ant.project-parse.error=Could not parse project file.
   ant.project-build.error=Could not load project from "{0}".
   ant.no-project-element.error=Project file must be enclosed in project element.
  -ant.unknown-toplevel-element.error=Unknown top-level element {0} at {1}.
   ant.malformed.version=Project has an invalid version "{0}".
   ant.version-missing.error=Project has no version attribute.
   ant.bad-version.error=Incompatible build file version detected. Expected version {0} but
found version {1}.
  
  
  
  1.19      +2 -1      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/Resources.properties,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- Resources.properties	27 Jun 2002 11:13:08 -0000	1.18
  +++ Resources.properties	2 Jul 2002 12:32:35 -0000	1.19
  @@ -13,8 +13,9 @@
   duplicate-projectrefs.error=Multiple project references with name "{0}".
   bad-projectref-name.error=Invalid project reference name "{0}".
   no-projectref-location.error=No project location specified for project reference.
  -no-target-name.error=No target name.
  +no-target-name.error=No target name specified.
   bad-target-name.error=Invalid target name "{0}".
  +duplicate-targets.error=Multiple targets with name "{0}".
   
   #DefaultTaskContext
   unknown-prop.error=Unknown property {0}.
  
  
  
  1.2       +1 -5      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/model/AbstractUnit.java
  
  Index: AbstractUnit.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/model/AbstractUnit.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractUnit.java	13 Jun 2002 02:59:25 -0000	1.1
  +++ AbstractUnit.java	2 Jul 2002 12:32:35 -0000	1.2
  @@ -36,10 +36,6 @@
       protected AbstractUnit( final String name,
                               final String description )
       {
  -        if( null == name )
  -        {
  -            throw new NullPointerException( "name" );
  -        }
           m_name = name;
           m_description = description;
       }
  
  
  
  1.2       +1 -1      jakarta-ant-myrmidon/ant1compat/src/conf/ant-types.xml
  
  Index: ant-types.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/ant1compat/src/conf/ant-types.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ant-types.xml	23 Jun 2002 10:56:50 -0000	1.1
  +++ ant-types.xml	2 Jul 2002 12:32:35 -0000	1.2
  @@ -2,7 +2,7 @@
   
       <types>
           <!-- Target task -->
  -        <task name="target"
  +        <task name="target-impl"
               impl="org.apache.tools.ant.Ant1CompatTargetTask"/>
   
           <!-- Type instance tasks -->
  
  
  
  1.5       +3 -3      jakarta-ant-myrmidon/ant1compat/src/java/org/apache/tools/ant/Ant1CompatTargetTask.java
  
  Index: Ant1CompatTargetTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/ant1compat/src/java/org/apache/tools/ant/Ant1CompatTargetTask.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Ant1CompatTargetTask.java	2 Jul 2002 02:12:07 -0000	1.4
  +++ Ant1CompatTargetTask.java	2 Jul 2002 12:32:35 -0000	1.5
  @@ -9,7 +9,7 @@
   
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.api.metadata.ModelElement;
  -import org.apache.myrmidon.framework.project.TargetTask;
  +import org.apache.myrmidon.framework.project.TargetImplTask;
   
   /**
    * An Ant1 compatible version of &gt;target/&lt;, which allows
  @@ -19,7 +19,7 @@
    * @version $Revision$ $Date$
    */
   public class Ant1CompatTargetTask
  -    extends TargetTask
  +    extends TargetImplTask
   {
       private String m_ifCondition;
       private String m_unlessCondition;
  
  
  

--
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