adammurdoch 02/03/18 18:44:38
Modified: proposal/myrmidon/src/java/org/apache/antlib/dotnet
CSharp.java
proposal/myrmidon/src/java/org/apache/antlib/xml
XMLValidateTask.java
proposal/myrmidon/src/manifest ant1-ant-descriptor.xml
proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs
IContract.java Javah.java
proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/javac
DefaultCompilerAdapter.java Gcj.java Jikes.java
Jvc.java Kjc.java
proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/javadoc
DocletInfo.java Javadoc.java
proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/jdepend
JDependTask.java
proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/jsp
JspC.java WLJspc.java
proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/metamata
AbstractMetamataTask.java MAudit.java MMetrics.java
MParse.java
proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/rmic
DefaultRmicAdapter.java
proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/sitraka
Coverage.java
proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/vss
MSVSSCHECKIN.java MSVSSCHECKOUT.java MSVSSGET.java
proposal/myrmidon/src/todo/org/apache/tools/todo/types
Argument.java CommandlineJava.java
EnvironmentVariable.java Path.java PathElement.java
PathUtil.java
proposal/myrmidon/src/todo/org/apache/tools/todo/types/converters
StringToPathConverter.java
proposal/myrmidon/src/todo/org/apache/tools/todo/util
FileUtils.java
Log:
Some refactoring of Path. The plan is to make the 'evaluate' API of Path a
little narrower, to make it easier to extract an interface, and get multiple
path implementations happening.
* Replaced usages of Path.append() with Path.addPath(), and removed append().
* Replaced usages of Path.addExisting() with Path.addPath(), and removed
addExisting().
* Replaced Path.size() with Path.isEmpty().
* Added the setX() methods back.
* Replaced usages of Path.toString() with new PathUtil.formatPath() method,
and
removed Path.toString(). Probably missed a few usages.
* Replaced FileUtil.translatePath( Path ) with PathUtil.formatPath(), and
removed translatePath().
* Enabled the String -> Path converter again.
Revision Changes Path
1.7 +1 -1
jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/dotnet/CSharp.java
Index: CSharp.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/dotnet/CSharp.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- CSharp.java 18 Mar 2002 11:49:46 -0000 1.6
+++ CSharp.java 19 Mar 2002 02:44:36 -0000 1.7
@@ -396,7 +396,7 @@
{
m_referenceFiles = new Path();
}
- m_referenceFiles.append( path );
+ m_referenceFiles.addPath( path );
}
/**
1.22 +1 -1
jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/xml/XMLValidateTask.java
Index: XMLValidateTask.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/xml/XMLValidateTask.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- XMLValidateTask.java 17 Mar 2002 09:42:17 -0000 1.21
+++ XMLValidateTask.java 19 Mar 2002 02:44:36 -0000 1.22
@@ -109,7 +109,7 @@
}
else
{
- m_classpath.append( classpath );
+ m_classpath.addPath( classpath );
}
}
1.6 +0 -2
jakarta-ant/proposal/myrmidon/src/manifest/ant1-ant-descriptor.xml
Index: ant1-ant-descriptor.xml
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/manifest/ant1-ant-descriptor.xml,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ant1-ant-descriptor.xml 12 Feb 2002 10:19:49 -0000 1.5
+++ ant1-ant-descriptor.xml 19 Mar 2002 02:44:36 -0000 1.6
@@ -1,8 +1,6 @@
<ant-lib version="1.0">
<types>
- <task name="ant1-tasklib"
classname="org.apache.myrmidon.libs.ant1.Ant1Tasklib" />
-
<data-type name="path" classname="org.apache.tools.ant.types.Path" />
<task name="path"
classname="org.apache.myrmidon.framework.TypeInstanceTask" />
<converter
1.4 +27 -22
jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/IContract.java
Index: IContract.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/IContract.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- IContract.java 18 Mar 2002 11:49:47 -0000 1.3
+++ IContract.java 19 Mar 2002 02:44:36 -0000 1.4
@@ -21,6 +21,7 @@
import org.apache.tools.todo.taskdefs.javac.Javac;
import org.apache.tools.todo.types.DirectoryScanner;
import org.apache.tools.todo.types.Path;
+import org.apache.tools.todo.types.PathUtil;
/**
* Instruments Java classes with <a
href="http://www.reliable-systems.com/tools/">
@@ -484,9 +485,9 @@
* @param path The new Classpath value
* @path the classpath
*/
- public void setClasspath( Path path )
+ public void setClasspath( final Path path )
{
- createClasspath().append( path );
+ createClasspath().addPath( path );
}
/**
@@ -706,30 +707,34 @@
classpathHelper.modify( baseClasspath );
// Create the classpath required to compile the sourcefiles
BEFORE instrumentation
- Path beforeInstrumentationClasspath = (
(Path)baseClasspath.clone() );
- beforeInstrumentationClasspath.append( new Path(
srcDir.getAbsolutePath() ) );
+ Path beforeInstrumentationClasspath = new Path();
+ beforeInstrumentationClasspath.addPath( baseClasspath );
+ beforeInstrumentationClasspath.addLocation( srcDir );
// Create the classpath required to compile the sourcefiles
AFTER instrumentation
- Path afterInstrumentationClasspath = (
(Path)baseClasspath.clone() );
- afterInstrumentationClasspath.append( new Path(
instrumentDir.getAbsolutePath() ) );
- afterInstrumentationClasspath.append( new Path(
repositoryDir.getAbsolutePath() ) );
- afterInstrumentationClasspath.append( new Path(
srcDir.getAbsolutePath() ) );
- afterInstrumentationClasspath.append( new Path(
buildDir.getAbsolutePath() ) );
+ Path afterInstrumentationClasspath = new Path();
+ afterInstrumentationClasspath.addPath( baseClasspath );
+ afterInstrumentationClasspath.addLocation( instrumentDir );
+ afterInstrumentationClasspath.addLocation( repositoryDir );
+ afterInstrumentationClasspath.addLocation( srcDir );
+ afterInstrumentationClasspath.addLocation( buildDir );
// Create the classpath required to automatically compile the
repository files
- Path repositoryClasspath = ( (Path)baseClasspath.clone() );
- repositoryClasspath.append( new Path(
instrumentDir.getAbsolutePath() ) );
- repositoryClasspath.append( new Path( srcDir.getAbsolutePath() )
);
- repositoryClasspath.append( new Path(
repositoryDir.getAbsolutePath() ) );
- repositoryClasspath.append( new Path( buildDir.getAbsolutePath()
) );
+ Path repositoryClasspath = new Path();
+ repositoryClasspath.addPath( baseClasspath );
+ repositoryClasspath.addLocation( instrumentDir );
+ repositoryClasspath.addLocation( srcDir );
+ repositoryClasspath.addLocation( repositoryDir );
+ repositoryClasspath.addLocation( buildDir );
// Create the classpath required for iContract itself
- Path iContractClasspath = ( (Path)baseClasspath.clone() );
- iContractClasspath.append( new Path( System.getProperty(
"java.home" ) + File.separator + ".." + File.separator + "lib" + File.separator
+ "tools.jar" ) );
- iContractClasspath.append( new Path( srcDir.getAbsolutePath() )
);
- iContractClasspath.append( new Path(
repositoryDir.getAbsolutePath() ) );
- iContractClasspath.append( new Path(
instrumentDir.getAbsolutePath() ) );
- iContractClasspath.append( new Path( buildDir.getAbsolutePath()
) );
+ Path iContractClasspath = new Path();
+ iContractClasspath.addPath( baseClasspath );
+ iContractClasspath.addLocation( new File(System.getProperty(
"java.home" ) + File.separator + ".." + File.separator + "lib" + File.separator
+ "tools.jar" ) );
+ iContractClasspath.addLocation( srcDir );
+ iContractClasspath.addLocation( repositoryDir );
+ iContractClasspath.addLocation( instrumentDir );
+ iContractClasspath.addLocation( buildDir );
// Create a forked java process
Java iContract = null;//(Java)getProject().createTask( "java" );
@@ -768,7 +773,7 @@
}
iControlProps.setProperty( "sourceRoot",
srcDir.getAbsolutePath() );
iControlProps.setProperty( "classRoot",
classDir.getAbsolutePath() );
- iControlProps.setProperty( "classpath",
afterInstrumentationClasspath.toString() );
+ iControlProps.setProperty( "classpath", PathUtil.formatPath(
afterInstrumentationClasspath ) );
iControlProps.setProperty( "controlFile",
controlFile.getAbsolutePath() );
iControlProps.setProperty( "targetsFile",
targets.getAbsolutePath() );
@@ -1027,7 +1032,7 @@
{
icCompiler = compiler;
m_includeJavaRuntime = true;
- path.append( getCompileClasspath() );
+ addCompileClasspath( path );
}
}
}
1.2 +3 -2
jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/Javah.java
Index: Javah.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/Javah.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Javah.java 17 Mar 2002 10:00:31 -0000 1.1
+++ Javah.java 19 Mar 2002 02:44:36 -0000 1.2
@@ -17,6 +17,7 @@
import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.todo.types.Commandline;
import org.apache.tools.todo.types.Path;
+import org.apache.tools.todo.types.PathUtil;
import org.apache.tools.todo.util.FileUtils;
import org.apache.tools.todo.taskdefs.ClassArgument;
@@ -270,7 +271,7 @@
if( m_classpath != null )
{
cmd.addArgument( "-classpath" );
- cmd.addArguments( FileUtils.translateCommandline( m_classpath )
);
+ cmd.addArgument( PathUtil.formatPath( m_classpath ) );
}
if( m_verbose )
@@ -298,7 +299,7 @@
if( m_bootclasspath != null )
{
cmd.addArgument( "-bootclasspath" );
- cmd.addArguments( FileUtils.translateCommandline(
m_bootclasspath ) );
+ cmd.addArgument( PathUtil.formatPath( m_bootclasspath ) );
}
logAndAddFilesToCompile( cmd );
1.4 +9 -16
jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/javac/DefaultCompilerAdapter.java
Index: DefaultCompilerAdapter.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/javac/DefaultCompilerAdapter.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DefaultCompilerAdapter.java 18 Mar 2002 11:49:47 -0000 1.3
+++ DefaultCompilerAdapter.java 19 Mar 2002 02:44:36 -0000 1.4
@@ -19,8 +19,6 @@
import org.apache.tools.todo.types.Commandline;
import org.apache.tools.todo.types.Path;
import org.apache.tools.todo.types.PathUtil;
-import org.apache.tools.todo.util.FileUtils;
-import org.apache.tools.todo.taskdefs.javac.CompilerAdapter;
/**
* This is the default implementation for the CompilerAdapter interface.
@@ -132,7 +130,8 @@
boolean
useDebugLevel )
throws TaskException
{
- Path classpath = getCompileClasspath();
+ Path classpath = new Path();
+ addCompileClasspath( classpath );
String memoryParameterPrefix = "-J-X";
if( m_memoryInitialSize != null )
{
@@ -177,10 +176,10 @@
}
cmd.addArgument( "-classpath" );
- cmd.addArguments( FileUtils.translateCommandline( classpath ) );
+ cmd.addArgument( PathUtil.formatPath( classpath ) );
cmd.addArgument( "-sourcepath" );
- cmd.addArguments( FileUtils.translateCommandline( src ) );
+ cmd.addArgument( PathUtil.formatPath( src ) );
if( target != null )
{
@@ -191,13 +190,13 @@
if( m_bootclasspath != null )
{
cmd.addArgument( "-bootclasspath" );
- cmd.addArguments( FileUtils.translateCommandline(
m_bootclasspath ) );
+ cmd.addArgument( PathUtil.formatPath( m_bootclasspath ) );
}
if( m_extdirs != null )
{
cmd.addArgument( "-extdirs" );
- cmd.addArguments( FileUtils.translateCommandline( m_extdirs ) );
+ cmd.addArgument( PathUtil.formatPath( m_extdirs ) );
}
if( m_encoding != null )
@@ -279,15 +278,11 @@
}
/**
- * Builds the compilation classpath.
- *
- * @return The CompileClasspath value
+ * Adds the compilation classpath to a path.
*/
- protected Path getCompileClasspath()
+ protected void addCompileClasspath( final Path classpath )
throws TaskException
{
- Path classpath = new Path();
-
// add dest dir to classpath so that previously compiled and
// untouched classes are on classpath
@@ -299,10 +294,8 @@
// add the classpath
if( m_compileClasspath != null )
{
- classpath.addExisting( m_compileClasspath );
+ classpath.addPath( m_compileClasspath );
}
-
- return classpath;
}
/**
1.2 +6 -5
jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/javac/Gcj.java
Index: Gcj.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/javac/Gcj.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Gcj.java 17 Mar 2002 09:42:22 -0000 1.1
+++ Gcj.java 19 Mar 2002 02:44:36 -0000 1.2
@@ -11,6 +11,7 @@
import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.todo.types.Commandline;
import org.apache.tools.todo.types.Path;
+import org.apache.tools.todo.types.PathUtil;
import org.apache.tools.todo.util.FileUtils;
import org.apache.tools.todo.taskdefs.javac.DefaultCompilerAdapter;
@@ -53,23 +54,23 @@
// so we'll emulate it for compatibility and convenience.
if( m_bootclasspath != null )
{
- classpath.append( m_bootclasspath );
+ classpath.addPath( m_bootclasspath );
}
// gcj doesn't support an extension dir (-extdir)
// so we'll emulate it for compatibility and convenience.
addExtdirs( classpath );
- if( ( m_bootclasspath == null ) || ( m_bootclasspath.size() == 0 ) )
+ if( ( m_bootclasspath == null ) || m_bootclasspath.isEmpty() )
{
// no bootclasspath, therefore, get one from the java runtime
m_includeJavaRuntime = true;
}
- classpath.append( getCompileClasspath() );
+ addCompileClasspath( classpath );
// Gcj has no option for source-path so we
// will add it to classpath.
- classpath.append( src );
+ classpath.addPath( src );
cmd.setExecutable( "gcj" );
@@ -86,7 +87,7 @@
}
cmd.addArgument( "-classpath" );
- cmd.addArguments( FileUtils.translateCommandline( classpath ) );
+ cmd.addArgument( PathUtil.formatPath( classpath ) );
if( m_encoding != null )
{
1.2 +7 -6
jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/javac/Jikes.java
Index: Jikes.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/javac/Jikes.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Jikes.java 17 Mar 2002 09:42:22 -0000 1.1
+++ Jikes.java 19 Mar 2002 02:44:36 -0000 1.2
@@ -11,6 +11,7 @@
import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.todo.types.Commandline;
import org.apache.tools.todo.types.Path;
+import org.apache.tools.todo.types.PathUtil;
import org.apache.tools.todo.util.FileUtils;
import org.apache.tools.todo.taskdefs.javac.DefaultCompilerAdapter;
@@ -50,14 +51,14 @@
// so we'll emulate it for compatibility and convenience.
if( m_bootclasspath != null )
{
- classpath.append( m_bootclasspath );
+ classpath.addPath( m_bootclasspath );
}
// Jikes doesn't support an extension dir (-extdir)
// so we'll emulate it for compatibility and convenience.
addExtdirs( classpath );
- if( ( m_bootclasspath == null ) || ( m_bootclasspath.size() == 0 ) )
+ if( ( m_bootclasspath == null ) || m_bootclasspath.isEmpty() )
{
// no bootclasspath, therefore, get one from the java runtime
m_includeJavaRuntime = true;
@@ -69,17 +70,17 @@
// bootclasspath and said to include the java runtime, it's on
// their head!
}
- classpath.append( getCompileClasspath() );
+ addCompileClasspath( classpath );
// Jikes has no option for source-path so we
// will add it to classpath.
- classpath.append( src );
+ classpath.addPath( src );
// if the user has set JIKESPATH we should add the contents as well
String jikesPath = System.getProperty( "jikes.class.path" );
if( jikesPath != null )
{
- classpath.append( new Path( jikesPath ) );
+ classpath.addPath( jikesPath );
}
Commandline cmd = new Commandline();
@@ -97,7 +98,7 @@
}
cmd.addArgument( "-classpath" );
- cmd.addArguments( FileUtils.translateCommandline( classpath ) );
+ cmd.addArgument( PathUtil.formatPath( classpath ) );
if( m_encoding != null )
{
1.2 +6 -5
jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/javac/Jvc.java
Index: Jvc.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/javac/Jvc.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Jvc.java 17 Mar 2002 09:42:22 -0000 1.1
+++ Jvc.java 19 Mar 2002 02:44:36 -0000 1.2
@@ -11,6 +11,7 @@
import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.todo.types.Commandline;
import org.apache.tools.todo.types.Path;
+import org.apache.tools.todo.types.PathUtil;
import org.apache.tools.todo.util.FileUtils;
import org.apache.tools.todo.taskdefs.javac.DefaultCompilerAdapter;
@@ -38,14 +39,14 @@
// so we'll emulate it for compatibility and convenience.
if( m_bootclasspath != null )
{
- classpath.append( m_bootclasspath );
+ classpath.addPath( m_bootclasspath );
}
// jvc doesn't support an extension dir (-extdir)
// so we'll emulate it for compatibility and convenience.
addExtdirs( classpath );
- if( ( m_bootclasspath == null ) || ( m_bootclasspath.size() == 0 ) )
+ if( ( m_bootclasspath == null ) || m_bootclasspath.isEmpty() )
{
// no bootclasspath, therefore, get one from the java runtime
m_includeJavaRuntime = true;
@@ -57,11 +58,11 @@
// bootclasspath and said to include the java runtime, it's on
// their head!
}
- classpath.append( getCompileClasspath() );
+ addCompileClasspath( classpath );
// jvc has no option for source-path so we
// will add it to classpath.
- classpath.append( src );
+ classpath.addPath( src );
Commandline cmd = new Commandline();
cmd.setExecutable( "jvc" );
@@ -74,7 +75,7 @@
// Add the Classpath before the "internal" one.
cmd.addArgument( "/cp:p" );
- cmd.addArguments( FileUtils.translateCommandline( classpath ) );
+ cmd.addArgument( PathUtil.formatPath( classpath ) );
// Enable MS-Extensions and ...
cmd.addArgument( "/x-" );
1.2 +7 -8
jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/javac/Kjc.java
Index: Kjc.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/javac/Kjc.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Kjc.java 17 Mar 2002 09:42:22 -0000 1.1
+++ Kjc.java 19 Mar 2002 02:44:36 -0000 1.2
@@ -9,11 +9,9 @@
import java.lang.reflect.Method;
import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.todo.types.Commandline;
import org.apache.tools.todo.types.Path;
-import org.apache.tools.todo.util.FileUtils;
-import org.apache.tools.todo.taskdefs.javac.DefaultCompilerAdapter;
+import org.apache.tools.todo.types.PathUtil;
/**
* The implementation of the Java compiler for KJC. This is primarily a
@@ -71,7 +69,8 @@
Commandline cmd = new Commandline();
// generate classpath, because kjc does't support sourcepath.
- Path classpath = getCompileClasspath();
+ Path classpath = new Path();
+ addCompileClasspath( classpath );
if( m_deprecation == true )
{
@@ -92,7 +91,7 @@
// kjc don't have bootclasspath option.
if( m_bootclasspath != null )
{
- cp.append( m_bootclasspath );
+ cp.addPath( m_bootclasspath );
}
if( m_extdirs != null )
@@ -100,10 +99,10 @@
addExtdirs( cp );
}
- cp.append( classpath );
- cp.append( src );
+ cp.addPath( classpath );
+ cp.addPath( src );
- cmd.addArguments( FileUtils.translateCommandline( cp ) );
+ cmd.addArgument( PathUtil.formatPath( cp ) );
// kjc-1.5A doesn't support -encoding option now.
// but it will be supported near the feature.
1.2 +1 -1
jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/javadoc/DocletInfo.java
Index: DocletInfo.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/javadoc/DocletInfo.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DocletInfo.java 17 Mar 2002 09:42:23 -0000 1.1
+++ DocletInfo.java 19 Mar 2002 02:44:37 -0000 1.2
@@ -32,7 +32,7 @@
}
else
{
- m_path.append( path );
+ m_path.addPath( path );
}
}
1.4 +8 -16
jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/javadoc/Javadoc.java
Index: Javadoc.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/javadoc/Javadoc.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Javadoc.java 18 Mar 2002 11:49:47 -0000 1.3
+++ Javadoc.java 19 Mar 2002 02:44:37 -0000 1.4
@@ -15,25 +15,18 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.StringTokenizer;
-import org.apache.aut.nativelib.ExecManager;
import org.apache.aut.nativelib.ExecOutputHandler;
import org.apache.aut.nativelib.Os;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.myrmidon.framework.Pattern;
import org.apache.tools.todo.types.Commandline;
import org.apache.tools.todo.types.DirectoryScanner;
import org.apache.tools.todo.types.FileSet;
import org.apache.tools.todo.types.Path;
+import org.apache.tools.todo.types.PathUtil;
import org.apache.tools.todo.types.ScannerUtil;
-import org.apache.tools.todo.util.FileUtils;
-import org.apache.tools.todo.taskdefs.javadoc.AccessType;
-import org.apache.tools.todo.taskdefs.javadoc.DocletInfo;
-import org.apache.tools.todo.taskdefs.javadoc.DocletParam;
-import org.apache.tools.todo.taskdefs.javadoc.GroupArgument;
-import org.apache.tools.todo.taskdefs.javadoc.Html;
/**
* This task makes it easy to generate Javadoc documentation for a
collection of
@@ -85,7 +78,6 @@
private Path m_classpath;
private Path m_bootclasspath;
private String m_group;
- private ArrayList m_compileList = new ArrayList( 10 );
private String m_packageList;
private ArrayList m_links = new ArrayList( 2 );
private ArrayList m_groups = new ArrayList( 2 );
@@ -122,7 +114,7 @@
}
else
{
- m_bootclasspath.append( src );
+ m_bootclasspath.addPath( src );
}
}
@@ -147,7 +139,7 @@
}
else
{
- m_classpath.append( src );
+ m_classpath.addPath( src );
}
}
@@ -392,7 +384,7 @@
}
else
{
- m_sourcePath.append( src );
+ m_sourcePath.addPath( src );
}
}
@@ -578,7 +570,7 @@
classpath.addPath( m_classpath );
}
cmd.addArgument( "-classpath" );
- cmd.addArgument( classpath.toString() );
+ cmd.addArgument( PathUtil.formatPath( classpath ) );
if( m_version && m_doclet == null )
{
@@ -615,7 +607,7 @@
if( m_doclet.getPath() != null )
{
cmd.addArgument( "-docletpath" );
- cmd.addArguments( FileUtils.translateCommandline(
m_doclet.getPath() ) );
+ cmd.addArgument( PathUtil.formatPath( m_doclet.getPath()
) );
}
for( Iterator e = m_doclet.getParams(); e.hasNext(); )
{
@@ -636,7 +628,7 @@
if( m_bootclasspath != null )
{
cmd.addArgument( "-bootclasspath" );
- cmd.addArguments( FileUtils.translateCommandline(
m_bootclasspath ) );
+ cmd.addArgument( PathUtil.formatPath( m_bootclasspath ) );
}
// add the links arguments
@@ -896,7 +888,7 @@
ArrayList packages, ArrayList
excludePackages )
throws TaskException
{
- getContext().debug( "Source path = " + sourcePath.toString() );
+ getContext().debug( "Source path = " + PathUtil.formatPath(
sourcePath ) );
StringBuffer msg = new StringBuffer( "Packages = " );
for( int i = 0; i < packages.size(); i++ )
{
1.4 +7 -5
jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/jdepend/JDependTask.java
Index: JDependTask.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/jdepend/JDependTask.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- JDependTask.java 18 Mar 2002 11:49:47 -0000 1.3
+++ JDependTask.java 19 Mar 2002 02:44:37 -0000 1.4
@@ -17,6 +17,7 @@
import org.apache.tools.todo.types.Commandline;
import org.apache.tools.todo.types.CommandlineJava;
import org.apache.tools.todo.types.Path;
+import org.apache.tools.todo.types.PathUtil;
import org.apache.tools.todo.util.FileUtils;
/**
@@ -54,7 +55,7 @@
}
else
{
- m_compileClasspath.append( classpath );
+ m_compileClasspath.addPath( classpath );
}
}
@@ -192,10 +193,11 @@
// not sure whether this test is needed but cost nothing to put.
// hope it will be reviewed by anybody competent
- if( m_compileClasspath.toString().length() > 0 )
+ final String compileClasspath = PathUtil.formatPath(
m_compileClasspath );
+ if( compileClasspath.length() > 0 )
{
commandline.addVmArgument( "-classpath" );
- commandline.addVmArgument( m_compileClasspath.toString() );
+ commandline.addVmArgument( compileClasspath );
}
if( m_outputFile != null )
@@ -207,7 +209,7 @@
// we have to find a cleaner way to put this output
}
- final String[] elements = FileUtils.parsePath(
m_sourcesPath.toString() );
+ final String[] elements = m_sourcesPath.list();
for( int i = 0; i < elements.length; i++ )
{
File f = new File( elements[ i ] );
@@ -276,7 +278,7 @@
getContext().info( "Output to be stored in " +
m_outputFile.getPath() );
}
- final String[] elements = FileUtils.parsePath(
m_sourcesPath.toString() );
+ final String[] elements = m_sourcesPath.list();
for( int i = 0; i < elements.length; i++ )
{
File f = new File( elements[ i ] );
1.2 +3 -3
jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/jsp/JspC.java
Index: JspC.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/jsp/JspC.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JspC.java 17 Mar 2002 09:56:54 -0000 1.1
+++ JspC.java 19 Mar 2002 02:44:37 -0000 1.2
@@ -58,7 +58,7 @@
* </a>
* @author <a href="mailto:[EMAIL PROTECTED]">Stefan Bodewig</a>
* @author <a href="mailto:[EMAIL PROTECTED]">J D Glanville</a>
- * @version $Revision: 1.1 $ $Date: 2002/03/17 09:56:54 $
+ * @version $Revision: 1.2 $ $Date: 2002/03/19 02:44:37 $
*/
public class JspC extends MatchingTask
{
@@ -109,7 +109,7 @@
}
else
{
- classpath.append( cp );
+ classpath.addPath( cp );
}
}
@@ -187,7 +187,7 @@
}
else
{
- src.append( srcDir );
+ src.addPath( srcDir );
}
}
1.3 +3 -2
jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/jsp/WLJspc.java
Index: WLJspc.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/jsp/WLJspc.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- WLJspc.java 18 Mar 2002 11:49:47 -0000 1.2
+++ WLJspc.java 19 Mar 2002 02:44:37 -0000 1.3
@@ -17,6 +17,7 @@
import org.apache.tools.todo.types.Argument;
import org.apache.tools.todo.types.DirectoryScanner;
import org.apache.tools.todo.types.Path;
+import org.apache.tools.todo.types.PathUtil;
/**
* Class to precompile JSP's using weblogic's jsp compiler (weblogic.jspc)
@@ -82,7 +83,7 @@
}
else
{
- compileClasspath.append( classpath );
+ compileClasspath.addPath( classpath );
}
}
@@ -194,7 +195,7 @@
// Does not take the classpath from the env....
// Am i missing something about the Java task??
args[ j++ ] = "-classpath";
- args[ j++ ] = compileClasspath.toString();
+ args[ j++ ] = PathUtil.formatPath( compileClasspath );
this.scanDir( files );
getContext().info( "Compiling " + filesToDo.size() + " JSP files" );
1.4 +3 -14
jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/metamata/AbstractMetamataTask.java
Index: AbstractMetamataTask.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/metamata/AbstractMetamataTask.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AbstractMetamataTask.java 18 Mar 2002 11:49:47 -0000 1.3
+++ AbstractMetamataTask.java 19 Mar 2002 02:44:37 -0000 1.4
@@ -15,10 +15,8 @@
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Random;
-import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.todo.types.Argument;
import org.apache.tools.todo.types.Commandline;
@@ -43,7 +41,7 @@
* command line. The classpath must includes both the <tt>.class</tt> and
* the <tt>.java</tt> files for accurate audit.
*/
- private Path m_classPath;
+ private Path m_classPath = new Path();
/**
* the path to the source file
@@ -142,13 +140,9 @@
/**
* user classpath
*/
- public Path createClasspath()
+ public void addClasspath( final Path path )
{
- if( m_classPath == null )
- {
- m_classPath = new Path();
- }
- return m_classPath;
+ m_classPath.addPath( path );
}
/**
@@ -362,11 +356,6 @@
protected Path getClassPath()
{
return m_classPath;
- }
-
- protected void setClassPath( Path classPath )
- {
- m_classPath = classPath;
}
protected Path getSourcePath()
1.2 +15 -9
jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/metamata/MAudit.java
Index: MAudit.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/metamata/MAudit.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MAudit.java 17 Mar 2002 09:56:55 -0000 1.1
+++ MAudit.java 19 Mar 2002 02:44:37 -0000 1.2
@@ -10,9 +10,8 @@
import java.io.File;
import java.util.ArrayList;
import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.todo.types.Path;
+import org.apache.tools.todo.types.PathUtil;
/**
* Metamata Audit evaluates Java code for programming errors, weaknesses, and
@@ -119,22 +118,29 @@
throws TaskException
{
ArrayList options = new ArrayList( 512 );
+
+ final Path classpath = new Path();
+
// there is a bug in Metamata 2.0 build 37. The sourcepath argument
does
// not work. So we will use the sourcepath prepended to classpath.
(order
// is important since Metamata looks at .class and .java)
- if( getSourcePath() != null )
+ final Path sourcePath = getSourcePath();
+ if( sourcePath != null )
{
- getSourcePath().append( getClassPath() );// srcpath is prepended
- setClassPath( getSourcePath() );
+ classpath.addPath( sourcePath );
setSourcePath( null );// prevent from using -sourcepath
}
// don't forget to modify the pattern if you change the options
reporting
- if( getClassPath() != null )
+ classpath.addPath( getClassPath() );
+
+ final String formattedClasspath = PathUtil.formatPath( classpath );
+ if( formattedClasspath.length() > 0 )
{
options.add( "-classpath" );
- options.add( getClassPath().toString() );
+ options.add( formattedClasspath );
}
+
// suppress copyright msg when running, we will let it so that this
// will be the only output to the console if in xml mode
// options.add("-quiet");
@@ -154,13 +160,13 @@
if( getSourcePath() != null )
{
options.add( "-sourcepath" );
- options.add( getSourcePath().toString() );
+ options.add( PathUtil.formatPath( getSourcePath() ) );
}
if( m_unused )
{
options.add( "-unused" );
- options.add( m_searchPath.toString() );
+ options.add( PathUtil.formatPath( m_searchPath ) );
}
addAllArrayList( options, getIncludedFiles().keySet().iterator() );
return options;
1.2 +11 -4
jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/metamata/MMetrics.java
Index: MMetrics.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/metamata/MMetrics.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MMetrics.java 17 Mar 2002 09:56:55 -0000 1.1
+++ MMetrics.java 19 Mar 2002 02:44:37 -0000 1.2
@@ -15,6 +15,7 @@
import org.apache.myrmidon.api.TaskException;
import org.apache.tools.todo.taskdefs.exec.ExecuteStreamHandler;
import org.apache.tools.todo.types.Path;
+import org.apache.tools.todo.types.PathUtil;
/**
* Calculates global complexity and quality metrics on Java source code. You
@@ -120,22 +121,28 @@
throws TaskException
{
ArrayList options = new ArrayList( 512 );
+
+ final Path classpath = new Path();
+
// there is a bug in Metamata 2.0 build 37. The sourcepath argument
does
// not work. So we will use the sourcepath prepended to classpath.
(order
// is important since Metamata looks at .class and .java)
if( getSourcePath() != null )
{
- getSourcePath().append( getClassPath() );// srcpath is prepended
- setClassPath( getSourcePath() );
+ classpath.addPath( getSourcePath() );
setSourcePath( null );// prevent from using -sourcepath
}
// don't forget to modify the pattern if you change the options
reporting
- if( getClassPath() != null )
+ classpath.addPath( getClassPath() );
+
+ final String formattedClasspath = PathUtil.formatPath( classpath );
+ if( formattedClasspath.length() > 0 )
{
options.add( "-classpath" );
- options.add( getClassPath() );
+ options.add( formattedClasspath );
}
+
options.add( "-output" );
options.add( tmpFile.toString() );
1.4 +4 -5
jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/metamata/MParse.java
Index: MParse.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/metamata/MParse.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- MParse.java 18 Mar 2002 11:49:47 -0000 1.3
+++ MParse.java 19 Mar 2002 02:44:37 -0000 1.4
@@ -13,16 +13,15 @@
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Random;
-import org.apache.aut.nativelib.ExecManager;
import org.apache.avalon.excalibur.io.IOUtil;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.todo.types.Argument;
import org.apache.tools.todo.types.Commandline;
import org.apache.tools.todo.types.CommandlineJava;
import org.apache.tools.todo.types.Path;
+import org.apache.tools.todo.types.PathUtil;
/**
* Simple Metamata MParse task based on the original written by <a
@@ -240,7 +239,7 @@
*
* @return The Options value
*/
- protected String[] getOptions()
+ protected String[] getOptions() throws TaskException
{
ArrayList options = new ArrayList();
if( m_verbose )
@@ -258,12 +257,12 @@
if( m_classpath != null )
{
options.add( "-classpath" );
- options.add( m_classpath.toString() );
+ options.add( PathUtil.formatPath( m_classpath ) );
}
if( m_sourcepath != null )
{
options.add( "-sourcepath" );
- options.add( m_sourcepath.toString() );
+ options.add( PathUtil.formatPath( m_sourcepath ) );
}
options.add( m_target.getAbsolutePath() );
1.2 +4 -4
jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/rmic/DefaultRmicAdapter.java
Index: DefaultRmicAdapter.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/rmic/DefaultRmicAdapter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultRmicAdapter.java 17 Mar 2002 09:42:23 -0000 1.1
+++ DefaultRmicAdapter.java 19 Mar 2002 02:44:37 -0000 1.2
@@ -15,7 +15,7 @@
import org.apache.myrmidon.framework.FileNameMapper;
import org.apache.tools.todo.types.Commandline;
import org.apache.tools.todo.types.Path;
-import org.apache.tools.todo.util.FileUtils;
+import org.apache.tools.todo.types.PathUtil;
/**
* This is the default implementation for the RmicAdapter interface.
Currently,
@@ -120,11 +120,11 @@
if( attributes.getExtdirs() != null )
{
cmd.addArgument( "-extdirs" );
- cmd.addArguments( FileUtils.translateCommandline(
attributes.getExtdirs() ) );
+ cmd.addArgument( PathUtil.formatPath( attributes.getExtdirs() )
);
}
cmd.addArgument( "-classpath" );
- cmd.addArguments( FileUtils.translateCommandline( classpath ) );
+ cmd.addArgument( PathUtil.formatPath( classpath ) );
String stubVersion = attributes.getStubVersion();
if( null != stubVersion )
@@ -195,7 +195,7 @@
// add the classpath
if( attributes.getClasspath() != null )
{
- classpath.addExisting( attributes.getClasspath() );
+ classpath.addPath( attributes.getClasspath() );
}
return classpath;
1.4 +3 -4
jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/sitraka/Coverage.java
Index: Coverage.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/sitraka/Coverage.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Coverage.java 18 Mar 2002 11:49:47 -0000 1.3
+++ Coverage.java 19 Mar 2002 02:44:37 -0000 1.4
@@ -13,16 +13,15 @@
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
-import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.todo.types.Argument;
import org.apache.tools.todo.types.Commandline;
import org.apache.tools.todo.types.CommandlineJava;
import org.apache.tools.todo.types.FileSet;
import org.apache.tools.todo.types.Path;
+import org.apache.tools.todo.types.PathUtil;
/**
* Convenient task to run Sitraka JProbe Coverage from Ant. Options are
pretty
@@ -313,9 +312,9 @@
}
// classpath
Path classpath = cmdlJava.getClasspath();
- if( classpath != null && classpath.size() > 0 )
+ if( classpath != null && ! classpath.isEmpty() )
{
- params.add( "-classpath " + classpath.toString() );
+ params.add( "-classpath " + PathUtil.formatPath( classpath ) );
}
// classname (runner or standalone)
if( cmdlJava.getClassname() != null )
1.3 +14 -20
jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/vss/MSVSSCHECKIN.java
Index: MSVSSCHECKIN.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/vss/MSVSSCHECKIN.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MSVSSCHECKIN.java 18 Mar 2002 08:53:31 -0000 1.2
+++ MSVSSCHECKIN.java 19 Mar 2002 02:44:37 -0000 1.3
@@ -10,7 +10,6 @@
import java.io.File;
import org.apache.myrmidon.api.TaskException;
import org.apache.tools.todo.types.Commandline;
-import org.apache.tools.todo.types.Path;
/**
* Task to perform CheckIn commands to Microsoft Visual Source Safe.
@@ -20,7 +19,7 @@
public class MSVSSCHECKIN
extends MSVSS
{
- private String m_localPath;
+ private File m_localPath;
private boolean m_recursive;
private boolean m_writable;
private String m_autoResponse;
@@ -67,9 +66,9 @@
/**
* Set the local path.
*/
- public void setLocalpath( final Path localPath )
+ public void setLocalpath( final File localPath )
{
- m_localPath = localPath.toString();
+ m_localPath = localPath;
}
/**
@@ -117,27 +116,22 @@
{
return;
}
- else
+
+ // make sure m_LocalDir exists, create it if it doesn't
+ if( !m_localPath.exists() )
{
- // make sure m_LocalDir exists, create it if it doesn't
- final File dir = getContext().resolveFile( m_localPath );
- if( !dir.exists() )
+ if( !m_localPath.mkdirs() )
{
- final boolean done = dir.mkdirs();
- if( !done )
- {
- final String message =
- "Directory " + m_localPath + " creation was not " +
- "succesful for an unknown reason";
- throw new TaskException( message );
- }
-
- final String message = "Created dir: " +
dir.getAbsolutePath();
- getContext().info( message );
+ final String message =
+ "Directory " + m_localPath + " creation was not " +
+ "succesful for an unknown reason";
+ throw new TaskException( message );
}
- cmd.addArgument( FLAG_OVERRIDE_WORKING_DIR + m_localPath );
+ final String message = "Created dir: " +
m_localPath.getAbsolutePath();
+ getContext().info( message );
}
+ cmd.addArgument( FLAG_OVERRIDE_WORKING_DIR + m_localPath );
}
private void getRecursiveCommand( final Commandline cmd )
1.3 +13 -22
jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/vss/MSVSSCHECKOUT.java
Index: MSVSSCHECKOUT.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/vss/MSVSSCHECKOUT.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MSVSSCHECKOUT.java 18 Mar 2002 08:53:31 -0000 1.2
+++ MSVSSCHECKOUT.java 19 Mar 2002 02:44:37 -0000 1.3
@@ -10,7 +10,6 @@
import java.io.File;
import org.apache.myrmidon.api.TaskException;
import org.apache.tools.todo.types.Commandline;
-import org.apache.tools.todo.types.Path;
/**
* Task to perform CheckOut commands to Microsoft Visual Source Safe.
@@ -20,7 +19,7 @@
public class MSVSSCHECKOUT
extends MSVSS
{
- private String m_localPath;
+ private File m_localPath;
private boolean m_recursive;
private String m_version;
private String m_date;
@@ -82,9 +81,9 @@
/**
* Set the local path.
*/
- public void setLocalpath( final Path localPath )
+ public void setLocalpath( final File localPath )
{
- m_localPath = localPath.toString();
+ m_localPath = localPath;
}
/**
@@ -148,32 +147,24 @@
public void getLocalpathCommand( final Commandline cmd )
throws TaskException
{
+ // make sure m_LocalDir exists, create it if it doesn't
if( m_localPath == null )
{
return;
}
- else
+ if( !m_localPath.exists() )
{
- // make sure m_LocalDir exists, create it if it doesn't
- final File dir = getContext().resolveFile( m_localPath );
- if( !dir.exists() )
+ if( !m_localPath.mkdirs() )
{
- if( !dir.mkdirs() )
- {
- final String message =
- "Directory " + m_localPath + " creation was not " +
- "succesful for an unknown reason";
- throw new TaskException( message );
- }
- else
- {
- final String message = "Created dir: " +
dir.getAbsolutePath();
- getContext().info( message );
- }
+ final String message =
+ "Directory " + m_localPath + " creation was not " +
+ "succesful for an unknown reason";
+ throw new TaskException( message );
}
-
- cmd.addArgument( FLAG_OVERRIDE_WORKING_DIR + m_localPath );
+ final String message = "Created dir: " +
m_localPath.getAbsolutePath();
+ getContext().info( message );
}
+ cmd.addArgument( FLAG_OVERRIDE_WORKING_DIR + m_localPath );
}
private void getRecursiveCommand( final Commandline cmd )
1.3 +6 -7
jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/vss/MSVSSGET.java
Index: MSVSSGET.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/vss/MSVSSGET.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MSVSSGET.java 18 Mar 2002 08:53:31 -0000 1.2
+++ MSVSSGET.java 19 Mar 2002 02:44:37 -0000 1.3
@@ -206,7 +206,7 @@
public class MSVSSGET extends MSVSS
{
- private String m_LocalPath = null;
+ private File m_LocalPath = null;
private boolean m_Recursive = false;
private boolean m_Writable = false;
private String m_Version = null;
@@ -296,9 +296,9 @@
*
* @param localPath The new Localpath value
*/
- public void setLocalpath( Path localPath )
+ public void setLocalpath( final File localPath )
{
- m_LocalPath = localPath.toString();
+ m_LocalPath = localPath;
}
/**
@@ -379,17 +379,16 @@
else
{
// make sure m_LocalDir exists, create it if it doesn't
- File dir = getContext().resolveFile( m_LocalPath );
- if( !dir.exists() )
+ if( !m_LocalPath.exists() )
{
- boolean done = dir.mkdirs();
+ boolean done = m_LocalPath.mkdirs();
if( done == false )
{
String msg = "Directory " + m_LocalPath + " creation was
not " +
"successful for an unknown reason";
throw new TaskException( msg );
}
- getContext().info( "Created dir: " + dir.getAbsolutePath() );
+ getContext().info( "Created dir: " +
m_LocalPath.getAbsolutePath() );
}
cmd.addArgument( FLAG_OVERRIDE_WORKING_DIR + m_LocalPath );
1.2 +2 -2
jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/types/Argument.java
Index: Argument.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/types/Argument.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Argument.java 17 Mar 2002 09:42:24 -0000 1.1
+++ Argument.java 19 Mar 2002 02:44:37 -0000 1.2
@@ -60,9 +60,9 @@
*
* @param value a single commandline argument.
*/
- public void setPath( final Path value )
+ public void setPath( final Path value ) throws TaskException
{
- m_parts = new String[]{value.toString()};
+ m_parts = new String[]{ PathUtil.formatPath( value ) };
}
/**
1.2 +3 -3
jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/types/CommandlineJava.java
Index: CommandlineJava.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/types/CommandlineJava.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CommandlineJava.java 17 Mar 2002 09:42:24 -0000 1.1
+++ CommandlineJava.java 19 Mar 2002 02:44:37 -0000 1.2
@@ -134,10 +134,10 @@
pos += m_sysProperties.size();
}
// classpath is a vm option too..
- if( m_classpath != null && m_classpath.toString().trim().length() >
0 )
+ if( m_classpath != null && ! m_classpath.isEmpty() )
{
result[ pos++ ] = "-classpath";
- result[ pos++ ] = m_classpath.toString();
+ result[ pos++ ] = PathUtil.formatPath( m_classpath );
}
// this is the classname to run as well as its arguments.
// in case of 'executeJar', the executable is a jar file.
@@ -226,7 +226,7 @@
{
int size = getActualVMCommand().size() + m_javaCommand.size() +
m_sysProperties.size();
// classpath is "-classpath <classpath>" -> 2 args
- if( m_classpath != null && m_classpath.toString().trim().length() >
0 )
+ if( m_classpath != null && ! m_classpath.isEmpty() )
{
size += 2;
}
1.2 +3 -2
jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/types/EnvironmentVariable.java
Index: EnvironmentVariable.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/types/EnvironmentVariable.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- EnvironmentVariable.java 17 Mar 2002 09:42:24 -0000 1.1
+++ EnvironmentVariable.java 19 Mar 2002 02:44:37 -0000 1.2
@@ -8,6 +8,7 @@
package org.apache.tools.todo.types;
import java.io.File;
+import org.apache.myrmidon.api.TaskException;
public class EnvironmentVariable
{
@@ -24,9 +25,9 @@
m_key = key;
}
- public void setPath( final Path path )
+ public void setPath( final Path path ) throws TaskException
{
- m_value = path.toString();
+ m_value = PathUtil.formatPath( path );
}
public void setValue( final String value )
1.2 +24 -80
jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/types/Path.java
Index: Path.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/types/Path.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Path.java 17 Mar 2002 09:42:24 -0000 1.1
+++ Path.java 19 Mar 2002 02:44:37 -0000 1.2
@@ -49,18 +49,12 @@
public class Path
implements DataType
{
- private ArrayList m_elements = new ArrayList();
+ private final ArrayList m_elements = new ArrayList();
private File m_baseDirectory;
- /**
- * Invoked by IntrospectionHelper for <code>setXXX(Path p)</code>
attribute
- * setters.
- */
public Path( final String path )
{
- final PathElement pathElement = new PathElement();
- m_elements.add( pathElement );
- pathElement.setPath( path );
+ addPath( path );
}
public Path()
@@ -87,6 +81,14 @@
}
/**
+ * Adds an element to the path.
+ */
+ public void setLocation( final File location )
+ {
+ addLocation( location );
+ }
+
+ /**
* Adds a element definition to the path.
*
* @param location the location of the element to add (must not be
<code>null</code>
@@ -100,53 +102,29 @@
}
/**
- * Adds the components on the given path which exist to this Path.
- * Components that don't exist, aren't added.
- *
- * @param source - source path whose components are examined for
existence
+ * Adds a nested <code><fileset></code> element.
*/
- public void addExisting( final Path source )
- throws TaskException
+ public void addFileset( final FileSet fileSet )
{
- final String[] list = source.list();
- for( int i = 0; i < list.length; i++ )
- {
- final File file = new File( list[ i ] );
- if( file.exists() )
- {
- addLocation( file );
- }
- }
+ m_elements.add( fileSet );
}
/**
- * Adds a nested <code><fileset></code> element.
+ * Adds a path.
*/
- public void addFileset( final FileSet fileSet )
+ public void setPath( final String path )
{
- m_elements.add( fileSet );
+ addPath( path );
}
/**
- * Append the contents of the other Path instance to this.
+ * Adds a path.
*/
- public void append( final Path other )
- throws TaskException
+ public void addPath( final String path )
{
- if( null == other )
- {
- throw new NullPointerException( "other" );
- }
-
- final String[] list = other.list();
- for( int i = 0; i < list.length; i++ )
- {
- final String file = list[ i ];
- if( m_elements.contains( file ) )
- {
- m_elements.add( file );
- }
- }
+ final PathElement pathElement = new PathElement();
+ m_elements.add( pathElement );
+ pathElement.setPath( path );
}
/**
@@ -213,45 +191,11 @@
}
/**
- * How many parts does this Path instance consist of.
+ * Determines if this path is empty.
*/
- public int size()
+ public boolean isEmpty()
throws TaskException
{
- return list().length;
- }
-
- /**
- * Returns a textual representation of the path, which can be used as
- * CLASSPATH or PATH environment variable definition.
- *
- * @return a textual representation of the path.
- */
- public String toString()
- {
- try
- {
- final String[] list = list();
-
- // empty path return empty string
- if( list.length == 0 )
- {
- return "";
- }
-
- // path containing one or more elements
- final StringBuffer result = new StringBuffer( list[ 0
].toString() );
- for( int i = 1; i < list.length; i++ )
- {
- result.append( File.pathSeparatorChar );
- result.append( list[ i ] );
- }
-
- return result.toString();
- }
- catch( final TaskException te )
- {
- throw new Error( te.toString() );
- }
+ return ( list().length == 0 );
}
}
1.2 +1 -1
jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/types/PathElement.java
Index: PathElement.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/types/PathElement.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PathElement.java 17 Mar 2002 09:42:24 -0000 1.1
+++ PathElement.java 19 Mar 2002 02:44:37 -0000 1.2
@@ -24,7 +24,7 @@
m_location = location.getAbsolutePath();
}
- public void setPath( String path )
+ public void setPath( final String path )
{
m_path = path;
}
1.2 +37 -7
jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/types/PathUtil.java
Index: PathUtil.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/types/PathUtil.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PathUtil.java 17 Mar 2002 09:42:24 -0000 1.1
+++ PathUtil.java 19 Mar 2002 02:44:37 -0000 1.2
@@ -19,11 +19,36 @@
* Utilities for operating on Path objects.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
- * @version $Revision: 1.1 $ $Date: 2002/03/17 09:42:24 $
+ * @version $Revision: 1.2 $ $Date: 2002/03/19 02:44:37 $
*/
public class PathUtil
{
/**
+ * Formats a Path into its native representation.
+ */
+ public static String formatPath( final Path path )
+ throws TaskException
+ {
+ final String[] list = path.list();
+
+ // empty path return empty string
+ if( list.length == 0 )
+ {
+ return "";
+ }
+
+ // path containing one or more elements
+ final StringBuffer result = new StringBuffer( list[ 0 ].toString() );
+ for( int i = 1; i < list.length; i++ )
+ {
+ result.append( File.pathSeparatorChar );
+ result.append( list[ i ] );
+ }
+
+ return result.toString();
+ }
+
+ /**
* Returns an array of URLs - useful for building a ClassLoader.
*/
public static URL[] toURLs( final Path path )
@@ -45,11 +70,13 @@
}
catch( final IOException ioe )
{
- final String message = "Malformed path entry. Reason:" + ioe;
- throw new TaskException( message, ioe );
+ throw new TaskException( "Malformed path entry.", ioe );
}
}
+ /**
+ * Adds the JVM's runtime to a path.
+ */
public static void addJavaRuntime( final Path path )
throws TaskException
{
@@ -76,26 +103,29 @@
// JDK > 1.1 seems to set java.home to the JRE directory.
final String rt = System.getProperty( "java.home" ) +
File.separator + "lib" + File.separator + "rt.jar";
- path.addExisting( new Path( rt ) );
+ path.addLocation( new File( rt ) );
// Just keep the old version as well and let addExisting
// sort it out.
final String rt2 = System.getProperty( "java.home" ) +
File.separator + "jre" + File.separator + "lib" +
File.separator + "rt.jar";
- path.addExisting( new Path( rt2 ) );
+ path.addLocation( new File( rt2 ) );
// Added for MacOS X
final String classes = System.getProperty( "java.home" ) +
File.separator + ".." + File.separator + "Classes" +
File.separator + "classes.jar";
- path.addExisting( new Path( classes ) );
+ path.addLocation( new File( classes ) );
final String ui = System.getProperty( "java.home" ) +
File.separator + ".." + File.separator + "Classes" +
File.separator + "ui.jar";
- path.addExisting( new Path( ui ) );
+ path.addLocation( new File( ui ) );
}
}
+ /**
+ * Adds the contents of a set of directories to a path.
+ */
public static void addExtdirs( final Path toPath, final Path extDirs )
throws TaskException
{
1.2 +5 -9
jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/types/converters/StringToPathConverter.java
Index: StringToPathConverter.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/types/converters/StringToPathConverter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- StringToPathConverter.java 17 Mar 2002 09:42:24 -0000 1.1
+++ StringToPathConverter.java 19 Mar 2002 02:44:37 -0000 1.2
@@ -14,7 +14,10 @@
/**
* A converter from String to Path.
*
- * @author Adam Murdoch
+ * @author <a href="mailto:[EMAIL PROTECTED]">Adam Murdoch</a>
+ * @version $Revision: 1.2 $ $Date: 2002/03/19 02:44:37 $
+ *
+ * @ant:converter source="java.lang.String"
destination="org.apache.tools.todo.types.Path"
*/
public class StringToPathConverter
extends AbstractConverter
@@ -33,20 +36,13 @@
* @param original the original Object
* @param context the context in which to convert
* @return the converted object
- * @exception java.lang.Exception if an error occurs
*/
- protected Object convert( Object original, Object context )
+ protected Object convert( final Object original, final Object context )
throws ConverterException
{
- /*
String path = (String)original;
- TaskContext taskContext = (TaskContext)context;
-
Path retval = new Path( path );
- retval.setBaseDirectory( taskContext.getBaseDirectory() );
return retval;
- */
- return null;
}
}
1.4 +2 -10
jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/util/FileUtils.java
Index: FileUtils.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/todo/org/apache/tools/todo/util/FileUtils.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FileUtils.java 18 Mar 2002 08:53:31 -0000 1.3
+++ FileUtils.java 19 Mar 2002 02:44:38 -0000 1.4
@@ -13,8 +13,6 @@
import java.util.StringTokenizer;
import org.apache.avalon.excalibur.io.FileUtil;
import org.apache.myrmidon.api.TaskException;
-import org.apache.tools.todo.types.Path;
-import org.apache.tools.todo.util.PathTokenizer;
/**
* This class also encapsulates methods which allow Files to be refered to
using
@@ -24,7 +22,7 @@
* @author [EMAIL PROTECTED]
* @author Conor MacNeill
* @author <a href="mailto:[EMAIL PROTECTED]">Stefan Bodewig</a>
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
*/
public class FileUtils
{
@@ -242,13 +240,7 @@
}
}
- public static String[] translateCommandline( Path to_process )
- throws TaskException
- {
- return translateCommandline( to_process.toString() );
- }
-
- public static String[] translateCommandline( String to_process )
+ public static String[] translateCommandline( final String to_process )
throws TaskException
{
if( to_process == null || to_process.length() == 0 )
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>