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/proposal/myrmidon/src/main/org/apache/tools/ant Target.java
Date Sun, 16 Dec 2001 05:12:39 GMT
donaldp     01/12/15 21:12:39

  Modified:    proposal/myrmidon/src/main/org/apache/tools/ant Target.java
  Log:
  Remove if/unless checking from target. It was insanity to have it there in the first place
and has been the cause of much confusion.
  
  Revision  Changes    Path
  1.6       +9 -59     jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/Target.java
  
  Index: Target.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/Target.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Target.java	2001/12/16 05:07:19	1.5
  +++ Target.java	2001/12/16 05:12:39	1.6
  @@ -17,11 +17,8 @@
    *
    * @author James Davidson <a href="mailto:duncan@x180.com">duncan@x180.com</a>
    */
  -
   public class Target
   {
  -    private String ifCondition = "";
  -    private String unlessCondition = "";
       private Vector dependencies = new Vector( 2 );
       private Vector children = new Vector( 5 );
       private String description = null;
  @@ -71,11 +68,6 @@
           this.description = description;
       }
   
  -    public void setIf( String property )
  -    {
  -        this.ifCondition = ( property == null ) ? "" : property;
  -    }
  -
       public void setName( String name )
       {
           this.name = name;
  @@ -86,11 +78,6 @@
           this.project = project;
       }
   
  -    public void setUnless( String property )
  -    {
  -        this.unlessCondition = ( property == null ) ? "" : property;
  -    }
  -
       public Enumeration getDependencies()
       {
           return dependencies.elements();
  @@ -166,31 +153,18 @@
       public void execute()
           throws TaskException
       {
  -        if( testIfCondition() && testUnlessCondition() )
  +        Enumeration enum = children.elements();
  +        while( enum.hasMoreElements() )
           {
  -            Enumeration enum = children.elements();
  -            while( enum.hasMoreElements() )
  +            Object o = enum.nextElement();
  +            if( o instanceof Task )
               {
  -                Object o = enum.nextElement();
  -                if( o instanceof Task )
  -                {
  -                    Task task = (Task)o;
  -                    task.perform();
  -                }
  -                else
  -                {
  -                }
  +                Task task = (Task)o;
  +                task.perform();
               }
  -        }
  -        else if( !testIfCondition() )
  -        {
  -            project.log( this, "Skipped because property '" + this.ifCondition + "' not
set.",
  -                         Project.MSG_VERBOSE );
  -        }
  -        else
  -        {
  -            project.log( this, "Skipped because property '" + this.unlessCondition + "'
set.",
  -                         Project.MSG_VERBOSE );
  +            else
  +            {
  +            }
           }
       }
   
  @@ -207,28 +181,4 @@
               children.setElementAt( o, index );
           }
       }
  -
  -    private boolean testIfCondition()
  -        throws TaskException
  -    {
  -        if( "".equals( ifCondition ) )
  -        {
  -            return true;
  -        }
  -
  -        String test = project.replaceProperties( ifCondition );
  -        return project.getProperty( test ) != null;
  -    }
  -
  -    private boolean testUnlessCondition()
  -        throws TaskException
  -    {
  -        if( "".equals( unlessCondition ) )
  -        {
  -            return true;
  -        }
  -        String test = project.replaceProperties( unlessCondition );
  -        return project.getProperty( test ) == null;
  -    }
  -
   }
  
  
  

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