git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271409 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -113,7 +113,7 @@ public class LoadProperties | |||||
| { | { | ||||
| try | try | ||||
| { | { | ||||
| final Object objectValue = resolveValue( value.toString() ); | |||||
| final Object objectValue = getContext().resolveValue( value.toString() ); | |||||
| final String name1 = m_prefix + name; | final String name1 = m_prefix + name; | ||||
| getContext().setProperty( name1, objectValue ); | getContext().setProperty( name1, objectValue ); | ||||
| } | } | ||||
| @@ -56,45 +56,16 @@ public abstract class AbstractTask | |||||
| return m_context; | return m_context; | ||||
| } | } | ||||
| protected final Object get( final Object key ) | |||||
| throws ContextException | |||||
| { | |||||
| return getContext().get( key ); | |||||
| } | |||||
| //Needs to be made protected | //Needs to be made protected | ||||
| public final File getBaseDirectory() | public final File getBaseDirectory() | ||||
| { | { | ||||
| return getContext().getBaseDirectory(); | return getContext().getBaseDirectory(); | ||||
| } | } | ||||
| protected final File resolveFile( final String filename ) | |||||
| throws TaskException | |||||
| { | |||||
| return getContext().resolveFile( filename ); | |||||
| } | |||||
| protected final Object resolveValue( final String value ) | |||||
| throws TaskException | |||||
| { | |||||
| return getContext().resolveValue( value ); | |||||
| } | |||||
| protected final Object getProperty( final String name ) | |||||
| { | |||||
| return getContext().getProperty( name ); | |||||
| } | |||||
| ///HACK: Make this protected | ///HACK: Make this protected | ||||
| public final Object getService( final Class serviceClass ) | public final Object getService( final Class serviceClass ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| return getContext().getService( serviceClass ); | return getContext().getService( serviceClass ); | ||||
| } | } | ||||
| protected final TaskContext createSubContext( final String name ) | |||||
| throws TaskException | |||||
| { | |||||
| return getContext().createSubContext( name ); | |||||
| } | |||||
| } | } | ||||
| @@ -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; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| @@ -193,7 +194,7 @@ public class Available | |||||
| { | { | ||||
| if( m_filepath == null ) | if( m_filepath == null ) | ||||
| { | { | ||||
| return checkFile( resolveFile( m_file ), m_file ); | |||||
| return checkFile( getContext().resolveFile( m_file ), m_file ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -12,6 +12,7 @@ import java.util.ArrayList; | |||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| 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.JavaVersion; | import org.apache.myrmidon.framework.JavaVersion; | ||||
| import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter; | import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter; | ||||
| import org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory; | import org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory; | ||||
| @@ -629,7 +630,7 @@ public class Javac extends MatchingTask | |||||
| public boolean isForkedJavac() | public boolean isForkedJavac() | ||||
| { | { | ||||
| return !"false".equals( fork ) || | return !"false".equals( fork ) || | ||||
| "extJavac".equals( getProperty( "build.compiler" ) ); | |||||
| "extJavac".equals( getContext().getProperty( "build.compiler" ) ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -675,7 +676,8 @@ public class Javac extends MatchingTask | |||||
| resetFileLists(); | resetFileLists(); | ||||
| for( int i = 0; i < list.length; i++ ) | for( int i = 0; i < list.length; i++ ) | ||||
| { | { | ||||
| File srcDir = (File)resolveFile( list[ i ] ); | |||||
| final String filename = list[ i ]; | |||||
| File srcDir = (File)getContext().resolveFile( filename ); | |||||
| if( !srcDir.exists() ) | if( !srcDir.exists() ) | ||||
| { | { | ||||
| throw new TaskException( "srcdir \"" + srcDir.getPath() + "\" does not exist!" ); | throw new TaskException( "srcdir \"" + srcDir.getPath() + "\" does not exist!" ); | ||||
| @@ -794,7 +796,7 @@ public class Javac extends MatchingTask | |||||
| private String determineCompiler() | private String determineCompiler() | ||||
| { | { | ||||
| Object compiler = getProperty( "build.compiler" ); | |||||
| Object compiler = getContext().getProperty( "build.compiler" ); | |||||
| if( !"false".equals( fork ) ) | if( !"false".equals( fork ) ) | ||||
| { | { | ||||
| @@ -15,6 +15,7 @@ import java.rmi.Remote; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import org.apache.avalon.excalibur.io.FileUtil; | import org.apache.avalon.excalibur.io.FileUtil; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.api.AbstractTask; | |||||
| import org.apache.tools.ant.taskdefs.rmic.RmicAdapter; | import org.apache.tools.ant.taskdefs.rmic.RmicAdapter; | ||||
| import org.apache.tools.ant.taskdefs.rmic.RmicAdapterFactory; | import org.apache.tools.ant.taskdefs.rmic.RmicAdapterFactory; | ||||
| import org.apache.tools.ant.types.DirectoryScanner; | import org.apache.tools.ant.types.DirectoryScanner; | ||||
| @@ -479,7 +480,7 @@ public class Rmic extends MatchingTask | |||||
| getLogger().info( "Verify has been turned on." ); | getLogger().info( "Verify has been turned on." ); | ||||
| } | } | ||||
| String compiler = getProperty( "build.rmic" ).toString(); | |||||
| String compiler = getContext().getProperty( "build.rmic" ).toString(); | |||||
| RmicAdapter adapter = RmicAdapterFactory.getRmic( compiler, this ); | RmicAdapter adapter = RmicAdapterFactory.getRmic( compiler, this ); | ||||
| // now we need to populate the compiler adapter | // now we need to populate the compiler adapter | ||||
| @@ -33,6 +33,7 @@ import java.util.Iterator; | |||||
| import java.util.Properties; | import java.util.Properties; | ||||
| 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; | ||||
| import org.apache.tools.ant.types.DirectoryScanner; | import org.apache.tools.ant.types.DirectoryScanner; | ||||
| import org.apache.tools.ant.types.EnumeratedAttribute; | import org.apache.tools.ant.types.EnumeratedAttribute; | ||||
| @@ -734,7 +735,8 @@ public class SQLExec | |||||
| while( ( line = in.readLine() ) != null ) | while( ( line = in.readLine() ) != null ) | ||||
| { | { | ||||
| line = line.trim(); | line = line.trim(); | ||||
| line = "" + resolveValue( line ); | |||||
| final String value = line; | |||||
| line = "" + getContext().resolveValue( value ); | |||||
| if( line.startsWith( "//" ) ) | if( line.startsWith( "//" ) ) | ||||
| { | { | ||||
| continue; | continue; | ||||
| @@ -211,7 +211,7 @@ public class Tstamp | |||||
| field = unit.getCalendarField(); | field = unit.getCalendarField(); | ||||
| } | } | ||||
| public void execute( Date date ) | |||||
| public void execute( final Date date ) | |||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| if( propertyName == null ) | if( propertyName == null ) | ||||
| @@ -237,18 +237,20 @@ public class Tstamp | |||||
| { | { | ||||
| sdf = new SimpleDateFormat( pattern, new Locale( language, country, variant ) ); | sdf = new SimpleDateFormat( pattern, new Locale( language, country, variant ) ); | ||||
| } | } | ||||
| Date time = date; | |||||
| if( offset != 0 ) | if( offset != 0 ) | ||||
| { | { | ||||
| Calendar calendar = Calendar.getInstance(); | |||||
| calendar.setTime( date ); | |||||
| final Calendar calendar = Calendar.getInstance(); | |||||
| calendar.setTime( time ); | |||||
| calendar.add( field, offset ); | calendar.add( field, offset ); | ||||
| date = calendar.getTime(); | |||||
| time = calendar.getTime(); | |||||
| } | } | ||||
| if( timeZone != null ) | if( timeZone != null ) | ||||
| { | { | ||||
| sdf.setTimeZone( timeZone ); | sdf.setTimeZone( timeZone ); | ||||
| } | } | ||||
| getContext().setProperty( propertyName, sdf.format( date ) ); | |||||
| getContext().setProperty( propertyName, sdf.format( time ) ); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -8,6 +8,7 @@ | |||||
| package org.apache.tools.ant.taskdefs.condition; | package org.apache.tools.ant.taskdefs.condition; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.api.AbstractTask; | |||||
| import org.apache.tools.ant.ProjectComponent; | import org.apache.tools.ant.ProjectComponent; | ||||
| /** | /** | ||||
| @@ -33,7 +34,7 @@ public class IsSet extends ProjectComponent implements Condition | |||||
| throw new TaskException( "No property specified for isset condition" ); | throw new TaskException( "No property specified for isset condition" ); | ||||
| } | } | ||||
| return getProperty( property ) != null; | |||||
| return getContext().getProperty( property ) != null; | |||||
| } | } | ||||
| } | } | ||||
| @@ -19,6 +19,7 @@ import org.apache.aut.nativelib.ExecManager; | |||||
| import org.apache.aut.nativelib.ExecOutputHandler; | import org.apache.aut.nativelib.ExecOutputHandler; | ||||
| 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.Execute; | import org.apache.myrmidon.framework.Execute; | ||||
| import org.apache.myrmidon.framework.Pattern; | import org.apache.myrmidon.framework.Pattern; | ||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| @@ -260,14 +261,14 @@ public class Javadoc | |||||
| { | { | ||||
| throw new TaskException( linkOfflineError ); | throw new TaskException( linkOfflineError ); | ||||
| } | } | ||||
| StringTokenizer tok = new StringTokenizer( src, " ", false ); | |||||
| final StringTokenizer tok = new StringTokenizer( src, " ", false ); | |||||
| le.setHref( tok.nextToken() ); | le.setHref( tok.nextToken() ); | ||||
| if( !tok.hasMoreTokens() ) | if( !tok.hasMoreTokens() ) | ||||
| { | { | ||||
| throw new TaskException( linkOfflineError ); | throw new TaskException( linkOfflineError ); | ||||
| } | } | ||||
| le.setPackagelistLoc( resolveFile( tok.nextToken() ) ); | |||||
| le.setPackagelistLoc( getContext().resolveFile( tok.nextToken() ) ); | |||||
| } | } | ||||
| public void setLocale( String src ) | public void setLocale( String src ) | ||||
| @@ -370,9 +371,9 @@ public class Javadoc | |||||
| StringTokenizer tok = new StringTokenizer( src, "," ); | StringTokenizer tok = new StringTokenizer( src, "," ); | ||||
| while( tok.hasMoreTokens() ) | while( tok.hasMoreTokens() ) | ||||
| { | { | ||||
| String f = tok.nextToken(); | |||||
| final String f = tok.nextToken(); | |||||
| SourceFile sf = new SourceFile(); | SourceFile sf = new SourceFile(); | ||||
| sf.setFile( resolveFile( f ) ); | |||||
| sf.setFile( getContext().resolveFile( f ) ); | |||||
| addSource( sf ); | addSource( sf ); | ||||
| } | } | ||||
| } | } | ||||
| @@ -978,7 +979,8 @@ public class Javadoc | |||||
| for( int j = 0; j < list.length; j++ ) | for( int j = 0; j < list.length; j++ ) | ||||
| { | { | ||||
| final File source = resolveFile( list[ j ] ); | |||||
| final String filename = list[ j ]; | |||||
| final File source = getContext().resolveFile( filename ); | |||||
| fs.setDir( source ); | fs.setDir( source ); | ||||
| final DirectoryScanner ds = ScannerUtil.getDirectoryScanner( fs ); | final DirectoryScanner ds = ScannerUtil.getDirectoryScanner( fs ); | ||||
| @@ -15,6 +15,7 @@ import java.io.PrintStream; | |||||
| import java.util.Date; | import java.util.Date; | ||||
| 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.myrmidon.listeners.AbstractProjectListener; | import org.apache.myrmidon.listeners.AbstractProjectListener; | ||||
| import org.apache.myrmidon.listeners.LogEvent; | import org.apache.myrmidon.listeners.LogEvent; | ||||
| import org.apache.tools.ant.taskdefs.Java; | import org.apache.tools.ant.taskdefs.Java; | ||||
| @@ -716,7 +717,7 @@ public class IContract extends MatchingTask | |||||
| Path baseClasspath = createClasspath(); | Path baseClasspath = createClasspath(); | ||||
| // Might need to add the core classes if we're not using Sun's Javac (like Jikes) | // Might need to add the core classes if we're not using Sun's Javac (like Jikes) | ||||
| String compiler = getProperty( "build.compiler" ).toString(); | |||||
| String compiler = getContext().getProperty( "build.compiler" ).toString(); | |||||
| ClasspathHelper classpathHelper = new ClasspathHelper( compiler ); | ClasspathHelper classpathHelper = new ClasspathHelper( compiler ); | ||||
| classpathHelper.modify( baseClasspath ); | classpathHelper.modify( baseClasspath ); | ||||
| @@ -20,6 +20,7 @@ import netrexx.lang.Rexx; | |||||
| import org.apache.avalon.excalibur.io.FileUtil; | import org.apache.avalon.excalibur.io.FileUtil; | ||||
| 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.taskdefs.MatchingTask; | import org.apache.tools.ant.taskdefs.MatchingTask; | ||||
| import org.apache.tools.ant.types.DirectoryScanner; | import org.apache.tools.ant.types.DirectoryScanner; | ||||
| @@ -585,11 +586,11 @@ public class NetRexxC extends MatchingTask | |||||
| private void addExistingToClasspath( StringBuffer target, String source ) | private void addExistingToClasspath( StringBuffer target, String source ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| StringTokenizer tok = new StringTokenizer( source, | |||||
| final StringTokenizer tok = new StringTokenizer( source, | |||||
| System.getProperty( "path.separator" ), false ); | System.getProperty( "path.separator" ), false ); | ||||
| while( tok.hasMoreTokens() ) | while( tok.hasMoreTokens() ) | ||||
| { | { | ||||
| File f = resolveFile( tok.nextToken() ); | |||||
| File f = getContext().resolveFile( tok.nextToken() ); | |||||
| if( f.exists() ) | if( f.exists() ) | ||||
| { | { | ||||
| @@ -9,6 +9,7 @@ package org.apache.tools.ant.taskdefs.optional.ejb; | |||||
| import java.io.File; | import java.io.File; | ||||
| 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.Java; | import org.apache.tools.ant.taskdefs.Java; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| @@ -309,7 +310,7 @@ public class WLRun extends Task | |||||
| if( !propertiesFile.exists() ) | if( !propertiesFile.exists() ) | ||||
| { | { | ||||
| // OK, properties file may be absolute | // OK, properties file may be absolute | ||||
| propertiesFile = resolveFile( weblogicPropertiesFile ); | |||||
| propertiesFile = getContext().resolveFile( weblogicPropertiesFile ); | |||||
| if( !propertiesFile.exists() ) | if( !propertiesFile.exists() ) | ||||
| { | { | ||||
| throw new TaskException( "Properties file " + weblogicPropertiesFile + | throw new TaskException( "Properties file " + weblogicPropertiesFile + | ||||
| @@ -415,7 +416,8 @@ public class WLRun extends Task | |||||
| // absolute path. Use the project to resolve it. | // absolute path. Use the project to resolve it. | ||||
| if( this.securityPolicy != null && !securityPolicyFile.exists() ) | if( this.securityPolicy != null && !securityPolicyFile.exists() ) | ||||
| { | { | ||||
| securityPolicyFile = resolveFile( securityPolicy ); | |||||
| final String filename = securityPolicy; | |||||
| securityPolicyFile = getContext().resolveFile( filename ); | |||||
| } | } | ||||
| // If we still can't find it, complain | // If we still can't find it, complain | ||||
| if( !securityPolicyFile.exists() ) | if( !securityPolicyFile.exists() ) | ||||
| @@ -23,6 +23,7 @@ import javax.xml.parsers.SAXParser; | |||||
| import javax.xml.parsers.SAXParserFactory; | import javax.xml.parsers.SAXParserFactory; | ||||
| import org.apache.avalon.excalibur.io.FileUtil; | import org.apache.avalon.excalibur.io.FileUtil; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.api.AbstractTask; | |||||
| import org.apache.tools.ant.taskdefs.Java; | import org.apache.tools.ant.taskdefs.Java; | ||||
| 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; | ||||
| @@ -808,7 +809,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool | |||||
| { | { | ||||
| // try to use the compiler specified by build.compiler. Right now we are just going | // try to use the compiler specified by build.compiler. Right now we are just going | ||||
| // to allow Jikes | // to allow Jikes | ||||
| String buildCompiler = getTask().getProperty( "build.compiler" ).toString(); | |||||
| String buildCompiler = getTask().getContext().getProperty( "build.compiler" ).toString(); | |||||
| if( buildCompiler != null && buildCompiler.equals( "jikes" ) ) | if( buildCompiler != null && buildCompiler.equals( "jikes" ) ) | ||||
| { | { | ||||
| javaTask.createArg().setValue( "-compiler" ); | javaTask.createArg().setValue( "-compiler" ); | ||||
| @@ -19,6 +19,7 @@ import java.util.jar.JarEntry; | |||||
| import java.util.jar.JarFile; | import java.util.jar.JarFile; | ||||
| import java.util.jar.JarOutputStream; | import java.util.jar.JarOutputStream; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.api.AbstractTask; | |||||
| import org.apache.tools.ant.taskdefs.Java; | import org.apache.tools.ant.taskdefs.Java; | ||||
| import org.apache.tools.ant.types.Argument; | import org.apache.tools.ant.types.Argument; | ||||
| import org.apache.tools.ant.types.EnumeratedAttribute; | import org.apache.tools.ant.types.EnumeratedAttribute; | ||||
| @@ -967,7 +968,7 @@ public class WebsphereDeploymentTool | |||||
| EnvironmentVariable var = new EnvironmentVariable(); | EnvironmentVariable var = new EnvironmentVariable(); | ||||
| var.setKey( "websphere.lib.dir" ); | var.setKey( "websphere.lib.dir" ); | ||||
| final String webshpereHome = getTask().getProperty( "websphere.home" ).toString(); | |||||
| final String webshpereHome = getTask().getContext().getProperty( "websphere.home" ).toString(); | |||||
| var.setValue( webshpereHome + "/lib" ); | var.setValue( webshpereHome + "/lib" ); | ||||
| javaTask.addSysproperty( var ); | javaTask.addSysproperty( var ); | ||||
| @@ -8,13 +8,12 @@ | |||||
| package org.apache.tools.ant.taskdefs.optional.javacc; | package org.apache.tools.ant.taskdefs.optional.javacc; | ||||
| import java.io.File; | import java.io.File; | ||||
| import java.io.IOException; | |||||
| import java.util.Enumeration; | import java.util.Enumeration; | ||||
| import java.util.Hashtable; | import java.util.Hashtable; | ||||
| import org.apache.aut.nativelib.ExecManager; | import org.apache.aut.nativelib.ExecManager; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Task; | |||||
| import org.apache.myrmidon.framework.Execute; | import org.apache.myrmidon.framework.Execute; | ||||
| import org.apache.tools.ant.Task; | |||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import org.apache.tools.ant.types.CommandlineJava; | import org.apache.tools.ant.types.CommandlineJava; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| @@ -29,7 +28,6 @@ import org.apache.tools.ant.types.PathUtil; | |||||
| */ | */ | ||||
| public class JJTree extends Task | public class JJTree extends Task | ||||
| { | { | ||||
| // keys to optional attributes | // keys to optional attributes | ||||
| private final static String BUILD_NODE_FILES = "BUILD_NODE_FILES"; | private final static String BUILD_NODE_FILES = "BUILD_NODE_FILES"; | ||||
| private final static String MULTI = "MULTI"; | private final static String MULTI = "MULTI"; | ||||
| @@ -11,6 +11,7 @@ import java.io.File; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.api.AbstractTask; | |||||
| import org.apache.tools.ant.taskdefs.MatchingTask; | import org.apache.tools.ant.taskdefs.MatchingTask; | ||||
| import org.apache.tools.ant.taskdefs.optional.jsp.compilers.CompilerAdapter; | import org.apache.tools.ant.taskdefs.optional.jsp.compilers.CompilerAdapter; | ||||
| import org.apache.tools.ant.taskdefs.optional.jsp.compilers.CompilerAdapterFactory; | import org.apache.tools.ant.taskdefs.optional.jsp.compilers.CompilerAdapterFactory; | ||||
| @@ -355,7 +356,8 @@ public class JspC extends MatchingTask | |||||
| int filecount = 0; | int filecount = 0; | ||||
| for( int i = 0; i < list.length; i++ ) | for( int i = 0; i < list.length; i++ ) | ||||
| { | { | ||||
| File srcDir = (File)resolveFile( list[ i ] ); | |||||
| final String filename = list[ i ]; | |||||
| File srcDir = (File)getContext().resolveFile( filename ); | |||||
| if( !srcDir.exists() ) | if( !srcDir.exists() ) | ||||
| { | { | ||||
| throw new TaskException( "srcdir \"" + srcDir.getPath() + | throw new TaskException( "srcdir \"" + srcDir.getPath() + | ||||
| @@ -371,7 +373,7 @@ public class JspC extends MatchingTask | |||||
| // compile the source files | // compile the source files | ||||
| Object compiler = getProperty( "jsp.compiler" ); | |||||
| Object compiler = getContext().getProperty( "jsp.compiler" ); | |||||
| if( compiler == null ) | if( compiler == null ) | ||||
| { | { | ||||
| compiler = "jasper"; | compiler = "jasper"; | ||||
| @@ -21,6 +21,7 @@ import java.util.Random; | |||||
| import org.apache.aut.nativelib.ExecManager; | import org.apache.aut.nativelib.ExecManager; | ||||
| import org.apache.myrmidon.api.TaskContext; | import org.apache.myrmidon.api.TaskContext; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.api.AbstractTask; | |||||
| import org.apache.myrmidon.framework.Execute; | import org.apache.myrmidon.framework.Execute; | ||||
| 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; | ||||
| @@ -430,8 +431,8 @@ public class JUnitTask extends Task | |||||
| { | { | ||||
| String filename = test.getOutfile() + fe.getExtension(); | String filename = test.getOutfile() + fe.getExtension(); | ||||
| File destFile = new File( test.getTodir(), filename ); | File destFile = new File( test.getTodir(), filename ); | ||||
| String absFilename = destFile.getAbsolutePath(); | |||||
| return resolveFile( absFilename ); | |||||
| final String absFilename = destFile.getAbsolutePath(); | |||||
| return getContext().resolveFile( absFilename ); | |||||
| } | } | ||||
| return null; | return null; | ||||
| } | } | ||||
| @@ -19,6 +19,7 @@ import javax.xml.parsers.DocumentBuilder; | |||||
| import javax.xml.parsers.DocumentBuilderFactory; | import javax.xml.parsers.DocumentBuilderFactory; | ||||
| import org.apache.avalon.framework.ExceptionUtil; | import org.apache.avalon.framework.ExceptionUtil; | ||||
| 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.DirectoryScanner; | import org.apache.tools.ant.types.DirectoryScanner; | ||||
| import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
| @@ -184,7 +185,7 @@ public class XMLResultAggregator | |||||
| } | } | ||||
| if( toDir == null ) | if( toDir == null ) | ||||
| { | { | ||||
| toDir = resolveFile( DEFAULT_DIR ); | |||||
| toDir = getContext().resolveFile( DEFAULT_DIR ); | |||||
| } | } | ||||
| return new File( toDir, toFile ); | return new File( toDir, toFile ); | ||||
| } | } | ||||
| @@ -211,7 +212,7 @@ public class XMLResultAggregator | |||||
| if( pathname.endsWith( ".xml" ) ) | if( pathname.endsWith( ".xml" ) ) | ||||
| { | { | ||||
| File file = new File( scanner.getBasedir(), pathname ); | File file = new File( scanner.getBasedir(), pathname ); | ||||
| file = resolveFile( file.getPath() ); | |||||
| file = getContext().resolveFile( file.getPath() ); | |||||
| v.add( file ); | v.add( file ); | ||||
| } | } | ||||
| } | } | ||||
| @@ -249,7 +249,7 @@ public abstract class AbstractMetamataTask | |||||
| { | { | ||||
| throw new TaskException( "'metamatahome' must point to Metamata home directory." ); | throw new TaskException( "'metamatahome' must point to Metamata home directory." ); | ||||
| } | } | ||||
| m_metamataHome = resolveFile( m_metamataHome.getPath() ); | |||||
| m_metamataHome = getContext().resolveFile( m_metamataHome.getPath() ); | |||||
| File jar = getMetamataJar( m_metamataHome ); | File jar = getMetamataJar( m_metamataHome ); | ||||
| if( !jar.exists() ) | if( !jar.exists() ) | ||||
| { | { | ||||
| @@ -16,6 +16,7 @@ import java.util.Random; | |||||
| import org.apache.aut.nativelib.ExecManager; | import org.apache.aut.nativelib.ExecManager; | ||||
| 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.myrmidon.framework.Execute; | import org.apache.myrmidon.framework.Execute; | ||||
| 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; | ||||
| @@ -309,7 +310,7 @@ public class MParse | |||||
| { | { | ||||
| throw new TaskException( "'metamatahome' must point to Metamata home directory." ); | throw new TaskException( "'metamatahome' must point to Metamata home directory." ); | ||||
| } | } | ||||
| m_metahome = resolveFile( m_metahome.getPath() ); | |||||
| m_metahome = getContext().resolveFile( m_metahome.getPath() ); | |||||
| // check that the needed jar exists. | // check that the needed jar exists. | ||||
| File[] jars = getMetamataLibs(); | File[] jars = getMetamataLibs(); | ||||
| @@ -326,7 +327,7 @@ public class MParse | |||||
| { | { | ||||
| throw new TaskException( "Invalid target: " + m_target ); | throw new TaskException( "Invalid target: " + m_target ); | ||||
| } | } | ||||
| m_target = resolveFile( m_target.getPath() ); | |||||
| m_target = getContext().resolveFile( m_target.getPath() ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -24,6 +24,7 @@ import java.util.ArrayList; | |||||
| import org.apache.avalon.excalibur.io.FileUtil; | import org.apache.avalon.excalibur.io.FileUtil; | ||||
| import org.apache.myrmidon.api.TaskContext; | import org.apache.myrmidon.api.TaskContext; | ||||
| 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.FileScanner; | import org.apache.tools.ant.types.FileScanner; | ||||
| import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
| @@ -399,7 +400,10 @@ public class FTP | |||||
| OutputStream outstream = null; | OutputStream outstream = null; | ||||
| try | try | ||||
| { | { | ||||
| final File file = FileUtil.resolveFile( resolveFile( dir ), filename ); | |||||
| final String filename1 = dir; | |||||
| File result; | |||||
| result = getContext().resolveFile( filename1 ); | |||||
| final File file = FileUtil.resolveFile( result, filename ); | |||||
| if( m_newerOnly && isUpToDate( ftp, file, remoteResolveFile( filename ) ) ) | if( m_newerOnly && isUpToDate( ftp, file, remoteResolveFile( filename ) ) ) | ||||
| { | { | ||||
| @@ -697,13 +701,13 @@ public class FTP | |||||
| * @exception IOException Description of Exception | * @exception IOException Description of Exception | ||||
| * @exception TaskException Description of Exception | * @exception TaskException Description of Exception | ||||
| */ | */ | ||||
| protected void sendFile( FTPClient ftp, String dir, String filename ) | |||||
| protected void sendFile( FTPClient ftp, final String dir, final String filename ) | |||||
| throws IOException, TaskException | throws IOException, TaskException | ||||
| { | { | ||||
| InputStream instream = null; | InputStream instream = null; | ||||
| try | try | ||||
| { | { | ||||
| File file = resolveFile( new File( dir, filename ).getPath() ); | |||||
| File file = getContext().resolveFile( new File( dir, filename ).getPath() ); | |||||
| if( m_newerOnly && isUpToDate( ftp, file, remoteResolveFile( filename ) ) ) | if( m_newerOnly && isUpToDate( ftp, file, remoteResolveFile( filename ) ) ) | ||||
| { | { | ||||
| @@ -10,6 +10,7 @@ package org.apache.tools.ant.taskdefs.optional.perforce; | |||||
| import org.apache.aut.nativelib.ExecManager; | import org.apache.aut.nativelib.ExecManager; | ||||
| import org.apache.aut.nativelib.ExecOutputHandler; | import org.apache.aut.nativelib.ExecOutputHandler; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.api.AbstractTask; | |||||
| import org.apache.myrmidon.framework.Execute; | import org.apache.myrmidon.framework.Execute; | ||||
| import org.apache.oro.text.perl.Perl5Util; | import org.apache.oro.text.perl.Perl5Util; | ||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| @@ -103,15 +104,15 @@ public abstract class P4Base | |||||
| //Get default P4 settings from environment - Mark would have done something cool with | //Get default P4 settings from environment - Mark would have done something cool with | ||||
| //introspection here.....:-) | //introspection here.....:-) | ||||
| Object tmpprop; | Object tmpprop; | ||||
| if( ( tmpprop = getProperty( "p4.port" ) ) != null ) | |||||
| if( ( tmpprop = getContext().getProperty( "p4.port" ) ) != null ) | |||||
| { | { | ||||
| setPort( tmpprop.toString() ); | setPort( tmpprop.toString() ); | ||||
| } | } | ||||
| if( ( tmpprop = getProperty( "p4.client" ) ) != null ) | |||||
| if( ( tmpprop = getContext().getProperty( "p4.client" ) ) != null ) | |||||
| { | { | ||||
| setClient( tmpprop.toString() ); | setClient( tmpprop.toString() ); | ||||
| } | } | ||||
| if( ( tmpprop = getProperty( "p4.user" ) ) != null ) | |||||
| if( ( tmpprop = getContext().getProperty( "p4.user" ) ) != null ) | |||||
| { | { | ||||
| setUser( tmpprop.toString() ); | setUser( tmpprop.toString() ); | ||||
| } | } | ||||
| @@ -15,6 +15,7 @@ import java.util.ArrayList; | |||||
| import java.util.Random; | import java.util.Random; | ||||
| import org.apache.aut.nativelib.ExecManager; | import org.apache.aut.nativelib.ExecManager; | ||||
| 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.myrmidon.framework.Execute; | import org.apache.myrmidon.framework.Execute; | ||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| @@ -158,8 +159,8 @@ public class CovMerge extends Task | |||||
| for( int j = 0; j < f.length; j++ ) | for( int j = 0; j < f.length; j++ ) | ||||
| { | { | ||||
| String pathname = f[ j ]; | String pathname = f[ j ]; | ||||
| File file = new File( ds.getBasedir(), pathname ); | |||||
| file = resolveFile( file.getPath() ); | |||||
| final File file = new File( ds.getBasedir(), pathname ); | |||||
| file = getContext().resolveFile( file.getPath() ); | |||||
| v.add( file ); | v.add( file ); | ||||
| } | } | ||||
| } | } | ||||
| @@ -215,7 +216,7 @@ public class CovMerge extends Task | |||||
| pw.println( snapshots[ i ].getAbsolutePath() ); | pw.println( snapshots[ i ].getAbsolutePath() ); | ||||
| } | } | ||||
| // last file is the output snapshot | // last file is the output snapshot | ||||
| pw.println( resolveFile( tofile.getPath() ) ); | |||||
| pw.println( getContext().resolveFile( tofile.getPath() ) ); | |||||
| pw.flush(); | pw.flush(); | ||||
| } | } | ||||
| catch( IOException e ) | catch( IOException e ) | ||||
| @@ -19,6 +19,7 @@ import javax.xml.transform.dom.DOMSource; | |||||
| import javax.xml.transform.stream.StreamResult; | import javax.xml.transform.stream.StreamResult; | ||||
| import org.apache.aut.nativelib.ExecManager; | import org.apache.aut.nativelib.ExecManager; | ||||
| 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.myrmidon.framework.Execute; | import org.apache.myrmidon.framework.Execute; | ||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| @@ -290,8 +291,8 @@ public class CovReport extends Task | |||||
| { | { | ||||
| v.add( "-filters=" + filters ); | v.add( "-filters=" + filters ); | ||||
| } | } | ||||
| v.add( "-output=" + resolveFile( tofile.getPath() ) ); | |||||
| v.add( "-snapshot=" + resolveFile( snapshot.getPath() ) ); | |||||
| v.add( "-output=" + getContext().resolveFile( tofile.getPath() ) ); | |||||
| v.add( "-snapshot=" + getContext().resolveFile( snapshot.getPath() ) ); | |||||
| // as a default -sourcepath use . in JProbe, so use project . | // as a default -sourcepath use . in JProbe, so use project . | ||||
| if( sourcePath == null ) | if( sourcePath == null ) | ||||
| { | { | ||||
| @@ -15,6 +15,7 @@ import java.io.StringWriter; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import org.apache.aut.nativelib.ExecManager; | import org.apache.aut.nativelib.ExecManager; | ||||
| 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.myrmidon.framework.Execute; | import org.apache.myrmidon.framework.Execute; | ||||
| import org.apache.tools.ant.types.Argument; | import org.apache.tools.ant.types.Argument; | ||||
| @@ -291,7 +292,7 @@ public class Coverage | |||||
| } | } | ||||
| if( m_javaExe != null ) | if( m_javaExe != null ) | ||||
| { | { | ||||
| params.add( "-jp_java_exe=" + resolveFile( m_javaExe.getPath() ) ); | |||||
| params.add( "-jp_java_exe=" + getContext().resolveFile( m_javaExe.getPath() ) ); | |||||
| } | } | ||||
| params.add( "-jp_working_dir=" + m_workingDir.getPath() ); | params.add( "-jp_working_dir=" + m_workingDir.getPath() ); | ||||
| params.add( "-jp_snapshot_dir=" + m_snapshotDir.getPath() ); | params.add( "-jp_snapshot_dir=" + m_snapshotDir.getPath() ); | ||||
| @@ -366,7 +367,7 @@ public class Coverage | |||||
| { | { | ||||
| m_snapshotDir = new File( "." ); | m_snapshotDir = new File( "." ); | ||||
| } | } | ||||
| m_snapshotDir = resolveFile( m_snapshotDir.getPath() ); | |||||
| m_snapshotDir = getContext().resolveFile( m_snapshotDir.getPath() ); | |||||
| if( !m_snapshotDir.isDirectory() || !m_snapshotDir.exists() ) | if( !m_snapshotDir.isDirectory() || !m_snapshotDir.exists() ) | ||||
| { | { | ||||
| throw new TaskException( "Snapshot directory does not exists :" + m_snapshotDir ); | throw new TaskException( "Snapshot directory does not exists :" + m_snapshotDir ); | ||||
| @@ -375,7 +376,7 @@ public class Coverage | |||||
| { | { | ||||
| m_workingDir = new File( "." ); | m_workingDir = new File( "." ); | ||||
| } | } | ||||
| m_workingDir = resolveFile( m_workingDir.getPath() ); | |||||
| m_workingDir = getContext().resolveFile( m_workingDir.getPath() ); | |||||
| // check for info, do your best to select the java executable. | // check for info, do your best to select the java executable. | ||||
| // JProbe 3.0 fails if there is no javaexe option. So | // JProbe 3.0 fails if there is no javaexe option. So | ||||
| @@ -9,6 +9,7 @@ package org.apache.tools.ant.taskdefs.optional.vss; | |||||
| import java.io.File; | import java.io.File; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.api.AbstractTask; | |||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| @@ -144,7 +145,7 @@ public class MSVSSCHECKIN extends MSVSS | |||||
| else | else | ||||
| { | { | ||||
| // make sure m_LocalDir exists, create it if it doesn't | // make sure m_LocalDir exists, create it if it doesn't | ||||
| File dir = resolveFile( m_LocalPath ); | |||||
| File dir = getContext().resolveFile( m_LocalPath ); | |||||
| if( !dir.exists() ) | if( !dir.exists() ) | ||||
| { | { | ||||
| boolean done = dir.mkdirs(); | boolean done = dir.mkdirs(); | ||||
| @@ -9,6 +9,7 @@ package org.apache.tools.ant.taskdefs.optional.vss; | |||||
| import java.io.File; | import java.io.File; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.api.AbstractTask; | |||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| @@ -171,7 +172,7 @@ public class MSVSSCHECKOUT extends MSVSS | |||||
| else | else | ||||
| { | { | ||||
| // make sure m_LocalDir exists, create it if it doesn't | // make sure m_LocalDir exists, create it if it doesn't | ||||
| File dir = resolveFile( m_LocalPath ); | |||||
| File dir = getContext().resolveFile( m_LocalPath ); | |||||
| if( !dir.exists() ) | if( !dir.exists() ) | ||||
| { | { | ||||
| boolean done = dir.mkdirs(); | boolean done = dir.mkdirs(); | ||||
| @@ -9,6 +9,7 @@ package org.apache.tools.ant.taskdefs.optional.vss; | |||||
| import java.io.File; | import java.io.File; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.api.AbstractTask; | |||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| @@ -379,7 +380,7 @@ public class MSVSSGET extends MSVSS | |||||
| else | else | ||||
| { | { | ||||
| // make sure m_LocalDir exists, create it if it doesn't | // make sure m_LocalDir exists, create it if it doesn't | ||||
| File dir = resolveFile( m_LocalPath ); | |||||
| File dir = getContext().resolveFile( m_LocalPath ); | |||||
| if( !dir.exists() ) | if( !dir.exists() ) | ||||
| { | { | ||||
| boolean done = dir.mkdirs(); | boolean done = dir.mkdirs(); | ||||
| @@ -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; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| @@ -193,7 +194,7 @@ public class Available | |||||
| { | { | ||||
| if( m_filepath == null ) | if( m_filepath == null ) | ||||
| { | { | ||||
| return checkFile( resolveFile( m_file ), m_file ); | |||||
| return checkFile( getContext().resolveFile( m_file ), m_file ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -12,6 +12,7 @@ import java.util.ArrayList; | |||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| 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.JavaVersion; | import org.apache.myrmidon.framework.JavaVersion; | ||||
| import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter; | import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter; | ||||
| import org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory; | import org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory; | ||||
| @@ -629,7 +630,7 @@ public class Javac extends MatchingTask | |||||
| public boolean isForkedJavac() | public boolean isForkedJavac() | ||||
| { | { | ||||
| return !"false".equals( fork ) || | return !"false".equals( fork ) || | ||||
| "extJavac".equals( getProperty( "build.compiler" ) ); | |||||
| "extJavac".equals( getContext().getProperty( "build.compiler" ) ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -675,7 +676,8 @@ public class Javac extends MatchingTask | |||||
| resetFileLists(); | resetFileLists(); | ||||
| for( int i = 0; i < list.length; i++ ) | for( int i = 0; i < list.length; i++ ) | ||||
| { | { | ||||
| File srcDir = (File)resolveFile( list[ i ] ); | |||||
| final String filename = list[ i ]; | |||||
| File srcDir = (File)getContext().resolveFile( filename ); | |||||
| if( !srcDir.exists() ) | if( !srcDir.exists() ) | ||||
| { | { | ||||
| throw new TaskException( "srcdir \"" + srcDir.getPath() + "\" does not exist!" ); | throw new TaskException( "srcdir \"" + srcDir.getPath() + "\" does not exist!" ); | ||||
| @@ -794,7 +796,7 @@ public class Javac extends MatchingTask | |||||
| private String determineCompiler() | private String determineCompiler() | ||||
| { | { | ||||
| Object compiler = getProperty( "build.compiler" ); | |||||
| Object compiler = getContext().getProperty( "build.compiler" ); | |||||
| if( !"false".equals( fork ) ) | if( !"false".equals( fork ) ) | ||||
| { | { | ||||
| @@ -15,6 +15,7 @@ import java.rmi.Remote; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import org.apache.avalon.excalibur.io.FileUtil; | import org.apache.avalon.excalibur.io.FileUtil; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.api.AbstractTask; | |||||
| import org.apache.tools.ant.taskdefs.rmic.RmicAdapter; | import org.apache.tools.ant.taskdefs.rmic.RmicAdapter; | ||||
| import org.apache.tools.ant.taskdefs.rmic.RmicAdapterFactory; | import org.apache.tools.ant.taskdefs.rmic.RmicAdapterFactory; | ||||
| import org.apache.tools.ant.types.DirectoryScanner; | import org.apache.tools.ant.types.DirectoryScanner; | ||||
| @@ -479,7 +480,7 @@ public class Rmic extends MatchingTask | |||||
| getLogger().info( "Verify has been turned on." ); | getLogger().info( "Verify has been turned on." ); | ||||
| } | } | ||||
| String compiler = getProperty( "build.rmic" ).toString(); | |||||
| String compiler = getContext().getProperty( "build.rmic" ).toString(); | |||||
| RmicAdapter adapter = RmicAdapterFactory.getRmic( compiler, this ); | RmicAdapter adapter = RmicAdapterFactory.getRmic( compiler, this ); | ||||
| // now we need to populate the compiler adapter | // now we need to populate the compiler adapter | ||||
| @@ -33,6 +33,7 @@ import java.util.Iterator; | |||||
| import java.util.Properties; | import java.util.Properties; | ||||
| 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; | ||||
| import org.apache.tools.ant.types.DirectoryScanner; | import org.apache.tools.ant.types.DirectoryScanner; | ||||
| import org.apache.tools.ant.types.EnumeratedAttribute; | import org.apache.tools.ant.types.EnumeratedAttribute; | ||||
| @@ -734,7 +735,8 @@ public class SQLExec | |||||
| while( ( line = in.readLine() ) != null ) | while( ( line = in.readLine() ) != null ) | ||||
| { | { | ||||
| line = line.trim(); | line = line.trim(); | ||||
| line = "" + resolveValue( line ); | |||||
| final String value = line; | |||||
| line = "" + getContext().resolveValue( value ); | |||||
| if( line.startsWith( "//" ) ) | if( line.startsWith( "//" ) ) | ||||
| { | { | ||||
| continue; | continue; | ||||
| @@ -211,7 +211,7 @@ public class Tstamp | |||||
| field = unit.getCalendarField(); | field = unit.getCalendarField(); | ||||
| } | } | ||||
| public void execute( Date date ) | |||||
| public void execute( final Date date ) | |||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| if( propertyName == null ) | if( propertyName == null ) | ||||
| @@ -237,18 +237,20 @@ public class Tstamp | |||||
| { | { | ||||
| sdf = new SimpleDateFormat( pattern, new Locale( language, country, variant ) ); | sdf = new SimpleDateFormat( pattern, new Locale( language, country, variant ) ); | ||||
| } | } | ||||
| Date time = date; | |||||
| if( offset != 0 ) | if( offset != 0 ) | ||||
| { | { | ||||
| Calendar calendar = Calendar.getInstance(); | |||||
| calendar.setTime( date ); | |||||
| final Calendar calendar = Calendar.getInstance(); | |||||
| calendar.setTime( time ); | |||||
| calendar.add( field, offset ); | calendar.add( field, offset ); | ||||
| date = calendar.getTime(); | |||||
| time = calendar.getTime(); | |||||
| } | } | ||||
| if( timeZone != null ) | if( timeZone != null ) | ||||
| { | { | ||||
| sdf.setTimeZone( timeZone ); | sdf.setTimeZone( timeZone ); | ||||
| } | } | ||||
| getContext().setProperty( propertyName, sdf.format( date ) ); | |||||
| getContext().setProperty( propertyName, sdf.format( time ) ); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -8,6 +8,7 @@ | |||||
| package org.apache.tools.ant.taskdefs.condition; | package org.apache.tools.ant.taskdefs.condition; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.api.AbstractTask; | |||||
| import org.apache.tools.ant.ProjectComponent; | import org.apache.tools.ant.ProjectComponent; | ||||
| /** | /** | ||||
| @@ -33,7 +34,7 @@ public class IsSet extends ProjectComponent implements Condition | |||||
| throw new TaskException( "No property specified for isset condition" ); | throw new TaskException( "No property specified for isset condition" ); | ||||
| } | } | ||||
| return getProperty( property ) != null; | |||||
| return getContext().getProperty( property ) != null; | |||||
| } | } | ||||
| } | } | ||||
| @@ -19,6 +19,7 @@ import org.apache.aut.nativelib.ExecManager; | |||||
| import org.apache.aut.nativelib.ExecOutputHandler; | import org.apache.aut.nativelib.ExecOutputHandler; | ||||
| 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.Execute; | import org.apache.myrmidon.framework.Execute; | ||||
| import org.apache.myrmidon.framework.Pattern; | import org.apache.myrmidon.framework.Pattern; | ||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| @@ -260,14 +261,14 @@ public class Javadoc | |||||
| { | { | ||||
| throw new TaskException( linkOfflineError ); | throw new TaskException( linkOfflineError ); | ||||
| } | } | ||||
| StringTokenizer tok = new StringTokenizer( src, " ", false ); | |||||
| final StringTokenizer tok = new StringTokenizer( src, " ", false ); | |||||
| le.setHref( tok.nextToken() ); | le.setHref( tok.nextToken() ); | ||||
| if( !tok.hasMoreTokens() ) | if( !tok.hasMoreTokens() ) | ||||
| { | { | ||||
| throw new TaskException( linkOfflineError ); | throw new TaskException( linkOfflineError ); | ||||
| } | } | ||||
| le.setPackagelistLoc( resolveFile( tok.nextToken() ) ); | |||||
| le.setPackagelistLoc( getContext().resolveFile( tok.nextToken() ) ); | |||||
| } | } | ||||
| public void setLocale( String src ) | public void setLocale( String src ) | ||||
| @@ -370,9 +371,9 @@ public class Javadoc | |||||
| StringTokenizer tok = new StringTokenizer( src, "," ); | StringTokenizer tok = new StringTokenizer( src, "," ); | ||||
| while( tok.hasMoreTokens() ) | while( tok.hasMoreTokens() ) | ||||
| { | { | ||||
| String f = tok.nextToken(); | |||||
| final String f = tok.nextToken(); | |||||
| SourceFile sf = new SourceFile(); | SourceFile sf = new SourceFile(); | ||||
| sf.setFile( resolveFile( f ) ); | |||||
| sf.setFile( getContext().resolveFile( f ) ); | |||||
| addSource( sf ); | addSource( sf ); | ||||
| } | } | ||||
| } | } | ||||
| @@ -978,7 +979,8 @@ public class Javadoc | |||||
| for( int j = 0; j < list.length; j++ ) | for( int j = 0; j < list.length; j++ ) | ||||
| { | { | ||||
| final File source = resolveFile( list[ j ] ); | |||||
| final String filename = list[ j ]; | |||||
| final File source = getContext().resolveFile( filename ); | |||||
| fs.setDir( source ); | fs.setDir( source ); | ||||
| final DirectoryScanner ds = ScannerUtil.getDirectoryScanner( fs ); | final DirectoryScanner ds = ScannerUtil.getDirectoryScanner( fs ); | ||||
| @@ -15,6 +15,7 @@ import java.io.PrintStream; | |||||
| import java.util.Date; | import java.util.Date; | ||||
| 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.myrmidon.listeners.AbstractProjectListener; | import org.apache.myrmidon.listeners.AbstractProjectListener; | ||||
| import org.apache.myrmidon.listeners.LogEvent; | import org.apache.myrmidon.listeners.LogEvent; | ||||
| import org.apache.tools.ant.taskdefs.Java; | import org.apache.tools.ant.taskdefs.Java; | ||||
| @@ -716,7 +717,7 @@ public class IContract extends MatchingTask | |||||
| Path baseClasspath = createClasspath(); | Path baseClasspath = createClasspath(); | ||||
| // Might need to add the core classes if we're not using Sun's Javac (like Jikes) | // Might need to add the core classes if we're not using Sun's Javac (like Jikes) | ||||
| String compiler = getProperty( "build.compiler" ).toString(); | |||||
| String compiler = getContext().getProperty( "build.compiler" ).toString(); | |||||
| ClasspathHelper classpathHelper = new ClasspathHelper( compiler ); | ClasspathHelper classpathHelper = new ClasspathHelper( compiler ); | ||||
| classpathHelper.modify( baseClasspath ); | classpathHelper.modify( baseClasspath ); | ||||
| @@ -20,6 +20,7 @@ import netrexx.lang.Rexx; | |||||
| import org.apache.avalon.excalibur.io.FileUtil; | import org.apache.avalon.excalibur.io.FileUtil; | ||||
| 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.taskdefs.MatchingTask; | import org.apache.tools.ant.taskdefs.MatchingTask; | ||||
| import org.apache.tools.ant.types.DirectoryScanner; | import org.apache.tools.ant.types.DirectoryScanner; | ||||
| @@ -585,11 +586,11 @@ public class NetRexxC extends MatchingTask | |||||
| private void addExistingToClasspath( StringBuffer target, String source ) | private void addExistingToClasspath( StringBuffer target, String source ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| StringTokenizer tok = new StringTokenizer( source, | |||||
| final StringTokenizer tok = new StringTokenizer( source, | |||||
| System.getProperty( "path.separator" ), false ); | System.getProperty( "path.separator" ), false ); | ||||
| while( tok.hasMoreTokens() ) | while( tok.hasMoreTokens() ) | ||||
| { | { | ||||
| File f = resolveFile( tok.nextToken() ); | |||||
| File f = getContext().resolveFile( tok.nextToken() ); | |||||
| if( f.exists() ) | if( f.exists() ) | ||||
| { | { | ||||
| @@ -9,6 +9,7 @@ package org.apache.tools.ant.taskdefs.optional.ejb; | |||||
| import java.io.File; | import java.io.File; | ||||
| 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.Java; | import org.apache.tools.ant.taskdefs.Java; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| @@ -309,7 +310,7 @@ public class WLRun extends Task | |||||
| if( !propertiesFile.exists() ) | if( !propertiesFile.exists() ) | ||||
| { | { | ||||
| // OK, properties file may be absolute | // OK, properties file may be absolute | ||||
| propertiesFile = resolveFile( weblogicPropertiesFile ); | |||||
| propertiesFile = getContext().resolveFile( weblogicPropertiesFile ); | |||||
| if( !propertiesFile.exists() ) | if( !propertiesFile.exists() ) | ||||
| { | { | ||||
| throw new TaskException( "Properties file " + weblogicPropertiesFile + | throw new TaskException( "Properties file " + weblogicPropertiesFile + | ||||
| @@ -415,7 +416,8 @@ public class WLRun extends Task | |||||
| // absolute path. Use the project to resolve it. | // absolute path. Use the project to resolve it. | ||||
| if( this.securityPolicy != null && !securityPolicyFile.exists() ) | if( this.securityPolicy != null && !securityPolicyFile.exists() ) | ||||
| { | { | ||||
| securityPolicyFile = resolveFile( securityPolicy ); | |||||
| final String filename = securityPolicy; | |||||
| securityPolicyFile = getContext().resolveFile( filename ); | |||||
| } | } | ||||
| // If we still can't find it, complain | // If we still can't find it, complain | ||||
| if( !securityPolicyFile.exists() ) | if( !securityPolicyFile.exists() ) | ||||
| @@ -23,6 +23,7 @@ import javax.xml.parsers.SAXParser; | |||||
| import javax.xml.parsers.SAXParserFactory; | import javax.xml.parsers.SAXParserFactory; | ||||
| import org.apache.avalon.excalibur.io.FileUtil; | import org.apache.avalon.excalibur.io.FileUtil; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.api.AbstractTask; | |||||
| import org.apache.tools.ant.taskdefs.Java; | import org.apache.tools.ant.taskdefs.Java; | ||||
| 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; | ||||
| @@ -808,7 +809,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool | |||||
| { | { | ||||
| // try to use the compiler specified by build.compiler. Right now we are just going | // try to use the compiler specified by build.compiler. Right now we are just going | ||||
| // to allow Jikes | // to allow Jikes | ||||
| String buildCompiler = getTask().getProperty( "build.compiler" ).toString(); | |||||
| String buildCompiler = getTask().getContext().getProperty( "build.compiler" ).toString(); | |||||
| if( buildCompiler != null && buildCompiler.equals( "jikes" ) ) | if( buildCompiler != null && buildCompiler.equals( "jikes" ) ) | ||||
| { | { | ||||
| javaTask.createArg().setValue( "-compiler" ); | javaTask.createArg().setValue( "-compiler" ); | ||||
| @@ -19,6 +19,7 @@ import java.util.jar.JarEntry; | |||||
| import java.util.jar.JarFile; | import java.util.jar.JarFile; | ||||
| import java.util.jar.JarOutputStream; | import java.util.jar.JarOutputStream; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.api.AbstractTask; | |||||
| import org.apache.tools.ant.taskdefs.Java; | import org.apache.tools.ant.taskdefs.Java; | ||||
| import org.apache.tools.ant.types.Argument; | import org.apache.tools.ant.types.Argument; | ||||
| import org.apache.tools.ant.types.EnumeratedAttribute; | import org.apache.tools.ant.types.EnumeratedAttribute; | ||||
| @@ -967,7 +968,7 @@ public class WebsphereDeploymentTool | |||||
| EnvironmentVariable var = new EnvironmentVariable(); | EnvironmentVariable var = new EnvironmentVariable(); | ||||
| var.setKey( "websphere.lib.dir" ); | var.setKey( "websphere.lib.dir" ); | ||||
| final String webshpereHome = getTask().getProperty( "websphere.home" ).toString(); | |||||
| final String webshpereHome = getTask().getContext().getProperty( "websphere.home" ).toString(); | |||||
| var.setValue( webshpereHome + "/lib" ); | var.setValue( webshpereHome + "/lib" ); | ||||
| javaTask.addSysproperty( var ); | javaTask.addSysproperty( var ); | ||||
| @@ -8,13 +8,12 @@ | |||||
| package org.apache.tools.ant.taskdefs.optional.javacc; | package org.apache.tools.ant.taskdefs.optional.javacc; | ||||
| import java.io.File; | import java.io.File; | ||||
| import java.io.IOException; | |||||
| import java.util.Enumeration; | import java.util.Enumeration; | ||||
| import java.util.Hashtable; | import java.util.Hashtable; | ||||
| import org.apache.aut.nativelib.ExecManager; | import org.apache.aut.nativelib.ExecManager; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Task; | |||||
| import org.apache.myrmidon.framework.Execute; | import org.apache.myrmidon.framework.Execute; | ||||
| import org.apache.tools.ant.Task; | |||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import org.apache.tools.ant.types.CommandlineJava; | import org.apache.tools.ant.types.CommandlineJava; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| @@ -29,7 +28,6 @@ import org.apache.tools.ant.types.PathUtil; | |||||
| */ | */ | ||||
| public class JJTree extends Task | public class JJTree extends Task | ||||
| { | { | ||||
| // keys to optional attributes | // keys to optional attributes | ||||
| private final static String BUILD_NODE_FILES = "BUILD_NODE_FILES"; | private final static String BUILD_NODE_FILES = "BUILD_NODE_FILES"; | ||||
| private final static String MULTI = "MULTI"; | private final static String MULTI = "MULTI"; | ||||
| @@ -11,6 +11,7 @@ import java.io.File; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.api.AbstractTask; | |||||
| import org.apache.tools.ant.taskdefs.MatchingTask; | import org.apache.tools.ant.taskdefs.MatchingTask; | ||||
| import org.apache.tools.ant.taskdefs.optional.jsp.compilers.CompilerAdapter; | import org.apache.tools.ant.taskdefs.optional.jsp.compilers.CompilerAdapter; | ||||
| import org.apache.tools.ant.taskdefs.optional.jsp.compilers.CompilerAdapterFactory; | import org.apache.tools.ant.taskdefs.optional.jsp.compilers.CompilerAdapterFactory; | ||||
| @@ -355,7 +356,8 @@ public class JspC extends MatchingTask | |||||
| int filecount = 0; | int filecount = 0; | ||||
| for( int i = 0; i < list.length; i++ ) | for( int i = 0; i < list.length; i++ ) | ||||
| { | { | ||||
| File srcDir = (File)resolveFile( list[ i ] ); | |||||
| final String filename = list[ i ]; | |||||
| File srcDir = (File)getContext().resolveFile( filename ); | |||||
| if( !srcDir.exists() ) | if( !srcDir.exists() ) | ||||
| { | { | ||||
| throw new TaskException( "srcdir \"" + srcDir.getPath() + | throw new TaskException( "srcdir \"" + srcDir.getPath() + | ||||
| @@ -371,7 +373,7 @@ public class JspC extends MatchingTask | |||||
| // compile the source files | // compile the source files | ||||
| Object compiler = getProperty( "jsp.compiler" ); | |||||
| Object compiler = getContext().getProperty( "jsp.compiler" ); | |||||
| if( compiler == null ) | if( compiler == null ) | ||||
| { | { | ||||
| compiler = "jasper"; | compiler = "jasper"; | ||||
| @@ -21,6 +21,7 @@ import java.util.Random; | |||||
| import org.apache.aut.nativelib.ExecManager; | import org.apache.aut.nativelib.ExecManager; | ||||
| import org.apache.myrmidon.api.TaskContext; | import org.apache.myrmidon.api.TaskContext; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.api.AbstractTask; | |||||
| import org.apache.myrmidon.framework.Execute; | import org.apache.myrmidon.framework.Execute; | ||||
| 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; | ||||
| @@ -430,8 +431,8 @@ public class JUnitTask extends Task | |||||
| { | { | ||||
| String filename = test.getOutfile() + fe.getExtension(); | String filename = test.getOutfile() + fe.getExtension(); | ||||
| File destFile = new File( test.getTodir(), filename ); | File destFile = new File( test.getTodir(), filename ); | ||||
| String absFilename = destFile.getAbsolutePath(); | |||||
| return resolveFile( absFilename ); | |||||
| final String absFilename = destFile.getAbsolutePath(); | |||||
| return getContext().resolveFile( absFilename ); | |||||
| } | } | ||||
| return null; | return null; | ||||
| } | } | ||||
| @@ -19,6 +19,7 @@ import javax.xml.parsers.DocumentBuilder; | |||||
| import javax.xml.parsers.DocumentBuilderFactory; | import javax.xml.parsers.DocumentBuilderFactory; | ||||
| import org.apache.avalon.framework.ExceptionUtil; | import org.apache.avalon.framework.ExceptionUtil; | ||||
| 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.DirectoryScanner; | import org.apache.tools.ant.types.DirectoryScanner; | ||||
| import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
| @@ -184,7 +185,7 @@ public class XMLResultAggregator | |||||
| } | } | ||||
| if( toDir == null ) | if( toDir == null ) | ||||
| { | { | ||||
| toDir = resolveFile( DEFAULT_DIR ); | |||||
| toDir = getContext().resolveFile( DEFAULT_DIR ); | |||||
| } | } | ||||
| return new File( toDir, toFile ); | return new File( toDir, toFile ); | ||||
| } | } | ||||
| @@ -211,7 +212,7 @@ public class XMLResultAggregator | |||||
| if( pathname.endsWith( ".xml" ) ) | if( pathname.endsWith( ".xml" ) ) | ||||
| { | { | ||||
| File file = new File( scanner.getBasedir(), pathname ); | File file = new File( scanner.getBasedir(), pathname ); | ||||
| file = resolveFile( file.getPath() ); | |||||
| file = getContext().resolveFile( file.getPath() ); | |||||
| v.add( file ); | v.add( file ); | ||||
| } | } | ||||
| } | } | ||||
| @@ -249,7 +249,7 @@ public abstract class AbstractMetamataTask | |||||
| { | { | ||||
| throw new TaskException( "'metamatahome' must point to Metamata home directory." ); | throw new TaskException( "'metamatahome' must point to Metamata home directory." ); | ||||
| } | } | ||||
| m_metamataHome = resolveFile( m_metamataHome.getPath() ); | |||||
| m_metamataHome = getContext().resolveFile( m_metamataHome.getPath() ); | |||||
| File jar = getMetamataJar( m_metamataHome ); | File jar = getMetamataJar( m_metamataHome ); | ||||
| if( !jar.exists() ) | if( !jar.exists() ) | ||||
| { | { | ||||
| @@ -16,6 +16,7 @@ import java.util.Random; | |||||
| import org.apache.aut.nativelib.ExecManager; | import org.apache.aut.nativelib.ExecManager; | ||||
| 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.myrmidon.framework.Execute; | import org.apache.myrmidon.framework.Execute; | ||||
| 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; | ||||
| @@ -309,7 +310,7 @@ public class MParse | |||||
| { | { | ||||
| throw new TaskException( "'metamatahome' must point to Metamata home directory." ); | throw new TaskException( "'metamatahome' must point to Metamata home directory." ); | ||||
| } | } | ||||
| m_metahome = resolveFile( m_metahome.getPath() ); | |||||
| m_metahome = getContext().resolveFile( m_metahome.getPath() ); | |||||
| // check that the needed jar exists. | // check that the needed jar exists. | ||||
| File[] jars = getMetamataLibs(); | File[] jars = getMetamataLibs(); | ||||
| @@ -326,7 +327,7 @@ public class MParse | |||||
| { | { | ||||
| throw new TaskException( "Invalid target: " + m_target ); | throw new TaskException( "Invalid target: " + m_target ); | ||||
| } | } | ||||
| m_target = resolveFile( m_target.getPath() ); | |||||
| m_target = getContext().resolveFile( m_target.getPath() ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -24,6 +24,7 @@ import java.util.ArrayList; | |||||
| import org.apache.avalon.excalibur.io.FileUtil; | import org.apache.avalon.excalibur.io.FileUtil; | ||||
| import org.apache.myrmidon.api.TaskContext; | import org.apache.myrmidon.api.TaskContext; | ||||
| 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.FileScanner; | import org.apache.tools.ant.types.FileScanner; | ||||
| import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
| @@ -399,7 +400,10 @@ public class FTP | |||||
| OutputStream outstream = null; | OutputStream outstream = null; | ||||
| try | try | ||||
| { | { | ||||
| final File file = FileUtil.resolveFile( resolveFile( dir ), filename ); | |||||
| final String filename1 = dir; | |||||
| File result; | |||||
| result = getContext().resolveFile( filename1 ); | |||||
| final File file = FileUtil.resolveFile( result, filename ); | |||||
| if( m_newerOnly && isUpToDate( ftp, file, remoteResolveFile( filename ) ) ) | if( m_newerOnly && isUpToDate( ftp, file, remoteResolveFile( filename ) ) ) | ||||
| { | { | ||||
| @@ -697,13 +701,13 @@ public class FTP | |||||
| * @exception IOException Description of Exception | * @exception IOException Description of Exception | ||||
| * @exception TaskException Description of Exception | * @exception TaskException Description of Exception | ||||
| */ | */ | ||||
| protected void sendFile( FTPClient ftp, String dir, String filename ) | |||||
| protected void sendFile( FTPClient ftp, final String dir, final String filename ) | |||||
| throws IOException, TaskException | throws IOException, TaskException | ||||
| { | { | ||||
| InputStream instream = null; | InputStream instream = null; | ||||
| try | try | ||||
| { | { | ||||
| File file = resolveFile( new File( dir, filename ).getPath() ); | |||||
| File file = getContext().resolveFile( new File( dir, filename ).getPath() ); | |||||
| if( m_newerOnly && isUpToDate( ftp, file, remoteResolveFile( filename ) ) ) | if( m_newerOnly && isUpToDate( ftp, file, remoteResolveFile( filename ) ) ) | ||||
| { | { | ||||
| @@ -10,6 +10,7 @@ package org.apache.tools.ant.taskdefs.optional.perforce; | |||||
| import org.apache.aut.nativelib.ExecManager; | import org.apache.aut.nativelib.ExecManager; | ||||
| import org.apache.aut.nativelib.ExecOutputHandler; | import org.apache.aut.nativelib.ExecOutputHandler; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.api.AbstractTask; | |||||
| import org.apache.myrmidon.framework.Execute; | import org.apache.myrmidon.framework.Execute; | ||||
| import org.apache.oro.text.perl.Perl5Util; | import org.apache.oro.text.perl.Perl5Util; | ||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| @@ -103,15 +104,15 @@ public abstract class P4Base | |||||
| //Get default P4 settings from environment - Mark would have done something cool with | //Get default P4 settings from environment - Mark would have done something cool with | ||||
| //introspection here.....:-) | //introspection here.....:-) | ||||
| Object tmpprop; | Object tmpprop; | ||||
| if( ( tmpprop = getProperty( "p4.port" ) ) != null ) | |||||
| if( ( tmpprop = getContext().getProperty( "p4.port" ) ) != null ) | |||||
| { | { | ||||
| setPort( tmpprop.toString() ); | setPort( tmpprop.toString() ); | ||||
| } | } | ||||
| if( ( tmpprop = getProperty( "p4.client" ) ) != null ) | |||||
| if( ( tmpprop = getContext().getProperty( "p4.client" ) ) != null ) | |||||
| { | { | ||||
| setClient( tmpprop.toString() ); | setClient( tmpprop.toString() ); | ||||
| } | } | ||||
| if( ( tmpprop = getProperty( "p4.user" ) ) != null ) | |||||
| if( ( tmpprop = getContext().getProperty( "p4.user" ) ) != null ) | |||||
| { | { | ||||
| setUser( tmpprop.toString() ); | setUser( tmpprop.toString() ); | ||||
| } | } | ||||
| @@ -15,6 +15,7 @@ import java.util.ArrayList; | |||||
| import java.util.Random; | import java.util.Random; | ||||
| import org.apache.aut.nativelib.ExecManager; | import org.apache.aut.nativelib.ExecManager; | ||||
| 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.myrmidon.framework.Execute; | import org.apache.myrmidon.framework.Execute; | ||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| @@ -158,8 +159,8 @@ public class CovMerge extends Task | |||||
| for( int j = 0; j < f.length; j++ ) | for( int j = 0; j < f.length; j++ ) | ||||
| { | { | ||||
| String pathname = f[ j ]; | String pathname = f[ j ]; | ||||
| File file = new File( ds.getBasedir(), pathname ); | |||||
| file = resolveFile( file.getPath() ); | |||||
| final File file = new File( ds.getBasedir(), pathname ); | |||||
| file = getContext().resolveFile( file.getPath() ); | |||||
| v.add( file ); | v.add( file ); | ||||
| } | } | ||||
| } | } | ||||
| @@ -215,7 +216,7 @@ public class CovMerge extends Task | |||||
| pw.println( snapshots[ i ].getAbsolutePath() ); | pw.println( snapshots[ i ].getAbsolutePath() ); | ||||
| } | } | ||||
| // last file is the output snapshot | // last file is the output snapshot | ||||
| pw.println( resolveFile( tofile.getPath() ) ); | |||||
| pw.println( getContext().resolveFile( tofile.getPath() ) ); | |||||
| pw.flush(); | pw.flush(); | ||||
| } | } | ||||
| catch( IOException e ) | catch( IOException e ) | ||||
| @@ -19,6 +19,7 @@ import javax.xml.transform.dom.DOMSource; | |||||
| import javax.xml.transform.stream.StreamResult; | import javax.xml.transform.stream.StreamResult; | ||||
| import org.apache.aut.nativelib.ExecManager; | import org.apache.aut.nativelib.ExecManager; | ||||
| 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.myrmidon.framework.Execute; | import org.apache.myrmidon.framework.Execute; | ||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| @@ -290,8 +291,8 @@ public class CovReport extends Task | |||||
| { | { | ||||
| v.add( "-filters=" + filters ); | v.add( "-filters=" + filters ); | ||||
| } | } | ||||
| v.add( "-output=" + resolveFile( tofile.getPath() ) ); | |||||
| v.add( "-snapshot=" + resolveFile( snapshot.getPath() ) ); | |||||
| v.add( "-output=" + getContext().resolveFile( tofile.getPath() ) ); | |||||
| v.add( "-snapshot=" + getContext().resolveFile( snapshot.getPath() ) ); | |||||
| // as a default -sourcepath use . in JProbe, so use project . | // as a default -sourcepath use . in JProbe, so use project . | ||||
| if( sourcePath == null ) | if( sourcePath == null ) | ||||
| { | { | ||||
| @@ -15,6 +15,7 @@ import java.io.StringWriter; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import org.apache.aut.nativelib.ExecManager; | import org.apache.aut.nativelib.ExecManager; | ||||
| 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.myrmidon.framework.Execute; | import org.apache.myrmidon.framework.Execute; | ||||
| import org.apache.tools.ant.types.Argument; | import org.apache.tools.ant.types.Argument; | ||||
| @@ -291,7 +292,7 @@ public class Coverage | |||||
| } | } | ||||
| if( m_javaExe != null ) | if( m_javaExe != null ) | ||||
| { | { | ||||
| params.add( "-jp_java_exe=" + resolveFile( m_javaExe.getPath() ) ); | |||||
| params.add( "-jp_java_exe=" + getContext().resolveFile( m_javaExe.getPath() ) ); | |||||
| } | } | ||||
| params.add( "-jp_working_dir=" + m_workingDir.getPath() ); | params.add( "-jp_working_dir=" + m_workingDir.getPath() ); | ||||
| params.add( "-jp_snapshot_dir=" + m_snapshotDir.getPath() ); | params.add( "-jp_snapshot_dir=" + m_snapshotDir.getPath() ); | ||||
| @@ -366,7 +367,7 @@ public class Coverage | |||||
| { | { | ||||
| m_snapshotDir = new File( "." ); | m_snapshotDir = new File( "." ); | ||||
| } | } | ||||
| m_snapshotDir = resolveFile( m_snapshotDir.getPath() ); | |||||
| m_snapshotDir = getContext().resolveFile( m_snapshotDir.getPath() ); | |||||
| if( !m_snapshotDir.isDirectory() || !m_snapshotDir.exists() ) | if( !m_snapshotDir.isDirectory() || !m_snapshotDir.exists() ) | ||||
| { | { | ||||
| throw new TaskException( "Snapshot directory does not exists :" + m_snapshotDir ); | throw new TaskException( "Snapshot directory does not exists :" + m_snapshotDir ); | ||||
| @@ -375,7 +376,7 @@ public class Coverage | |||||
| { | { | ||||
| m_workingDir = new File( "." ); | m_workingDir = new File( "." ); | ||||
| } | } | ||||
| m_workingDir = resolveFile( m_workingDir.getPath() ); | |||||
| m_workingDir = getContext().resolveFile( m_workingDir.getPath() ); | |||||
| // check for info, do your best to select the java executable. | // check for info, do your best to select the java executable. | ||||
| // JProbe 3.0 fails if there is no javaexe option. So | // JProbe 3.0 fails if there is no javaexe option. So | ||||
| @@ -9,6 +9,7 @@ package org.apache.tools.ant.taskdefs.optional.vss; | |||||
| import java.io.File; | import java.io.File; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.api.AbstractTask; | |||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| @@ -144,7 +145,7 @@ public class MSVSSCHECKIN extends MSVSS | |||||
| else | else | ||||
| { | { | ||||
| // make sure m_LocalDir exists, create it if it doesn't | // make sure m_LocalDir exists, create it if it doesn't | ||||
| File dir = resolveFile( m_LocalPath ); | |||||
| File dir = getContext().resolveFile( m_LocalPath ); | |||||
| if( !dir.exists() ) | if( !dir.exists() ) | ||||
| { | { | ||||
| boolean done = dir.mkdirs(); | boolean done = dir.mkdirs(); | ||||
| @@ -9,6 +9,7 @@ package org.apache.tools.ant.taskdefs.optional.vss; | |||||
| import java.io.File; | import java.io.File; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.api.AbstractTask; | |||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| @@ -171,7 +172,7 @@ public class MSVSSCHECKOUT extends MSVSS | |||||
| else | else | ||||
| { | { | ||||
| // make sure m_LocalDir exists, create it if it doesn't | // make sure m_LocalDir exists, create it if it doesn't | ||||
| File dir = resolveFile( m_LocalPath ); | |||||
| File dir = getContext().resolveFile( m_LocalPath ); | |||||
| if( !dir.exists() ) | if( !dir.exists() ) | ||||
| { | { | ||||
| boolean done = dir.mkdirs(); | boolean done = dir.mkdirs(); | ||||
| @@ -9,6 +9,7 @@ package org.apache.tools.ant.taskdefs.optional.vss; | |||||
| import java.io.File; | import java.io.File; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.api.AbstractTask; | |||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| @@ -379,7 +380,7 @@ public class MSVSSGET extends MSVSS | |||||
| else | else | ||||
| { | { | ||||
| // make sure m_LocalDir exists, create it if it doesn't | // make sure m_LocalDir exists, create it if it doesn't | ||||
| File dir = resolveFile( m_LocalPath ); | |||||
| File dir = getContext().resolveFile( m_LocalPath ); | |||||
| if( !dir.exists() ) | if( !dir.exists() ) | ||||
| { | { | ||||
| boolean done = dir.mkdirs(); | boolean done = dir.mkdirs(); | ||||