git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271112 13f79535-47bb-0310-9956-ffa450edef68master
@@ -11,6 +11,7 @@ import java.io.File; | |||||
import java.net.URL; | import java.net.URL; | ||||
import java.net.URLClassLoader; | import java.net.URLClassLoader; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.myrmidon.api.AbstractTask; | |||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
import org.apache.tools.ant.taskdefs.condition.Condition; | import org.apache.tools.ant.taskdefs.condition.Condition; | ||||
@@ -165,7 +166,9 @@ public class Available | |||||
if( eval() ) | if( eval() ) | ||||
{ | { | ||||
setProperty( m_property, m_value ); | |||||
final String name = m_property; | |||||
final Object value = m_value; | |||||
getContext().setProperty( name, value ); | |||||
} | } | ||||
} | } | ||||
@@ -23,6 +23,7 @@ import java.util.Enumeration; | |||||
import java.util.Hashtable; | import java.util.Hashtable; | ||||
import org.apache.avalon.excalibur.io.IOUtil; | import org.apache.avalon.excalibur.io.IOUtil; | ||||
import org.apache.myrmidon.api.TaskException; | 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.Condition; | ||||
import org.apache.tools.ant.types.DirectoryScanner; | import org.apache.tools.ant.types.DirectoryScanner; | ||||
import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
@@ -201,7 +202,9 @@ public class Checksum | |||||
final boolean value = validateAndExecute(); | final boolean value = validateAndExecute(); | ||||
if( m_verifyProperty != null ) | 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 @@ public class Checksum | |||||
Object destination = m_includeFileMap.get( src ); | Object destination = m_includeFileMap.get( src ); | ||||
if( destination instanceof String ) | if( destination instanceof String ) | ||||
{ | { | ||||
String prop = (String)destination; | |||||
final String prop = (String)destination; | |||||
if( m_isCondition ) | if( m_isCondition ) | ||||
{ | { | ||||
checksumMatches = checksum.equals( m_property ); | checksumMatches = checksum.equals( m_property ); | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
setProperty( prop, checksum ); | |||||
final Object value = checksum; | |||||
getContext().setProperty( prop, value ); | |||||
} | } | ||||
} | } | ||||
else if( destination instanceof File ) | else if( destination instanceof File ) | ||||
@@ -8,6 +8,7 @@ | |||||
package org.apache.tools.ant.taskdefs; | package org.apache.tools.ant.taskdefs; | ||||
import org.apache.myrmidon.api.TaskException; | 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.Condition; | ||||
import org.apache.tools.ant.taskdefs.condition.ConditionBase; | import org.apache.tools.ant.taskdefs.condition.ConditionBase; | ||||
@@ -71,7 +72,9 @@ public class ConditionTask extends ConditionBase | |||||
Condition c = (Condition)getConditions().nextElement(); | Condition c = (Condition)getConditions().nextElement(); | ||||
if( c.eval() ) | if( c.eval() ) | ||||
{ | { | ||||
setProperty( property, value ); | |||||
final String name = property; | |||||
final Object value1 = value; | |||||
getContext().setProperty( name, value1 ); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -13,6 +13,7 @@ import java.io.InputStreamReader; | |||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.StringTokenizer; | import java.util.StringTokenizer; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.myrmidon.api.AbstractTask; | |||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
/** | /** | ||||
@@ -142,7 +143,9 @@ public class Input extends Task | |||||
// adopted from org.apache.tools.ant.taskdefs.Property | // adopted from org.apache.tools.ant.taskdefs.Property | ||||
if( addproperty != null ) | if( addproperty != null ) | ||||
{ | { | ||||
setProperty( addproperty, input ); | |||||
final String name = addproperty; | |||||
final Object value = input; | |||||
getContext().setProperty( name, value ); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -10,6 +10,7 @@ package org.apache.tools.ant.taskdefs; | |||||
import java.io.File; | import java.io.File; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.myrmidon.api.AbstractTask; | |||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
@@ -156,11 +157,12 @@ public class PathConvert extends Task | |||||
} | } | ||||
// Place the result into the specified property | // Place the result into the specified property | ||||
String value = rslt.toString(); | |||||
final String value = rslt.toString(); | |||||
getLogger().debug( "Set property " + m_property + " = " + value ); | getLogger().debug( "Set property " + m_property + " = " + value ); | ||||
setProperty( m_property, value ); | |||||
final String name = m_property; | |||||
getContext().setProperty( name, value ); | |||||
} | } | ||||
/** | /** | ||||
@@ -15,6 +15,7 @@ import java.net.URLClassLoader; | |||||
import java.util.Iterator; | import java.util.Iterator; | ||||
import java.util.Properties; | import java.util.Properties; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.myrmidon.api.AbstractTask; | |||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
import org.apache.tools.ant.types.PathUtil; | import org.apache.tools.ant.types.PathUtil; | ||||
@@ -76,7 +77,9 @@ public class Property | |||||
if( ( m_name != null ) && ( m_value != null ) ) | 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 ) { | if( m_resource != null ) { | ||||
@@ -115,7 +118,7 @@ public class Property | |||||
{ | { | ||||
final String name = (String)e.next(); | final String name = (String)e.next(); | ||||
final String value = (String)props.getProperty( name ); | final String value = (String)props.getProperty( name ); | ||||
setProperty( name, value ); | |||||
getContext().setProperty( name, value ); | |||||
} | } | ||||
} | } | ||||
@@ -18,6 +18,7 @@ import java.util.NoSuchElementException; | |||||
import java.util.StringTokenizer; | import java.util.StringTokenizer; | ||||
import java.util.TimeZone; | import java.util.TimeZone; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.myrmidon.api.AbstractTask; | |||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
import org.apache.tools.ant.types.EnumeratedAttribute; | import org.apache.tools.ant.types.EnumeratedAttribute; | ||||
@@ -60,13 +61,19 @@ public class Tstamp | |||||
Date d = new Date(); | Date d = new Date(); | ||||
SimpleDateFormat dstamp = new SimpleDateFormat( "yyyyMMdd" ); | 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" ); | 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 ); | 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(); | Iterator i = customFormats.iterator(); | ||||
while( i.hasNext() ) | while( i.hasNext() ) | ||||
@@ -11,6 +11,7 @@ import java.io.File; | |||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.Iterator; | import java.util.Iterator; | ||||
import org.apache.myrmidon.api.TaskException; | 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.DirectoryScanner; | ||||
import org.apache.tools.ant.taskdefs.condition.Condition; | import org.apache.tools.ant.taskdefs.condition.Condition; | ||||
import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
@@ -148,7 +149,9 @@ public class UpToDate extends MatchingTask implements Condition | |||||
boolean upToDate = eval(); | boolean upToDate = eval(); | ||||
if( upToDate ) | if( upToDate ) | ||||
{ | { | ||||
setProperty( _property, this.getValue() ); | |||||
final String name = _property; | |||||
final Object value = this.getValue(); | |||||
getContext().setProperty( name, value ); | |||||
if( mapperElement == null ) | if( mapperElement == null ) | ||||
{ | { | ||||
getLogger().debug( "File \"" + _targetFile.getAbsolutePath() + "\" is up to date." ); | getLogger().debug( "File \"" + _targetFile.getAbsolutePath() + "\" is up to date." ); | ||||
@@ -9,6 +9,7 @@ package org.apache.tools.ant.taskdefs; | |||||
import java.util.Hashtable; | import java.util.Hashtable; | ||||
import org.apache.myrmidon.api.TaskException; | 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.Condition; | ||||
import org.apache.tools.ant.taskdefs.condition.ConditionBase; | import org.apache.tools.ant.taskdefs.condition.ConditionBase; | ||||
import org.apache.tools.ant.types.EnumeratedAttribute; | import org.apache.tools.ant.types.EnumeratedAttribute; | ||||
@@ -134,7 +135,8 @@ public class WaitFor extends ConditionBase | |||||
if( timeoutProperty != null ) | if( timeoutProperty != null ) | ||||
{ | { | ||||
setProperty( timeoutProperty, "true" ); | |||||
final String name = timeoutProperty; | |||||
getContext().setProperty( name, "true" ); | |||||
} | } | ||||
} | } | ||||
@@ -18,6 +18,7 @@ import java.util.Iterator; | |||||
import java.util.Properties; | import java.util.Properties; | ||||
import org.apache.avalon.excalibur.util.StringUtil; | import org.apache.avalon.excalibur.util.StringUtil; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.myrmidon.api.AbstractTask; | |||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
import org.apache.tools.ant.types.Argument; | import org.apache.tools.ant.types.Argument; | ||||
import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
@@ -215,7 +216,7 @@ public class ExecTask | |||||
maybeSetResultPropertyValue( err ); | maybeSetResultPropertyValue( err ); | ||||
if( 0 != err ) | if( 0 != err ) | ||||
{ | { | ||||
throw new TaskException( getName() + " returned: " + err ); | |||||
throw new TaskException( getContext().getName() + " returned: " + err ); | |||||
} | } | ||||
if( null != m_byteArrayOutput ) | if( null != m_byteArrayOutput ) | ||||
@@ -238,7 +239,9 @@ public class ExecTask | |||||
} | } | ||||
val.append( line ); | 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 @@ public class ExecTask | |||||
protected void maybeSetResultPropertyValue( int result ) | protected void maybeSetResultPropertyValue( int result ) | ||||
throws TaskException | throws TaskException | ||||
{ | { | ||||
String res = Integer.toString( result ); | |||||
final String res = Integer.toString( result ); | |||||
if( m_resultProperty != null ) | if( m_resultProperty != null ) | ||||
{ | { | ||||
setProperty( m_resultProperty, res ); | |||||
final String name = m_resultProperty; | |||||
getContext().setProperty( name, res ); | |||||
} | } | ||||
} | } | ||||
@@ -13,6 +13,7 @@ import java.util.ArrayList; | |||||
import java.util.Hashtable; | import java.util.Hashtable; | ||||
import org.apache.avalon.excalibur.util.StringUtil; | import org.apache.avalon.excalibur.util.StringUtil; | ||||
import org.apache.myrmidon.api.TaskException; | 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.DirectoryScanner; | ||||
import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
import org.apache.tools.ant.types.Marker; | import org.apache.tools.ant.types.Marker; | ||||
@@ -117,7 +118,7 @@ public class ExecuteOn | |||||
{ | { | ||||
if( m_srcFilePos != null ) | 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(); | m_srcFilePos = getCommand().createMarker(); | ||||
return m_srcFilePos; | return m_srcFilePos; | ||||
@@ -132,7 +133,7 @@ public class ExecuteOn | |||||
{ | { | ||||
if( m_targetFilePos != null ) | 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_targetFilePos = getCommand().createMarker(); | ||||
m_srcIsFirst = ( m_srcFilePos != null ); | m_srcIsFirst = ( m_srcFilePos != null ); | ||||
@@ -20,6 +20,7 @@ import java.util.Iterator; | |||||
import java.util.Properties; | import java.util.Properties; | ||||
import java.util.Random; | import java.util.Random; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.myrmidon.api.AbstractTask; | |||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
import org.apache.tools.ant.taskdefs.exec.Execute2; | import org.apache.tools.ant.taskdefs.exec.Execute2; | ||||
import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | ||||
@@ -543,11 +544,13 @@ public class JUnitTask extends Task | |||||
getLogger().error( message ); | getLogger().error( message ); | ||||
if( errorOccurredHere && test.getErrorProperty() != null ) | if( errorOccurredHere && test.getErrorProperty() != null ) | ||||
{ | { | ||||
setProperty( test.getErrorProperty(), "true" ); | |||||
final String name = test.getErrorProperty(); | |||||
getContext().setProperty( name, "true" ); | |||||
} | } | ||||
if( failureOccurredHere && test.getFailureProperty() != null ) | if( failureOccurredHere && test.getFailureProperty() != null ) | ||||
{ | { | ||||
setProperty( test.getFailureProperty(), "true" ); | |||||
final String name = test.getFailureProperty(); | |||||
getContext().setProperty( name, "true" ); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -8,6 +8,7 @@ | |||||
package org.apache.tools.ant.taskdefs.optional.perforce; | package org.apache.tools.ant.taskdefs.optional.perforce; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.myrmidon.api.AbstractTask; | |||||
/** | /** | ||||
* P4Change - grab a new changelist from Perforce. P4Change creates a new | * P4Change - grab a new changelist from Perforce. P4Change creates a new | ||||
@@ -138,7 +139,7 @@ public class P4Change | |||||
getLogger().info( "Change Number is " + changenumber ); | getLogger().info( "Change Number is " + changenumber ); | ||||
try | try | ||||
{ | { | ||||
setProperty( "p4.change", "" + changenumber ); | |||||
getContext().setProperty( "p4.change", "" + changenumber ); | |||||
} | } | ||||
catch( final TaskException te ) | catch( final TaskException te ) | ||||
{ | { | ||||
@@ -8,6 +8,7 @@ | |||||
package org.apache.tools.ant.taskdefs.optional.perforce; | package org.apache.tools.ant.taskdefs.optional.perforce; | ||||
import org.apache.myrmidon.api.TaskException; | 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 | * P4Counter - Obtain or set the value of a counter. P4Counter can be used to | ||||
@@ -77,7 +78,9 @@ public class P4Counter | |||||
try | try | ||||
{ | { | ||||
m_value = Integer.parseInt( line ); | 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 ) | catch( final TaskException te ) | ||||
{ | { | ||||
@@ -11,6 +11,7 @@ import java.io.File; | |||||
import java.io.IOException; | import java.io.IOException; | ||||
import org.apache.aut.nativelib.Os; | import org.apache.aut.nativelib.Os; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.myrmidon.api.AbstractTask; | |||||
import org.apache.myrmidon.framework.Pattern; | import org.apache.myrmidon.framework.Pattern; | ||||
import org.apache.myrmidon.framework.PatternSet; | import org.apache.myrmidon.framework.PatternSet; | ||||
import org.apache.tools.ant.taskdefs.exec.Execute; | import org.apache.tools.ant.taskdefs.exec.Execute; | ||||
@@ -72,7 +73,7 @@ public class Chmod | |||||
public void setExecutable( String e ) | public void setExecutable( String e ) | ||||
throws TaskException | 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 ) | public void setFile( File src ) | ||||
@@ -103,7 +104,7 @@ public class Chmod | |||||
public void setSkipEmptyFilesets( final boolean skip ) | 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 ); | throw new IllegalArgumentException( message ); | ||||
} | } | ||||
@@ -11,6 +11,7 @@ import java.io.File; | |||||
import java.net.URL; | import java.net.URL; | ||||
import java.net.URLClassLoader; | import java.net.URLClassLoader; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.myrmidon.api.AbstractTask; | |||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
import org.apache.tools.ant.taskdefs.condition.Condition; | import org.apache.tools.ant.taskdefs.condition.Condition; | ||||
@@ -165,7 +166,9 @@ public class Available | |||||
if( eval() ) | if( eval() ) | ||||
{ | { | ||||
setProperty( m_property, m_value ); | |||||
final String name = m_property; | |||||
final Object value = m_value; | |||||
getContext().setProperty( name, value ); | |||||
} | } | ||||
} | } | ||||
@@ -23,6 +23,7 @@ import java.util.Enumeration; | |||||
import java.util.Hashtable; | import java.util.Hashtable; | ||||
import org.apache.avalon.excalibur.io.IOUtil; | import org.apache.avalon.excalibur.io.IOUtil; | ||||
import org.apache.myrmidon.api.TaskException; | 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.Condition; | ||||
import org.apache.tools.ant.types.DirectoryScanner; | import org.apache.tools.ant.types.DirectoryScanner; | ||||
import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
@@ -201,7 +202,9 @@ public class Checksum | |||||
final boolean value = validateAndExecute(); | final boolean value = validateAndExecute(); | ||||
if( m_verifyProperty != null ) | 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 @@ public class Checksum | |||||
Object destination = m_includeFileMap.get( src ); | Object destination = m_includeFileMap.get( src ); | ||||
if( destination instanceof String ) | if( destination instanceof String ) | ||||
{ | { | ||||
String prop = (String)destination; | |||||
final String prop = (String)destination; | |||||
if( m_isCondition ) | if( m_isCondition ) | ||||
{ | { | ||||
checksumMatches = checksum.equals( m_property ); | checksumMatches = checksum.equals( m_property ); | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
setProperty( prop, checksum ); | |||||
final Object value = checksum; | |||||
getContext().setProperty( prop, value ); | |||||
} | } | ||||
} | } | ||||
else if( destination instanceof File ) | else if( destination instanceof File ) | ||||
@@ -8,6 +8,7 @@ | |||||
package org.apache.tools.ant.taskdefs; | package org.apache.tools.ant.taskdefs; | ||||
import org.apache.myrmidon.api.TaskException; | 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.Condition; | ||||
import org.apache.tools.ant.taskdefs.condition.ConditionBase; | import org.apache.tools.ant.taskdefs.condition.ConditionBase; | ||||
@@ -71,7 +72,9 @@ public class ConditionTask extends ConditionBase | |||||
Condition c = (Condition)getConditions().nextElement(); | Condition c = (Condition)getConditions().nextElement(); | ||||
if( c.eval() ) | if( c.eval() ) | ||||
{ | { | ||||
setProperty( property, value ); | |||||
final String name = property; | |||||
final Object value1 = value; | |||||
getContext().setProperty( name, value1 ); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -13,6 +13,7 @@ import java.io.InputStreamReader; | |||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.StringTokenizer; | import java.util.StringTokenizer; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.myrmidon.api.AbstractTask; | |||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
/** | /** | ||||
@@ -142,7 +143,9 @@ public class Input extends Task | |||||
// adopted from org.apache.tools.ant.taskdefs.Property | // adopted from org.apache.tools.ant.taskdefs.Property | ||||
if( addproperty != null ) | if( addproperty != null ) | ||||
{ | { | ||||
setProperty( addproperty, input ); | |||||
final String name = addproperty; | |||||
final Object value = input; | |||||
getContext().setProperty( name, value ); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -10,6 +10,7 @@ package org.apache.tools.ant.taskdefs; | |||||
import java.io.File; | import java.io.File; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.myrmidon.api.AbstractTask; | |||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
@@ -156,11 +157,12 @@ public class PathConvert extends Task | |||||
} | } | ||||
// Place the result into the specified property | // Place the result into the specified property | ||||
String value = rslt.toString(); | |||||
final String value = rslt.toString(); | |||||
getLogger().debug( "Set property " + m_property + " = " + value ); | getLogger().debug( "Set property " + m_property + " = " + value ); | ||||
setProperty( m_property, value ); | |||||
final String name = m_property; | |||||
getContext().setProperty( name, value ); | |||||
} | } | ||||
/** | /** | ||||
@@ -15,6 +15,7 @@ import java.net.URLClassLoader; | |||||
import java.util.Iterator; | import java.util.Iterator; | ||||
import java.util.Properties; | import java.util.Properties; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.myrmidon.api.AbstractTask; | |||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
import org.apache.tools.ant.types.PathUtil; | import org.apache.tools.ant.types.PathUtil; | ||||
@@ -76,7 +77,9 @@ public class Property | |||||
if( ( m_name != null ) && ( m_value != null ) ) | 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 ) { | if( m_resource != null ) { | ||||
@@ -115,7 +118,7 @@ public class Property | |||||
{ | { | ||||
final String name = (String)e.next(); | final String name = (String)e.next(); | ||||
final String value = (String)props.getProperty( name ); | final String value = (String)props.getProperty( name ); | ||||
setProperty( name, value ); | |||||
getContext().setProperty( name, value ); | |||||
} | } | ||||
} | } | ||||
@@ -18,6 +18,7 @@ import java.util.NoSuchElementException; | |||||
import java.util.StringTokenizer; | import java.util.StringTokenizer; | ||||
import java.util.TimeZone; | import java.util.TimeZone; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.myrmidon.api.AbstractTask; | |||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
import org.apache.tools.ant.types.EnumeratedAttribute; | import org.apache.tools.ant.types.EnumeratedAttribute; | ||||
@@ -60,13 +61,19 @@ public class Tstamp | |||||
Date d = new Date(); | Date d = new Date(); | ||||
SimpleDateFormat dstamp = new SimpleDateFormat( "yyyyMMdd" ); | 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" ); | 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 ); | 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(); | Iterator i = customFormats.iterator(); | ||||
while( i.hasNext() ) | while( i.hasNext() ) | ||||
@@ -11,6 +11,7 @@ import java.io.File; | |||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.Iterator; | import java.util.Iterator; | ||||
import org.apache.myrmidon.api.TaskException; | 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.DirectoryScanner; | ||||
import org.apache.tools.ant.taskdefs.condition.Condition; | import org.apache.tools.ant.taskdefs.condition.Condition; | ||||
import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
@@ -148,7 +149,9 @@ public class UpToDate extends MatchingTask implements Condition | |||||
boolean upToDate = eval(); | boolean upToDate = eval(); | ||||
if( upToDate ) | if( upToDate ) | ||||
{ | { | ||||
setProperty( _property, this.getValue() ); | |||||
final String name = _property; | |||||
final Object value = this.getValue(); | |||||
getContext().setProperty( name, value ); | |||||
if( mapperElement == null ) | if( mapperElement == null ) | ||||
{ | { | ||||
getLogger().debug( "File \"" + _targetFile.getAbsolutePath() + "\" is up to date." ); | getLogger().debug( "File \"" + _targetFile.getAbsolutePath() + "\" is up to date." ); | ||||
@@ -9,6 +9,7 @@ package org.apache.tools.ant.taskdefs; | |||||
import java.util.Hashtable; | import java.util.Hashtable; | ||||
import org.apache.myrmidon.api.TaskException; | 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.Condition; | ||||
import org.apache.tools.ant.taskdefs.condition.ConditionBase; | import org.apache.tools.ant.taskdefs.condition.ConditionBase; | ||||
import org.apache.tools.ant.types.EnumeratedAttribute; | import org.apache.tools.ant.types.EnumeratedAttribute; | ||||
@@ -134,7 +135,8 @@ public class WaitFor extends ConditionBase | |||||
if( timeoutProperty != null ) | if( timeoutProperty != null ) | ||||
{ | { | ||||
setProperty( timeoutProperty, "true" ); | |||||
final String name = timeoutProperty; | |||||
getContext().setProperty( name, "true" ); | |||||
} | } | ||||
} | } | ||||
@@ -18,6 +18,7 @@ import java.util.Iterator; | |||||
import java.util.Properties; | import java.util.Properties; | ||||
import org.apache.avalon.excalibur.util.StringUtil; | import org.apache.avalon.excalibur.util.StringUtil; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.myrmidon.api.AbstractTask; | |||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
import org.apache.tools.ant.types.Argument; | import org.apache.tools.ant.types.Argument; | ||||
import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
@@ -215,7 +216,7 @@ public class ExecTask | |||||
maybeSetResultPropertyValue( err ); | maybeSetResultPropertyValue( err ); | ||||
if( 0 != err ) | if( 0 != err ) | ||||
{ | { | ||||
throw new TaskException( getName() + " returned: " + err ); | |||||
throw new TaskException( getContext().getName() + " returned: " + err ); | |||||
} | } | ||||
if( null != m_byteArrayOutput ) | if( null != m_byteArrayOutput ) | ||||
@@ -238,7 +239,9 @@ public class ExecTask | |||||
} | } | ||||
val.append( line ); | 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 @@ public class ExecTask | |||||
protected void maybeSetResultPropertyValue( int result ) | protected void maybeSetResultPropertyValue( int result ) | ||||
throws TaskException | throws TaskException | ||||
{ | { | ||||
String res = Integer.toString( result ); | |||||
final String res = Integer.toString( result ); | |||||
if( m_resultProperty != null ) | if( m_resultProperty != null ) | ||||
{ | { | ||||
setProperty( m_resultProperty, res ); | |||||
final String name = m_resultProperty; | |||||
getContext().setProperty( name, res ); | |||||
} | } | ||||
} | } | ||||
@@ -13,6 +13,7 @@ import java.util.ArrayList; | |||||
import java.util.Hashtable; | import java.util.Hashtable; | ||||
import org.apache.avalon.excalibur.util.StringUtil; | import org.apache.avalon.excalibur.util.StringUtil; | ||||
import org.apache.myrmidon.api.TaskException; | 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.DirectoryScanner; | ||||
import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
import org.apache.tools.ant.types.Marker; | import org.apache.tools.ant.types.Marker; | ||||
@@ -117,7 +118,7 @@ public class ExecuteOn | |||||
{ | { | ||||
if( m_srcFilePos != null ) | 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(); | m_srcFilePos = getCommand().createMarker(); | ||||
return m_srcFilePos; | return m_srcFilePos; | ||||
@@ -132,7 +133,7 @@ public class ExecuteOn | |||||
{ | { | ||||
if( m_targetFilePos != null ) | 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_targetFilePos = getCommand().createMarker(); | ||||
m_srcIsFirst = ( m_srcFilePos != null ); | m_srcIsFirst = ( m_srcFilePos != null ); | ||||
@@ -20,6 +20,7 @@ import java.util.Iterator; | |||||
import java.util.Properties; | import java.util.Properties; | ||||
import java.util.Random; | import java.util.Random; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.myrmidon.api.AbstractTask; | |||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
import org.apache.tools.ant.taskdefs.exec.Execute2; | import org.apache.tools.ant.taskdefs.exec.Execute2; | ||||
import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | ||||
@@ -543,11 +544,13 @@ public class JUnitTask extends Task | |||||
getLogger().error( message ); | getLogger().error( message ); | ||||
if( errorOccurredHere && test.getErrorProperty() != null ) | if( errorOccurredHere && test.getErrorProperty() != null ) | ||||
{ | { | ||||
setProperty( test.getErrorProperty(), "true" ); | |||||
final String name = test.getErrorProperty(); | |||||
getContext().setProperty( name, "true" ); | |||||
} | } | ||||
if( failureOccurredHere && test.getFailureProperty() != null ) | if( failureOccurredHere && test.getFailureProperty() != null ) | ||||
{ | { | ||||
setProperty( test.getFailureProperty(), "true" ); | |||||
final String name = test.getFailureProperty(); | |||||
getContext().setProperty( name, "true" ); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -8,6 +8,7 @@ | |||||
package org.apache.tools.ant.taskdefs.optional.perforce; | package org.apache.tools.ant.taskdefs.optional.perforce; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.myrmidon.api.AbstractTask; | |||||
/** | /** | ||||
* P4Change - grab a new changelist from Perforce. P4Change creates a new | * P4Change - grab a new changelist from Perforce. P4Change creates a new | ||||
@@ -138,7 +139,7 @@ public class P4Change | |||||
getLogger().info( "Change Number is " + changenumber ); | getLogger().info( "Change Number is " + changenumber ); | ||||
try | try | ||||
{ | { | ||||
setProperty( "p4.change", "" + changenumber ); | |||||
getContext().setProperty( "p4.change", "" + changenumber ); | |||||
} | } | ||||
catch( final TaskException te ) | catch( final TaskException te ) | ||||
{ | { | ||||
@@ -8,6 +8,7 @@ | |||||
package org.apache.tools.ant.taskdefs.optional.perforce; | package org.apache.tools.ant.taskdefs.optional.perforce; | ||||
import org.apache.myrmidon.api.TaskException; | 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 | * P4Counter - Obtain or set the value of a counter. P4Counter can be used to | ||||
@@ -77,7 +78,9 @@ public class P4Counter | |||||
try | try | ||||
{ | { | ||||
m_value = Integer.parseInt( line ); | 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 ) | catch( final TaskException te ) | ||||
{ | { | ||||
@@ -11,6 +11,7 @@ import java.io.File; | |||||
import java.io.IOException; | import java.io.IOException; | ||||
import org.apache.aut.nativelib.Os; | import org.apache.aut.nativelib.Os; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.myrmidon.api.AbstractTask; | |||||
import org.apache.myrmidon.framework.Pattern; | import org.apache.myrmidon.framework.Pattern; | ||||
import org.apache.myrmidon.framework.PatternSet; | import org.apache.myrmidon.framework.PatternSet; | ||||
import org.apache.tools.ant.taskdefs.exec.Execute; | import org.apache.tools.ant.taskdefs.exec.Execute; | ||||
@@ -72,7 +73,7 @@ public class Chmod | |||||
public void setExecutable( String e ) | public void setExecutable( String e ) | ||||
throws TaskException | 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 ) | public void setFile( File src ) | ||||
@@ -103,7 +104,7 @@ public class Chmod | |||||
public void setSkipEmptyFilesets( final boolean skip ) | 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 ); | throw new IllegalArgumentException( message ); | ||||
} | } | ||||