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/taskdefs/unix Chmod.java
Date Sun, 03 Feb 2002 03:46:55 GMT
donaldp     02/02/02 19:46:55

  Modified:    proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs
                        Available.java Checksum.java ConditionTask.java
                        Input.java PathConvert.java Property.java
                        Tstamp.java UpToDate.java WaitFor.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec
                        ExecTask.java ExecuteOn.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit
                        JUnitTask.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce
                        P4Change.java P4Counter.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/unix
                        Chmod.java
  Log:
  Inline some method that were causing issues with some tasks
  
  Revision  Changes    Path
  1.20      +4 -1      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Available.java
  
  Index: Available.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Available.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- Available.java	20 Jan 2002 17:35:00 -0000	1.19
  +++ Available.java	3 Feb 2002 03:46:54 -0000	1.20
  @@ -11,6 +11,7 @@
   import java.net.URL;
   import java.net.URLClassLoader;
   import org.apache.myrmidon.api.TaskException;
  +import org.apache.myrmidon.api.AbstractTask;
   import org.apache.tools.ant.Task;
   import org.apache.tools.ant.taskdefs.condition.Condition;
   
  @@ -165,7 +166,9 @@
   
           if( eval() )
           {
  -            setProperty( m_property, m_value );
  +            final String name = m_property;
  +            final Object value = m_value;
  +            getContext().setProperty( name, value );
           }
       }
   
  
  
  
  1.16      +7 -3      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Checksum.java
  
  Index: Checksum.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Checksum.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- Checksum.java	26 Jan 2002 02:08:10 -0000	1.15
  +++ Checksum.java	3 Feb 2002 03:46:54 -0000	1.16
  @@ -23,6 +23,7 @@
   import java.util.Hashtable;
   import org.apache.avalon.excalibur.io.IOUtil;
   import org.apache.myrmidon.api.TaskException;
  +import org.apache.myrmidon.api.AbstractTask;
   import org.apache.tools.ant.taskdefs.condition.Condition;
   import org.apache.tools.ant.types.DirectoryScanner;
   import org.apache.tools.ant.types.FileSet;
  @@ -201,7 +202,9 @@
           final boolean value = validateAndExecute();
           if( m_verifyProperty != null )
           {
  -            setProperty( m_verifyProperty, new Boolean( value ).toString() );
  +            final String name = m_verifyProperty;
  +            final Object value1 = new Boolean( value ).toString();
  +            getContext().setProperty( name, value1 );
           }
       }
   
  @@ -298,14 +301,15 @@
               Object destination = m_includeFileMap.get( src );
               if( destination instanceof String )
               {
  -                String prop = (String)destination;
  +                final String prop = (String)destination;
                   if( m_isCondition )
                   {
                       checksumMatches = checksum.equals( m_property );
                   }
                   else
                   {
  -                    setProperty( prop, checksum );
  +                    final Object value = checksum;
  +                    getContext().setProperty( prop, value );
                   }
               }
               else if( destination instanceof File )
  
  
  
  1.6       +5 -2      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ConditionTask.java
  
  Index: ConditionTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ConditionTask.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ConditionTask.java	23 Dec 2001 06:33:35 -0000	1.5
  +++ ConditionTask.java	3 Feb 2002 03:46:54 -0000	1.6
  @@ -8,6 +8,7 @@
   package org.apache.tools.ant.taskdefs;
   
   import org.apache.myrmidon.api.TaskException;
  +import org.apache.myrmidon.api.AbstractTask;
   import org.apache.tools.ant.taskdefs.condition.Condition;
   import org.apache.tools.ant.taskdefs.condition.ConditionBase;
   
  @@ -21,7 +22,7 @@
    * This task does not extend Task to take advantage of ConditionBase.</p>
    *
    * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
  - * @version $Revision: 1.5 $
  + * @version $Revision: 1.6 $
    */
   public class ConditionTask extends ConditionBase
   {
  @@ -71,7 +72,9 @@
           Condition c = (Condition)getConditions().nextElement();
           if( c.eval() )
           {
  -            setProperty( property, value );
  +            final String name = property;
  +            final Object value1 = value;
  +            getContext().setProperty( name, value1 );
           }
       }
   }
  
  
  
  1.13      +4 -1      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Input.java
  
  Index: Input.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Input.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Input.java	6 Jan 2002 02:01:29 -0000	1.12
  +++ Input.java	3 Feb 2002 03:46:54 -0000	1.13
  @@ -13,6 +13,7 @@
   import java.util.ArrayList;
   import java.util.StringTokenizer;
   import org.apache.myrmidon.api.TaskException;
  +import org.apache.myrmidon.api.AbstractTask;
   import org.apache.tools.ant.Task;
   
   /**
  @@ -142,7 +143,9 @@
           // adopted from org.apache.tools.ant.taskdefs.Property
           if( addproperty != null )
           {
  -            setProperty( addproperty, input );
  +            final String name = addproperty;
  +            final Object value = input;
  +            getContext().setProperty( name, value );
           }
       }
   }
  
  
  
  1.14      +4 -2      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PathConvert.java
  
  Index: PathConvert.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PathConvert.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- PathConvert.java	20 Jan 2002 17:35:00 -0000	1.13
  +++ PathConvert.java	3 Feb 2002 03:46:54 -0000	1.14
  @@ -10,6 +10,7 @@
   import java.io.File;
   import java.util.ArrayList;
   import org.apache.myrmidon.api.TaskException;
  +import org.apache.myrmidon.api.AbstractTask;
   import org.apache.tools.ant.Task;
   import org.apache.tools.ant.types.Path;
   
  @@ -156,11 +157,12 @@
           }
   
           // Place the result into the specified property
  -        String value = rslt.toString();
  +        final String value = rslt.toString();
   
           getLogger().debug( "Set property " + m_property + " = " + value );
   
  -        setProperty( m_property, value );
  +        final String name = m_property;
  +        getContext().setProperty( name, value );
       }
   
       /**
  
  
  
  1.28      +5 -2      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Property.java
  
  Index: Property.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Property.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- Property.java	20 Jan 2002 17:35:00 -0000	1.27
  +++ Property.java	3 Feb 2002 03:46:54 -0000	1.28
  @@ -15,6 +15,7 @@
   import java.util.Iterator;
   import java.util.Properties;
   import org.apache.myrmidon.api.TaskException;
  +import org.apache.myrmidon.api.AbstractTask;
   import org.apache.tools.ant.Task;
   import org.apache.tools.ant.types.Path;
   import org.apache.tools.ant.types.PathUtil;
  @@ -76,7 +77,9 @@
   
           if( ( m_name != null ) && ( m_value != null ) )
           {
  -            setProperty( m_name, m_value );
  +            final String name = m_name;
  +            final Object value = m_value;
  +            getContext().setProperty( name, value );
           }
   
           if( m_resource != null ) {
  @@ -115,7 +118,7 @@
           {
               final String name = (String)e.next();
               final String value = (String)props.getProperty( name );
  -            setProperty( name, value );
  +            getContext().setProperty( name, value );
           }
       }
   
  
  
  
  1.13      +10 -3     jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Tstamp.java
  
  Index: Tstamp.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Tstamp.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Tstamp.java	6 Jan 2002 02:00:14 -0000	1.12
  +++ Tstamp.java	3 Feb 2002 03:46:54 -0000	1.13
  @@ -18,6 +18,7 @@
   import java.util.StringTokenizer;
   import java.util.TimeZone;
   import org.apache.myrmidon.api.TaskException;
  +import org.apache.myrmidon.api.AbstractTask;
   import org.apache.tools.ant.Task;
   import org.apache.tools.ant.types.EnumeratedAttribute;
   
  @@ -60,13 +61,19 @@
               Date d = new Date();
   
               SimpleDateFormat dstamp = new SimpleDateFormat( "yyyyMMdd" );
  -            setProperty( m_prefix + "DSTAMP", dstamp.format( d ) );
  +            final String name = m_prefix + "DSTAMP";
  +            final Object value = dstamp.format( d );
  +            getContext().setProperty( name, value );
   
               SimpleDateFormat tstamp = new SimpleDateFormat( "HHmm" );
  -            setProperty( m_prefix + "TSTAMP", tstamp.format( d ) );
  +            final String name1 = m_prefix + "TSTAMP";
  +            final Object value1 = tstamp.format( d );
  +            getContext().setProperty( name1, value1 );
   
               SimpleDateFormat today = new SimpleDateFormat( "MMMM d yyyy", Locale.US );
  -            setProperty( m_prefix + "TODAY", today.format( d ) );
  +            final String name2 = m_prefix + "TODAY";
  +            final Object value2 = today.format( d );
  +            getContext().setProperty( name2, value2 );
   
               Iterator i = customFormats.iterator();
               while( i.hasNext() )
  
  
  
  1.20      +4 -1      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/UpToDate.java
  
  Index: UpToDate.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/UpToDate.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- UpToDate.java	26 Jan 2002 02:08:10 -0000	1.19
  +++ UpToDate.java	3 Feb 2002 03:46:54 -0000	1.20
  @@ -11,6 +11,7 @@
   import java.util.ArrayList;
   import java.util.Iterator;
   import org.apache.myrmidon.api.TaskException;
  +import org.apache.myrmidon.api.AbstractTask;
   import org.apache.tools.ant.types.DirectoryScanner;
   import org.apache.tools.ant.taskdefs.condition.Condition;
   import org.apache.tools.ant.types.FileSet;
  @@ -148,7 +149,9 @@
           boolean upToDate = eval();
           if( upToDate )
           {
  -            setProperty( _property, this.getValue() );
  +            final String name = _property;
  +            final Object value = this.getValue();
  +            getContext().setProperty( name, value );
               if( mapperElement == null )
               {
                   getLogger().debug( "File \"" + _targetFile.getAbsolutePath() + "\" is up
to date." );
  
  
  
  1.5       +3 -1      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/WaitFor.java
  
  Index: WaitFor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/WaitFor.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- WaitFor.java	23 Dec 2001 06:33:35 -0000	1.4
  +++ WaitFor.java	3 Feb 2002 03:46:54 -0000	1.5
  @@ -9,6 +9,7 @@
   
   import java.util.Hashtable;
   import org.apache.myrmidon.api.TaskException;
  +import org.apache.myrmidon.api.AbstractTask;
   import org.apache.tools.ant.taskdefs.condition.Condition;
   import org.apache.tools.ant.taskdefs.condition.ConditionBase;
   import org.apache.tools.ant.types.EnumeratedAttribute;
  @@ -134,7 +135,8 @@
   
           if( timeoutProperty != null )
           {
  -            setProperty( timeoutProperty, "true" );
  +            final String name = timeoutProperty;
  +            getContext().setProperty( name, "true" );
           }
       }
   
  
  
  
  1.19      +8 -4      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/ExecTask.java
  
  Index: ExecTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/ExecTask.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- ExecTask.java	20 Jan 2002 17:35:01 -0000	1.18
  +++ ExecTask.java	3 Feb 2002 03:46:54 -0000	1.19
  @@ -18,6 +18,7 @@
   import java.util.Properties;
   import org.apache.avalon.excalibur.util.StringUtil;
   import org.apache.myrmidon.api.TaskException;
  +import org.apache.myrmidon.api.AbstractTask;
   import org.apache.tools.ant.Task;
   import org.apache.tools.ant.types.Argument;
   import org.apache.tools.ant.types.Commandline;
  @@ -215,7 +216,7 @@
           maybeSetResultPropertyValue( err );
           if( 0 != err )
           {
  -            throw new TaskException( getName() + " returned: " + err );
  +            throw new TaskException( getContext().getName() + " returned: " + err );
           }
   
           if( null != m_byteArrayOutput )
  @@ -238,7 +239,9 @@
               }
               val.append( line );
           }
  -        setProperty( m_outputProperty, val.toString() );
  +        final String name = m_outputProperty;
  +        final Object value = val.toString();
  +        getContext().setProperty( name, value );
       }
   
       /**
  @@ -332,10 +335,11 @@
       protected void maybeSetResultPropertyValue( int result )
           throws TaskException
       {
  -        String res = Integer.toString( result );
  +        final String res = Integer.toString( result );
           if( m_resultProperty != null )
           {
  -            setProperty( m_resultProperty, res );
  +            final String name = m_resultProperty;
  +            getContext().setProperty( name, res );
           }
       }
   
  
  
  
  1.8       +3 -2      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/ExecuteOn.java
  
  Index: ExecuteOn.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/ExecuteOn.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ExecuteOn.java	26 Jan 2002 02:08:10 -0000	1.7
  +++ ExecuteOn.java	3 Feb 2002 03:46:54 -0000	1.8
  @@ -13,6 +13,7 @@
   import java.util.Hashtable;
   import org.apache.avalon.excalibur.util.StringUtil;
   import org.apache.myrmidon.api.TaskException;
  +import org.apache.myrmidon.api.AbstractTask;
   import org.apache.tools.ant.types.DirectoryScanner;
   import org.apache.tools.ant.types.FileSet;
   import org.apache.tools.ant.types.Marker;
  @@ -117,7 +118,7 @@
       {
           if( m_srcFilePos != null )
           {
  -            throw new TaskException( getName() + " doesn\'t support multiple srcfile elements."
);
  +            throw new TaskException( getContext().getName() + " doesn\'t support multiple
srcfile elements." );
           }
           m_srcFilePos = getCommand().createMarker();
           return m_srcFilePos;
  @@ -132,7 +133,7 @@
       {
           if( m_targetFilePos != null )
           {
  -            throw new TaskException( getName() + " doesn\'t support multiple targetfile
elements." );
  +            throw new TaskException( getContext().getName() + " doesn\'t support multiple
targetfile elements." );
           }
           m_targetFilePos = getCommand().createMarker();
           m_srcIsFirst = ( m_srcFilePos != null );
  
  
  
  1.32      +5 -2      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- JUnitTask.java	27 Jan 2002 02:31:48 -0000	1.31
  +++ JUnitTask.java	3 Feb 2002 03:46:54 -0000	1.32
  @@ -20,6 +20,7 @@
   import java.util.Properties;
   import java.util.Random;
   import org.apache.myrmidon.api.TaskException;
  +import org.apache.myrmidon.api.AbstractTask;
   import org.apache.tools.ant.Task;
   import org.apache.tools.ant.taskdefs.exec.Execute2;
   import org.apache.tools.ant.taskdefs.exec.LogOutputStream;
  @@ -543,11 +544,13 @@
                   getLogger().error( message );
                   if( errorOccurredHere && test.getErrorProperty() != null )
                   {
  -                    setProperty( test.getErrorProperty(), "true" );
  +                    final String name = test.getErrorProperty();
  +                    getContext().setProperty( name, "true" );
                   }
                   if( failureOccurredHere && test.getFailureProperty() != null )
                   {
  -                    setProperty( test.getFailureProperty(), "true" );
  +                    final String name = test.getFailureProperty();
  +                    getContext().setProperty( name, "true" );
                   }
               }
           }
  
  
  
  1.8       +2 -1      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java
  
  Index: P4Change.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- P4Change.java	6 Jan 2002 02:30:43 -0000	1.7
  +++ P4Change.java	3 Feb 2002 03:46:54 -0000	1.8
  @@ -8,6 +8,7 @@
   package org.apache.tools.ant.taskdefs.optional.perforce;
   
   import org.apache.myrmidon.api.TaskException;
  +import org.apache.myrmidon.api.AbstractTask;
   
   /**
    * P4Change - grab a new changelist from Perforce. P4Change creates a new
  @@ -138,7 +139,7 @@
               getLogger().info( "Change Number is " + changenumber );
               try
               {
  -                setProperty( "p4.change", "" + changenumber );
  +                getContext().setProperty( "p4.change", "" + changenumber );
               }
               catch( final TaskException te )
               {
  
  
  
  1.8       +4 -1      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java
  
  Index: P4Counter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- P4Counter.java	6 Jan 2002 02:30:43 -0000	1.7
  +++ P4Counter.java	3 Feb 2002 03:46:54 -0000	1.8
  @@ -8,6 +8,7 @@
   package org.apache.tools.ant.taskdefs.optional.perforce;
   
   import org.apache.myrmidon.api.TaskException;
  +import org.apache.myrmidon.api.AbstractTask;
   
   /**
    * P4Counter - Obtain or set the value of a counter. P4Counter can be used to
  @@ -77,7 +78,9 @@
               try
               {
                   m_value = Integer.parseInt( line );
  -                setProperty( m_property, "" + m_value );
  +                final String name = m_property;
  +                final Object value = "" + m_value;
  +                getContext().setProperty( name, value );
               }
               catch( final TaskException te )
               {
  
  
  
  1.15      +3 -2      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/unix/Chmod.java
  
  Index: Chmod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/unix/Chmod.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Chmod.java	27 Jan 2002 09:42:39 -0000	1.14
  +++ Chmod.java	3 Feb 2002 03:46:55 -0000	1.15
  @@ -11,6 +11,7 @@
   import java.io.IOException;
   import org.apache.aut.nativelib.Os;
   import org.apache.myrmidon.api.TaskException;
  +import org.apache.myrmidon.api.AbstractTask;
   import org.apache.myrmidon.framework.Pattern;
   import org.apache.myrmidon.framework.PatternSet;
   import org.apache.tools.ant.taskdefs.exec.Execute;
  @@ -72,7 +73,7 @@
       public void setExecutable( String e )
           throws TaskException
       {
  -        throw new TaskException( getName() + " doesn\'t support the executable attribute"
);
  +        throw new TaskException( getContext().getName() + " doesn\'t support the executable
attribute" );
       }
   
       public void setFile( File src )
  @@ -103,7 +104,7 @@
   
       public void setSkipEmptyFilesets( final boolean skip )
       {
  -        final String message = getName() + " doesn\'t support the skipemptyfileset attribute";
  +        final String message = getContext().getName() + " doesn\'t support the skipemptyfileset
attribute";
           throw new IllegalArgumentException( message );
       }
   
  
  
  

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