ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/oldmodel Target.java
Date Sun, 05 May 2002 13:57:00 GMT
donaldp     02/05/05 06:57:00

  Modified:    container/src/java/org/apache/myrmidon/components/workspace
                        DefaultWorkspace.java
               container/src/java/org/apache/myrmidon/interfaces/oldmodel
                        Target.java
  Log:
  The Workspace is no longer responsible for "executing" each task anymore.
  
  It is now done by the TargetTask task... slowly getting there.
  
  Revision  Changes    Path
  1.54      +31 -29    jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/DefaultWorkspace.java
  
  Index: DefaultWorkspace.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/DefaultWorkspace.java,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- DefaultWorkspace.java	3 May 2002 06:56:11 -0000	1.53
  +++ DefaultWorkspace.java	5 May 2002 13:57:00 -0000	1.54
  @@ -36,7 +36,7 @@
    * This is the default implementation of Workspace.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.53 $ $Date: 2002/05/03 06:56:11 $
  + * @version $Revision: 1.54 $ $Date: 2002/05/05 13:57:00 $
    */
   public class DefaultWorkspace
       extends AbstractLogEnabled
  @@ -349,48 +349,50 @@
                                         final Target target )
           throws TaskException
       {
  -        final Project project = entry.getProject();
  -
  -        if( getLogger().isDebugEnabled() )
  -        {
  -            final String message = REZ.getString( "exec-target.notice",
  -                                                  project.getProjectName(), name );
  -            getLogger().debug( message );
  -        }
  +        final ModelElement targetModel =
  +            new ModelElement( "target",
  +                              target.getLocation() );
  +        targetModel.setAttribute( "name", name );
   
  -        final ExecutionFrame parentFrame = entry.getFrame();
  -        final ExecutionFrame frame =
  -            parentFrame.createChildFrame( name, null, false );
  +        final String depends = buildDepends( target.getDependencies() );
  +        targetModel.setAttribute( "depends", depends );
   
  -        // Execute all tasks assciated with target
           final ModelElement[] tasks = target.getTasks();
           for( int i = 0; i < tasks.length; i++ )
           {
  -            executeTask( tasks[ i ], frame );
  +            targetModel.addChild( tasks[ i ] );
           }
  +
  +        m_executor.execute( targetModel, entry.getFrame() );
       }
   
       /**
  -     * Execute a task.
  +     * Temporary method to build a depends string from an
  +     * already parsed set of dependencies.
        *
  -     * @param task the task definition
  -     * @param frame the frame to execute in
  -     * @exception TaskException if an error occurs
  +     * @param dependencies the dependencies
  +     * @return the depends string
        */
  -    private void executeTask( final ModelElement task,
  -                              final ExecutionFrame frame )
  -        throws TaskException
  +    private String buildDepends( final Dependency[] dependencies )
       {
  -        final String name = task.getName();
  -
  -        if( getLogger().isDebugEnabled() )
  +        if( null == dependencies )
           {
  -            final String message = REZ.getString( "exec-task.notice", name );
  -            getLogger().debug( message );
  +            return null;
           }
  +        else
  +        {
  +            final StringBuffer sb = new StringBuffer();
  +            for( int i = 0; i < dependencies.length; i++ )
  +            {
  +                if( 0 != i )
  +                {
  +                    sb.append( ',' );
  +                }
   
  -        //run task
  -        m_executor.execute( task, frame );
  -    }
  +                sb.append( dependencies[ i ] );
  +            }
   
  +            return sb.toString();
  +        }
  +    }
   }
  
  
  
  1.2       +11 -1     jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/oldmodel/Target.java
  
  Index: Target.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/oldmodel/Target.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Target.java	28 Apr 2002 05:04:49 -0000	1.1
  +++ Target.java	5 May 2002 13:57:00 -0000	1.2
  @@ -14,7 +14,7 @@
    * Targets in build file.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.1 $ $Date: 2002/04/28 05:04:49 $
  + * @version $Revision: 1.2 $ $Date: 2002/05/05 13:57:00 $
    */
   public class Target
   {
  @@ -41,6 +41,16 @@
                   m_dependencies.add( dependencies[ i ] );
               }
           }
  +    }
  +
  +    /**
  +     * Return location in build file.
  +     *
  +     * @return the location in build file
  +     */
  +    public String getLocation()
  +    {
  +        return "Target.getLocation() not implemented yet";
       }
   
       /**
  
  
  

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