ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From darr...@apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/test/org/apache/tools/ant/test antcall-task-test.xml Ant1CompatTestCase.java ant-task-test.xml basic-test.xml if-unless-test.xml
Date Sat, 30 Mar 2002 06:56:05 GMT
darrell     02/03/29 22:56:05

  Modified:    proposal/myrmidon build.xml
               proposal/myrmidon/src/ant1compat ant-descriptor.xml
               proposal/myrmidon/src/ant1compat/org/apache/tools/ant
                        Ant1CompatProject.java Task.java
               proposal/myrmidon/src/ant1compat/org/apache/tools/ant/taskdefs
                        Ant.java
               proposal/myrmidon/src/java/org/apache/antlib/core
                        AbstractAntTask.java
               proposal/myrmidon/src/test/org/apache/tools/ant/test
                        Ant1CompatTestCase.java ant-task-test.xml
                        basic-test.xml if-unless-test.xml
  Added:       proposal/myrmidon/src/ant1compat/org/apache/tools/ant/taskdefs
                        AbstractAnt1AntTask.java CallTarget.java
               proposal/myrmidon/src/test/org/apache/tools/ant/test
                        antcall-task-test.xml
  Log:
  * Added <ant1.antcall> task, and test. <ant1.ant> and <ant1.antcall> now
    share a common abstract base class.
  
  * Fixed <ant1> test files so that they run under Ant1.4, for checking.
  
  * Fixed build so that ant1_todo.atl only includes the correct files.
  
  Revision  Changes    Path
  1.97      +1 -1      jakarta-ant/proposal/myrmidon/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/build.xml,v
  retrieving revision 1.96
  retrieving revision 1.97
  diff -u -r1.96 -r1.97
  --- build.xml	30 Mar 2002 01:59:31 -0000	1.96
  +++ build.xml	30 Mar 2002 06:56:04 -0000	1.97
  @@ -306,7 +306,7 @@
           <property name="regexp.package" value="${util.package}/regexp"/>
   
           <patternset id="ant1.todo.include">
  -            <include name="org/apache/tools/**" />
  +            <include name="org/apache/tools/todo/**" />
               <exclude name="${regexp.package}/JakartaRegexp*.java"
                   unless="jakarta.regexp.present" />
               <exclude name="${regexp.package}/JakartaOro*.java"
  
  
  
  1.4       +2 -6      jakarta-ant/proposal/myrmidon/src/ant1compat/ant-descriptor.xml
  
  Index: ant-descriptor.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/ant1compat/ant-descriptor.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ant-descriptor.xml	28 Mar 2002 07:30:41 -0000	1.3
  +++ ant-descriptor.xml	30 Mar 2002 06:56:04 -0000	1.4
  @@ -16,12 +16,8 @@
           <!-- Tasks specialised for myrmidon -->
           <task name="ant1.ant"
                 classname="org.apache.tools.ant.taskdefs.Ant" />
  -
  -        <!-- Tasks not currently supported.
  -
  -                <task name="ant1.antcall"
  -                    classname="org.apache.tools.ant.taskdefs.CallTarget" />
  -        -->
  +         <task name="ant1.antcall"
  +            classname="org.apache.tools.ant.taskdefs.CallTarget" />
   
           <!-- standard ant tasks -->
           <task name="ant1.mkdir"
  
  
  
  1.11      +4 -4      jakarta-ant/proposal/myrmidon/src/ant1compat/org/apache/tools/ant/Ant1CompatProject.java
  
  Index: Ant1CompatProject.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/ant1compat/org/apache/tools/ant/Ant1CompatProject.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Ant1CompatProject.java	30 Mar 2002 03:52:17 -0000	1.10
  +++ Ant1CompatProject.java	30 Mar 2002 06:56:04 -0000	1.11
  @@ -10,7 +10,7 @@
   import java.io.File;
   import java.io.IOException;
   import java.io.InputStream;
  -import java.net.URL;
  +import java.security.CodeSource;
   import java.util.Enumeration;
   import java.util.HashSet;
   import java.util.Hashtable;
  @@ -18,7 +18,6 @@
   import java.util.Map;
   import java.util.Properties;
   import java.util.Set;
  -import java.security.CodeSource;
   import org.apache.aut.converter.Converter;
   import org.apache.aut.converter.ConverterException;
   import org.apache.myrmidon.api.TaskContext;
  @@ -34,13 +33,14 @@
    * Ant1 original, this class contains the extensions.
    *
    * @author <a href="mailto:darrell@apache.org">Darrell DeBoer</a>
  - * @version $Revision: 1.10 $ $Date: 2002/03/30 03:52:17 $
  + * @version $Revision: 1.11 $ $Date: 2002/03/30 06:56:04 $
    */
   public class Ant1CompatProject extends Project
   {
       public static final String ANT1_TASK_PREFIX = "ant1.";
       public static final String MYRMIDON_PROJECT_PROP =
           org.apache.myrmidon.interfaces.model.Project.PROJECT;
  +    public static final String ANT1_PROJECT_PROP = "ant1.project";
   
       private static String javaclasspath;
   
  @@ -74,7 +74,7 @@
   
           setBaseDir( m_context.getBaseDirectory() );
           String projectName =
  -            (String) m_context.getProperty( MYRMIDON_PROJECT_PROP );
  +            (String)m_context.getProperty( MYRMIDON_PROJECT_PROP );
           if( projectName != null )
           {
               setName( projectName );
  
  
  
  1.5       +3 -4      jakarta-ant/proposal/myrmidon/src/ant1compat/org/apache/tools/ant/Task.java
  
  Index: Task.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/ant1compat/org/apache/tools/ant/Task.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Task.java	30 Mar 2002 03:52:17 -0000	1.4
  +++ Task.java	30 Mar 2002 06:56:04 -0000	1.5
  @@ -22,12 +22,11 @@
    * all of the Myrmidon-specific adaptations.
    *
    * @author <a href="mailto:darrell@apache.org">Darrell DeBoer</a>
  - * @version $Revision: 1.4 $ $Date: 2002/03/30 03:52:17 $
  + * @version $Revision: 1.5 $ $Date: 2002/03/30 06:56:04 $
    */
   public class Task extends OriginalAnt1Task
       implements org.apache.myrmidon.api.Task, Configurable
   {
  -    private static final String ANT1_PROJECT_PROP = "ant1.project";
       protected TaskContext m_context;
   
       /**
  @@ -45,11 +44,11 @@
   
           // Create/recontextualise the Ant1 Project.
           Ant1CompatProject project =
  -            (Ant1CompatProject)context.getProperty( ANT1_PROJECT_PROP );
  +            (Ant1CompatProject)context.getProperty( Ant1CompatProject.ANT1_PROJECT_PROP
);
           if( project == null )
           {
               project = createProject();
  -            m_context.setProperty( ANT1_PROJECT_PROP, project );
  +            m_context.setProperty( Ant1CompatProject.ANT1_PROJECT_PROP, project );
           }
           else
           {
  
  
  
  1.2       +28 -176   jakarta-ant/proposal/myrmidon/src/ant1compat/org/apache/tools/ant/taskdefs/Ant.java
  
  Index: Ant.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/ant1compat/org/apache/tools/ant/taskdefs/Ant.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Ant.java	28 Mar 2002 07:30:41 -0000	1.1
  +++ Ant.java	30 Mar 2002 06:56:04 -0000	1.2
  @@ -54,86 +54,47 @@
   
   package org.apache.tools.ant.taskdefs;
   
  -import org.apache.tools.ant.Task;
  -import org.apache.tools.ant.BuildException;
  -import org.apache.tools.ant.util.FileUtils;
  -import org.apache.avalon.framework.configuration.DefaultConfiguration;
  -import org.apache.avalon.framework.configuration.Configuration;
  -import org.apache.myrmidon.interfaces.executor.Executor;
  -import org.apache.myrmidon.interfaces.executor.ExecutionFrame;
  -import org.apache.myrmidon.api.TaskException;
   import java.io.File;
  -import java.util.Vector;
  -import java.util.Iterator;
  +import org.apache.avalon.framework.configuration.DefaultConfiguration;
  +import org.apache.tools.ant.util.FileUtils;
   
   /**
  - * Call Ant in a sub-project.
  - *
  - *  <pre>
  - *  &lt;target name=&quot;foo&quot; depends=&quot;init&quot;&gt;
  - *    &lt;ant antfile=&quot;build.xml&quot; target=&quot;bar&quot;
&gt;
  - *      &lt;property name=&quot;property1&quot; value=&quot;aaaaa&quot;
/&gt;
  - *      &lt;property name=&quot;foo&quot; value=&quot;baz&quot; /&gt;
  - *    &lt;/ant&gt;</SPAN>
  - *  &lt;/target&gt;</SPAN>
  - *
  - *  &lt;target name=&quot;bar&quot; depends=&quot;init&quot;&gt;
  - *    &lt;echo message=&quot;prop is ${property1} ${foo}&quot; /&gt;
  - *  &lt;/target&gt;
  - * </pre>
  - *
  + * Ant1Compat version of &lt;ant&gt;, which delegates to the Myrmidon version.
    *
    * @author costin@dnt.ro
    * @author <a href="mailto:darrell@apache.org">Darrell DeBoer</a>
    */
  -public class Ant extends Task {
  +public class Ant
  +    extends AbstractAnt1AntTask
  +{
   
       /** the basedir where is executed the build file */
       private File dir = null;
  -    
  +
       /** the build.xml file (can be absolute) in this case dir will be ignored */
       private String antFile = null;
  -    
  -    /** the target to call if any */
  -    private String target = null;
  -    
  +
       /** the output */
       private String output = null;
  -    
  -    /** should we inherit properties from the parent ? */
  -    private boolean inheritAll = true;
  -    
  +
       /** should we inherit references from the parent ? */
       private boolean inheritRefs = false;
  -    
  -    /** the properties to pass to the new project */
  -    private Vector properties = new Vector();
  -    
  -    /** the references to pass to the new project */
  -    private Vector references = new Vector();
  -
  -    /**
  -     * If true, inherit all properties from parent Project
  -     * If false, inherit only userProperties and those defined
  -     * inside the ant call itself
  -     */
  -    public void setInheritAll(boolean value) {
  -       inheritAll = value;
  -    }
   
       /**
        * If true, inherit all references from parent Project
        * If false, inherit only those defined
        * inside the ant call itself
        */
  -    public void setInheritRefs(boolean value) {
  +    public void setInheritRefs( boolean value )
  +    {
           inheritRefs = value;
       }
   
       /**
        * ...
        */
  -    public void setDir(File d) {
  +    public void setDir( File d )
  +    {
           this.dir = d;
       }
   
  @@ -142,159 +103,50 @@
        * If it is absolute, <tt>dir</tt> will be ignored, if it is
        * relative it will be resolved relative to <tt>dir</tt>.
        */
  -    public void setAntfile(String s) {
  +    public void setAntfile( String s )
  +    {
           // @note: it is a string and not a file to handle relative/absolute
           // otherwise a relative file will be resolved based on the current
           // basedir.
           this.antFile = s;
       }
   
  -    /**
  -     * set the target to execute. If none is defined it will
  -     * execute the default target of the build file
  -     */
  -    public void setTarget(String s) {
  -        this.target = s;
  -    }
  -
  -    public void setOutput(String s) {
  +    public void setOutput( String s )
  +    {
           this.output = s;
       }
   
       /** create a property to pass to the new project as a 'user property' */
  -    public Property createProperty() {
  -        Property p = new Property(true);
  -        properties.addElement( p );
  -        return p;
  -    }
  -
  -    /** 
  -     * create a reference element that identifies a data type that
  -     * should be carried over to the new project.
  -     */
  -    public void addReference(Reference r) {
  -        references.addElement(r);
  -    }
  -
  -    /**
  -     * Helper class that implements the nested &lt;reference&gt;
  -     * element of &lt;ant&gt; and &lt;antcall&gt;.
  -     */
  -    public static class Reference 
  -        extends org.apache.tools.ant.types.Reference {
  -
  -        public Reference() {super();}
  -        
  -        private String targetid=null;
  -        public void setToRefid(String targetid) { this.targetid=targetid; }
  -        public String getToRefid() { return targetid; }
  +    public Property createProperty()
  +    {
  +        return doCreateProperty();
       }
   
       /**
  -     * Called by the project to let the task do its work. This method may be
  -     * called more than once, if the task is invoked more than once.
  -     * For example,
  -     * if target1 and target2 both depend on target3, then running
  -     * "ant target1 target2" will run all tasks in target3 twice.
  -     *
  -     * @exception BuildException if something goes wrong with the build
  +     * Construct a TaskModel for the Myrmidon &lt;ant&gt; task, and configure it
  +     * with sub-class specific values (antfile).
  +     * @return the TaskModel
        */
  -    public void execute() throws BuildException
  -    {
  -        Object ant1project = unsetProject();
  -
  -        try
  -        {
  -            Configuration antConfig = buildAntTaskConfiguration();
  -
  -            executeTask( antConfig );
  -        }
  -        finally
  -        {
  -            resetProject( ant1project );
  -        }
  -    }
  -
  -    private void executeTask( Configuration antConfig )
  -    {
  -        try
  -        {
  -            Executor executor = (Executor) m_context.getService( Executor.class );
  -            ExecutionFrame frame =
  -                (ExecutionFrame) m_context.getService( ExecutionFrame.class );
  -            executor.execute( antConfig, frame );
  -        }
  -        catch( TaskException e )
  -        {
  -            throw new BuildException( e );
  -        }
  -    }
  -
  -    private Configuration buildAntTaskConfiguration()
  +    protected DefaultConfiguration buildTaskModel()
       {
           DefaultConfiguration antConfig = new DefaultConfiguration( "ant", "" );
   
  -        antConfig.setAttribute( "inherit-all", String.valueOf( inheritAll ) );
  -
  -        // Ignore inheritRefs for now ( inheritAll == inheritRefs )
  -
  -        if ( target != null )
  -        {
  -            antConfig.setAttribute( "target", target );
  -        }
  -
           // Get the "file" value.
  -        if (antFile == null) {
  +        if( antFile == null )
  +        {
               antFile = "build.xml";
           }
   
  -        if ( dir == null )
  +        if( dir == null )
           {
               dir = project.getBaseDir();
           }
   
  -        File file = FileUtils.newFileUtils().resolveFile(dir, antFile);
  +        File file = FileUtils.newFileUtils().resolveFile( dir, antFile );
           antFile = file.getAbsolutePath();
   
           antConfig.setAttribute( "file", antFile );
   
  -        // Add all of the properties.
  -        Iterator iter = properties.iterator();
  -        while( iter.hasNext() )
  -        {
  -            DefaultConfiguration param = new DefaultConfiguration( "param", "" );
  -            Property property = (Property)iter.next();
  -            param.setAttribute( "name", property.getName() );
  -            param.setAttribute( "value", property.getValue() );
  -            antConfig.addChild( param );
  -        }
           return antConfig;
  -    }
  -
  -    private void resetProject( Object ant1project ) throws BuildException
  -    {
  -        try
  -        {
  -            m_context.setProperty( "ant1.project", ant1project );
  -        }
  -        catch( TaskException e )
  -        {
  -            throw new BuildException( e );
  -        }
  -    }
  -
  -    private Object unsetProject() throws BuildException
  -    {
  -        Object ant1project = null;
  -        try
  -        {
  -            ant1project = m_context.getProperty( "ant1.project" );
  -            m_context.setProperty( "ant1.project", null );
  -        }
  -        catch( TaskException e )
  -        {
  -            throw new BuildException( e );
  -        }
  -        return ant1project;
       }
   }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/ant1compat/org/apache/tools/ant/taskdefs/AbstractAnt1AntTask.java
  
  Index: AbstractAnt1AntTask.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.tools.ant.taskdefs;
  
  import java.util.Iterator;
  import java.util.Vector;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.DefaultConfiguration;
  import org.apache.myrmidon.api.TaskException;
  import org.apache.myrmidon.interfaces.executor.ExecutionFrame;
  import org.apache.myrmidon.interfaces.executor.Executor;
  import org.apache.tools.ant.Ant1CompatProject;
  import org.apache.tools.ant.BuildException;
  import org.apache.tools.ant.Task;
  
  /**
   * A base class for Ant1 versions of &lt;ant&gt; and &lt;antcall&gt; tasks,
   * which delegate to the Myrmidon versions of these tasks.
   *
   * @author <a href="mailto:darrell@apache.org">Darrell DeBoer</a>
   * @version $Revision: 1.1 $ $Date: 2002/03/30 06:56:04 $
   */
  public abstract class AbstractAnt1AntTask
      extends Task
  {
      /** the target to call if any */
      private String target = null;
      /** should we inherit properties from the parent ? */
      private boolean inheritAll = true;
      /** the properties to pass to the new project */
      private Vector properties = new Vector();
      /** the references to pass to the new project */
      private Vector references = new Vector();
  
      /**
       * If true, inherit all properties from parent Project
       * If false, inherit only userProperties and those defined
       * inside the ant call itself
       */
      public void setInheritAll( boolean value )
      {
          inheritAll = value;
      }
  
      /**
       * set the target to execute. If none is defined it will
       * execute the default target of the build file
       */
      public void setTarget( String s )
      {
          this.target = s;
      }
  
      /**
       * Create a nested property (ant) or param (antcall) element.
       */
      protected Property doCreateProperty()
      {
          Property p = new Property( true );
          properties.addElement( p );
          return p;
      }
  
      /**
       * create a reference element that identifies a data type that
       * should be carried over to the new project.
       */
      public void addReference( Reference r )
      {
          references.addElement( r );
      }
  
      /**
       * Helper class that implements the nested &lt;reference&gt;
       * element of &lt;ant&gt; and &lt;antcall&gt;.
       */
      public static class Reference
          extends org.apache.tools.ant.types.Reference
      {
  
          public Reference()
          {
              super();
          }
  
          private String targetid = null;
  
          public void setToRefid( String targetid )
          {
              this.targetid = targetid;
          }
  
          public String getToRefid()
          {
              return targetid;
          }
      }
  
      /**
       * Removes the Ant1CompatProject from the properties, builds a TaskModel for
       * executing the Myrmidon task, and executes that TaskModel.
       * @throws BuildException on error
       */
      public void execute() throws BuildException
      {
          Object ant1project = unsetAnt1Project();
  
          try
          {
              Configuration antConfig = constructTaskModel();
  
              executeTask( antConfig );
          }
          finally
          {
              resetAnt1Project( ant1project );
          }
      }
  
      /**
       * Executes the Myrmidon task detailed in the TaskModel provided.
       * @param taskModel the TaskModel for the task to execute.
       */
      private void executeTask( Configuration taskModel )
      {
          try
          {
              Executor executor = (Executor)m_context.getService( Executor.class );
              ExecutionFrame frame =
                  (ExecutionFrame)m_context.getService( ExecutionFrame.class );
              executor.execute( taskModel, frame );
          }
          catch( TaskException e )
          {
              throw new BuildException( e );
          }
      }
  
      /**
       * Removes the Ant1CompatProject from the TaskContext properties.
       * @return the removed project
       * @throws BuildException
       */
      private Object unsetAnt1Project() throws BuildException
      {
          Object ant1project = null;
          try
          {
              ant1project =
                  m_context.getProperty( Ant1CompatProject.ANT1_PROJECT_PROP );
              m_context.setProperty( Ant1CompatProject.ANT1_PROJECT_PROP, null );
          }
          catch( TaskException e )
          {
              throw new BuildException( e );
          }
          return ant1project;
      }
  
      /**
       * Adds the Ant1CompatProject back into the TaskContext properties.
       * @param ant1project the project to add.
       * @throws BuildException
       */
      private void resetAnt1Project( Object ant1project ) throws BuildException
      {
          try
          {
              m_context.setProperty( Ant1CompatProject.ANT1_PROJECT_PROP,
                                     ant1project );
          }
          catch( TaskException e )
          {
              throw new BuildException( e );
          }
      }
  
      /**
       * Builds the TaskModel for executing the Myrmidon version of a task.
       * @return a Configuration containing the TaskModel
       */
      protected Configuration constructTaskModel()
      {
          DefaultConfiguration antConfig = buildTaskModel();
  
          antConfig.setAttribute( "inherit-all", String.valueOf( inheritAll ) );
  
          // Ignore inheritRefs for now ( inheritAll == inheritRefs )
  
          if( target != null )
          {
              antConfig.setAttribute( "target", target );
          }
  
          addProperties( antConfig );
          addReferences( antConfig );
  
          return antConfig;
      }
  
      /**
       * Create the Myrmidon TaskModel, and configure with subclass-specific config.
       */
      protected abstract DefaultConfiguration buildTaskModel();
  
      /**
       * Adds all defined properties to the supplied Task model.
       * @param taskModel
       */
      protected void addProperties( DefaultConfiguration taskModel )
      {
          // Add all of the properties.
          Iterator iter = properties.iterator();
          while( iter.hasNext() )
          {
              DefaultConfiguration param = new DefaultConfiguration( "param", "" );
              Property property = (Property)iter.next();
              param.setAttribute( "name", property.getName() );
              param.setAttribute( "value", property.getValue() );
              taskModel.addChild( param );
          }
      }
  
      /**
       * Adds all defined references to the supplied Task model.
       * @param taskModel
       */
      protected void addReferences( DefaultConfiguration taskModel )
      {
          // TODO: Handle references.
      }
  
  }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/ant1compat/org/apache/tools/ant/taskdefs/CallTarget.java
  
  Index: CallTarget.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.tools.ant.taskdefs;
  
  import org.apache.avalon.framework.configuration.DefaultConfiguration;
  
  /**
   * The Ant1Compat version of the &lt;antcall&gt; task, which delegates to the
   * Myrmidon version.
   *
   * @author <a href="mailto:darrell@apache.org">Darrell DeBoer</a>
   * @version $Revision: 1.1 $ $Date: 2002/03/30 06:56:04 $
   */
  public class CallTarget extends AbstractAnt1AntTask
  {
      /**
       * Properties are referred to as Parameters in &lt;antcall&gt;
       */
      public Property createParam()
      {
          return doCreateProperty();
      }
  
      /**
       * The only configuration not done by base class is the task name.
       */
      protected DefaultConfiguration buildTaskModel()
      {
          return new DefaultConfiguration( "ant-call", "" );
      }
  }
  
  
  
  1.2       +6 -1      jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/core/AbstractAntTask.java
  
  Index: AbstractAntTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/core/AbstractAntTask.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractAntTask.java	28 Mar 2002 07:30:41 -0000	1.1
  +++ AbstractAntTask.java	30 Mar 2002 06:56:04 -0000	1.2
  @@ -22,7 +22,7 @@
    *
    * @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/03/28 07:30:41 $
  + * @version $Revision: 1.2 $ $Date: 2002/03/30 06:56:04 $
    */
   public abstract class AbstractAntTask extends AbstractTask
   {
  @@ -37,6 +37,11 @@
        * will use default in specified build file.
        */
       private String m_target;
  +
  +    /**
  +     * The parameters/properties which will be passed to the workspace
  +     * for the target execution.
  +     */
       private final ArrayList m_parameters = new ArrayList();
   
       /**
  
  
  
  1.2       +25 -2     jakarta-ant/proposal/myrmidon/src/test/org/apache/tools/ant/test/Ant1CompatTestCase.java
  
  Index: Ant1CompatTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/test/org/apache/tools/ant/test/Ant1CompatTestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Ant1CompatTestCase.java	30 Mar 2002 01:19:17 -0000	1.1
  +++ Ant1CompatTestCase.java	30 Mar 2002 06:56:04 -0000	1.2
  @@ -15,7 +15,7 @@
    * Simple tests for the Ant1 Compatibility layer.
    *
    * @author <a href="mailto:darrell@apache.org">Darrell DeBoer</a>
  - * @version $Revision: 1.1 $ $Date: 2002/03/30 01:19:17 $
  + * @version $Revision: 1.2 $ $Date: 2002/03/30 06:56:04 $
    */
   public class Ant1CompatTestCase
       extends AbstractProjectTest
  @@ -96,8 +96,31 @@
                                       "test-prop = [set in calling task]" );
           tracker.addExpectedMessage( "property-test",
                                       "test-prop = [set in calling target]" );
  -        //        executeTarget( projectFile, "ant-setprops-test", tracker );
  +        tracker.addExpectedMessage( "property-test",
  +                                       "test-prop = [test-value]" );
  +           //        executeTarget( projectFile, "ant-setprops-test", tracker );
           executeTarget( projectFile, "ant-setprops-test" );
  +    }
  +
  +    public void testAntcallTask() throws Exception
  +    {
  +        final File projectFile = getTestResource( "antcall-task-test.xml" );
  +
  +        // TODO - Get the <ant> project listeners working, so we can test log messages.
  +
  +        LogMessageTracker tracker = new LogMessageTracker();
  +        tracker.addExpectedMessage( "default-target",
  +                                    "In default target." );
  +        tracker.addExpectedMessage( "antcall-target",
  +                                    "In antcall-target:  test-prop = [test-value]" );
  +        tracker.addExpectedMessage( "antcall-target",
  +                                    "In antcall-target:  test-prop = [set in calling task]"
);
  +        tracker.addExpectedMessage( "antcall-target",
  +                                    "In antcall-target:  test-prop = [set in calling target]"
);
  +        tracker.addExpectedMessage( "antcall-target",
  +                                    "In antcall-target:  test-prop = [test-value]" );
  +        //        executeTarget( projectFile, "ant-samefile-test", tracker );
  +        executeTarget( projectFile, "antcall-test" );
       }
   
   }
  
  
  
  1.2       +5 -2      jakarta-ant/proposal/myrmidon/src/test/org/apache/tools/ant/test/ant-task-test.xml
  
  Index: ant-task-test.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/test/org/apache/tools/ant/test/ant-task-test.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ant-task-test.xml	30 Mar 2002 01:19:17 -0000	1.1
  +++ ant-task-test.xml	30 Mar 2002 06:56:04 -0000	1.2
  @@ -1,5 +1,4 @@
   <project name="ant-task-test"
  -         description="Tests for the &lt;ant&gt; task in the Ant1 Compatibility
layer."
            default="default-target">
   
       <target name="default-target">
  @@ -47,6 +46,10 @@
           <!-- Override property in containing project -->
           <property name="test-prop" value="set in calling target"/>
           <ant antfile="subdir/build.xml" target="property-test"/>
  +
  +        <!-- Test inherit-all = false -->
  +        <ant antfile="subdir/build.xml" target="property-test"
  +             inheritall="false"/>
       </target>
   
  -</project>
  \ No newline at end of file
  +</project>
  
  
  
  1.2       +1 -2      jakarta-ant/proposal/myrmidon/src/test/org/apache/tools/ant/test/basic-test.xml
  
  Index: basic-test.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/test/org/apache/tools/ant/test/basic-test.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- basic-test.xml	30 Mar 2002 01:19:17 -0000	1.1
  +++ basic-test.xml	30 Mar 2002 06:56:04 -0000	1.2
  @@ -1,5 +1,4 @@
   <project name="ant1compat-test"
  -         description="Basic tests for the Ant1 Compatibility layer."
            default="echo-test">
   
       <property name="prop-1" value="value-1"/>
  @@ -19,4 +18,4 @@
           <echo message="Omit$, replace$$, but keep ${} and $"/>
       </target>
   
  -</project>
  \ No newline at end of file
  +</project>
  
  
  
  1.2       +1 -2      jakarta-ant/proposal/myrmidon/src/test/org/apache/tools/ant/test/if-unless-test.xml
  
  Index: if-unless-test.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/test/org/apache/tools/ant/test/if-unless-test.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- if-unless-test.xml	30 Mar 2002 01:19:17 -0000	1.1
  +++ if-unless-test.xml	30 Mar 2002 06:56:04 -0000	1.2
  @@ -1,5 +1,4 @@
   <project name="if-unless-test"
  -         description="Tests for if/unless functionality of the Ant1 Compatibility layer."
            default="if-unless-tests">
   
       <target name="if-unless-tests"
  @@ -60,4 +59,4 @@
       <target name="if-with-unless-test-3" if="prop-set" unless="prop-set">
           <echo message="Ran target: if-with-unless-test-3"/>
       </target>
  -</project>
  \ No newline at end of file
  +</project>
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/test/org/apache/tools/ant/test/antcall-task-test.xml
  
  Index: antcall-task-test.xml
  ===================================================================
  <project name="antcall-task-test"
           default="default-target">
  
      <target name="default-target">
          <echo message="In default target."/>
      </target>
  
      <target name="antcall-target">
          <property name="test-prop" value="test-value"/>
          <echo message="In antcall-target: test-prop = [${test-prop}]"/>
      </target>
  
      <!-- Basic <antcall> -->
      <target name="antcall-test">
          <!-- <antcall with default target -->
          <antcall/>
  
          <!-- <antcall> with defined target (No property overrides) -->
          <antcall target="antcall-target"/>
  
          <!-- Override property within task def -->
          <antcall target="antcall-target">
              <param name="test-prop" value="set in calling task"/>
          </antcall>
  
          <!-- Override property in containing project -->
          <property name="test-prop" value="set in calling target"/>
          <antcall target="antcall-target"/>
  
          <!-- Test inherit-all = false -->
          <antcall target="antcall-target" inheritall="false"/>
      </target>
  
  </project>
  
  
  

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