Browse Source

Removed Project.translatePath and replaced it by allowing Files or Path objects be passed in.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270441 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 24 years ago
parent
commit
e063898390
12 changed files with 36 additions and 104 deletions
  1. +0
    -36
      proposal/myrmidon/src/main/org/apache/tools/ant/Project.java
  2. +3
    -2
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java
  3. +3
    -3
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java
  4. +3
    -3
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DDCreator.java
  5. +6
    -6
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java
  6. +3
    -2
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java
  7. +0
    -36
      proposal/myrmidon/src/todo/org/apache/tools/ant/Project.java
  8. +3
    -2
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java
  9. +3
    -3
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java
  10. +3
    -3
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/DDCreator.java
  11. +6
    -6
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java
  12. +3
    -2
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java

+ 0
- 36
proposal/myrmidon/src/main/org/apache/tools/ant/Project.java View File

@@ -138,42 +138,6 @@ public class Project
s.equalsIgnoreCase( "yes" ) ); s.equalsIgnoreCase( "yes" ) );
} }


/**
* Translate a path into its native (platform specific) format. <p>
*
* This method uses the PathTokenizer class to separate the input path into
* its components. This handles DOS style paths in a relatively sensible
* way. The file separators are then converted to their platform specific
* versions.
*
* @param to_process the path to be converted
* @return the native version of to_process or an empty string if to_process
* is null or empty
*/
public static String translatePath( String to_process )
{
if( to_process == null || to_process.length() == 0 )
{
return "";
}

StringBuffer path = new StringBuffer( to_process.length() + 50 );
PathTokenizer tokenizer = new PathTokenizer( to_process );
while( tokenizer.hasMoreTokens() )
{
String pathComponent = tokenizer.nextToken();
pathComponent = pathComponent.replace( '/', File.separatorChar );
pathComponent = pathComponent.replace( '\\', File.separatorChar );
if( path.length() != 0 )
{
path.append( File.pathSeparatorChar );
}
path.append( pathComponent );
}

return path.toString();
}

/** /**
* set the ant.java.version property, also tests for unsupported JVM * set the ant.java.version property, also tests for unsupported JVM
* versions, prints the verbose log messages * versions, prints the verbose log messages


+ 3
- 2
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java View File

@@ -8,6 +8,7 @@
package org.apache.tools.ant.taskdefs.optional.ccm; package org.apache.tools.ant.taskdefs.optional.ccm;


import java.io.IOException; import java.io.IOException;
import java.io.File;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
@@ -65,9 +66,9 @@ public abstract class Continuus
* *
* @param dir the directory containing the ccm executable * @param dir the directory containing the ccm executable
*/ */
public final void setCcmDir( String dir )
public final void setCcmDir( final File dir )
{ {
m_ccmDir = getProject().translatePath( dir );
m_ccmDir = dir.toString();
} }


/** /**


+ 3
- 3
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java View File

@@ -7,9 +7,9 @@
*/ */
package org.apache.tools.ant.taskdefs.optional.clearcase; package org.apache.tools.ant.taskdefs.optional.clearcase;


import java.io.File;
import java.io.IOException; import java.io.IOException;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.exec.Execute; import org.apache.tools.ant.taskdefs.exec.Execute;
import org.apache.tools.ant.taskdefs.exec.LogOutputStream; import org.apache.tools.ant.taskdefs.exec.LogOutputStream;
@@ -60,9 +60,9 @@ public abstract class ClearCase extends Task
* *
* @param dir the directory containing the cleartool executable * @param dir the directory containing the cleartool executable
*/ */
public final void setClearToolDir( String dir )
public final void setClearToolDir( final File dir )
{ {
m_ClearToolDir = getProject().translatePath( dir );
m_ClearToolDir = dir.toString();
} }


/** /**


+ 3
- 3
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DDCreator.java View File

@@ -51,9 +51,9 @@ public class DDCreator extends MatchingTask
* *
* @param s the classpath to use for the ddcreator tool. * @param s the classpath to use for the ddcreator tool.
*/ */
public void setClasspath( String s )
public void setClasspath( final Path p )
{ {
this.classpath = getProject().translatePath( s );
this.classpath = p.toString();
} }


/** /**
@@ -118,7 +118,7 @@ public class DDCreator extends MatchingTask
} }


String systemClassPath = System.getProperty( "java.class.path" ); String systemClassPath = System.getProperty( "java.class.path" );
String execClassPath = getProject().translatePath( systemClassPath + ":" + classpath );
String execClassPath = systemClassPath + File.separator + classpath;
Java ddCreatorTask = (Java)getProject().createTask( "java" ); Java ddCreatorTask = (Java)getProject().createTask( "java" );
ddCreatorTask.setFork( true ); ddCreatorTask.setFork( true );
ddCreatorTask.setClassname( "org.apache.tools.ant.taskdefs.optional.ejb.DDCreatorHelper" ); ddCreatorTask.setClassname( "org.apache.tools.ant.taskdefs.optional.ejb.DDCreatorHelper" );


+ 6
- 6
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java View File

@@ -62,9 +62,9 @@ public class Ejbc extends MatchingTask
* *
* @param s The new Classpath value * @param s The new Classpath value
*/ */
public void setClasspath( String s )
public void setClasspath( final Path s )
{ {
this.classpath = getProject().translatePath( s );
this.classpath = s.toString();
} }


/** /**
@@ -85,9 +85,9 @@ public class Ejbc extends MatchingTask
* *
* @param dirName the name of the directory into which code is generated * @param dirName the name of the directory into which code is generated
*/ */
public void setDest( String dirName )
public void setDest( final File dirName )
{ {
generatedFilesDirectory = new File( dirName );
generatedFilesDirectory = dirName;
} }


public void setKeepgenerated( String newKeepgenerated ) public void setKeepgenerated( String newKeepgenerated )
@@ -159,8 +159,8 @@ public class Ejbc extends MatchingTask
} }


String systemClassPath = System.getProperty( "java.class.path" ); String systemClassPath = System.getProperty( "java.class.path" );
String execClassPath = getProject().translatePath( systemClassPath + ":" + classpath +
":" + generatedFilesDirectory );
String execClassPath =
systemClassPath + File.separator + classpath + File.separator + generatedFilesDirectory;
// get all the files in the descriptor directory // get all the files in the descriptor directory
DirectoryScanner ds = super.getDirectoryScanner( descriptorDirectory ); DirectoryScanner ds = super.getDirectoryScanner( descriptorDirectory );




+ 3
- 2
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java View File

@@ -8,6 +8,7 @@
package org.apache.tools.ant.taskdefs.optional.vss; package org.apache.tools.ant.taskdefs.optional.vss;


import java.io.IOException; import java.io.IOException;
import java.io.File;
import java.util.Properties; import java.util.Properties;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
@@ -134,9 +135,9 @@ public abstract class MSVSS extends Task
* *
* @param dir the directory containing ss.exe * @param dir the directory containing ss.exe
*/ */
public final void setSsdir( String dir )
public final void setSsdir( final File dir )
{ {
m_SSDir = getProject().translatePath( dir );
m_SSDir = dir.toString();
} }


/** /**


+ 0
- 36
proposal/myrmidon/src/todo/org/apache/tools/ant/Project.java View File

@@ -138,42 +138,6 @@ public class Project
s.equalsIgnoreCase( "yes" ) ); s.equalsIgnoreCase( "yes" ) );
} }


/**
* Translate a path into its native (platform specific) format. <p>
*
* This method uses the PathTokenizer class to separate the input path into
* its components. This handles DOS style paths in a relatively sensible
* way. The file separators are then converted to their platform specific
* versions.
*
* @param to_process the path to be converted
* @return the native version of to_process or an empty string if to_process
* is null or empty
*/
public static String translatePath( String to_process )
{
if( to_process == null || to_process.length() == 0 )
{
return "";
}

StringBuffer path = new StringBuffer( to_process.length() + 50 );
PathTokenizer tokenizer = new PathTokenizer( to_process );
while( tokenizer.hasMoreTokens() )
{
String pathComponent = tokenizer.nextToken();
pathComponent = pathComponent.replace( '/', File.separatorChar );
pathComponent = pathComponent.replace( '\\', File.separatorChar );
if( path.length() != 0 )
{
path.append( File.pathSeparatorChar );
}
path.append( pathComponent );
}

return path.toString();
}

/** /**
* set the ant.java.version property, also tests for unsupported JVM * set the ant.java.version property, also tests for unsupported JVM
* versions, prints the verbose log messages * versions, prints the verbose log messages


+ 3
- 2
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java View File

@@ -8,6 +8,7 @@
package org.apache.tools.ant.taskdefs.optional.ccm; package org.apache.tools.ant.taskdefs.optional.ccm;


import java.io.IOException; import java.io.IOException;
import java.io.File;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
@@ -65,9 +66,9 @@ public abstract class Continuus
* *
* @param dir the directory containing the ccm executable * @param dir the directory containing the ccm executable
*/ */
public final void setCcmDir( String dir )
public final void setCcmDir( final File dir )
{ {
m_ccmDir = getProject().translatePath( dir );
m_ccmDir = dir.toString();
} }


/** /**


+ 3
- 3
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java View File

@@ -7,9 +7,9 @@
*/ */
package org.apache.tools.ant.taskdefs.optional.clearcase; package org.apache.tools.ant.taskdefs.optional.clearcase;


import java.io.File;
import java.io.IOException; import java.io.IOException;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.exec.Execute; import org.apache.tools.ant.taskdefs.exec.Execute;
import org.apache.tools.ant.taskdefs.exec.LogOutputStream; import org.apache.tools.ant.taskdefs.exec.LogOutputStream;
@@ -60,9 +60,9 @@ public abstract class ClearCase extends Task
* *
* @param dir the directory containing the cleartool executable * @param dir the directory containing the cleartool executable
*/ */
public final void setClearToolDir( String dir )
public final void setClearToolDir( final File dir )
{ {
m_ClearToolDir = getProject().translatePath( dir );
m_ClearToolDir = dir.toString();
} }


/** /**


+ 3
- 3
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/DDCreator.java View File

@@ -51,9 +51,9 @@ public class DDCreator extends MatchingTask
* *
* @param s the classpath to use for the ddcreator tool. * @param s the classpath to use for the ddcreator tool.
*/ */
public void setClasspath( String s )
public void setClasspath( final Path p )
{ {
this.classpath = getProject().translatePath( s );
this.classpath = p.toString();
} }


/** /**
@@ -118,7 +118,7 @@ public class DDCreator extends MatchingTask
} }


String systemClassPath = System.getProperty( "java.class.path" ); String systemClassPath = System.getProperty( "java.class.path" );
String execClassPath = getProject().translatePath( systemClassPath + ":" + classpath );
String execClassPath = systemClassPath + File.separator + classpath;
Java ddCreatorTask = (Java)getProject().createTask( "java" ); Java ddCreatorTask = (Java)getProject().createTask( "java" );
ddCreatorTask.setFork( true ); ddCreatorTask.setFork( true );
ddCreatorTask.setClassname( "org.apache.tools.ant.taskdefs.optional.ejb.DDCreatorHelper" ); ddCreatorTask.setClassname( "org.apache.tools.ant.taskdefs.optional.ejb.DDCreatorHelper" );


+ 6
- 6
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java View File

@@ -62,9 +62,9 @@ public class Ejbc extends MatchingTask
* *
* @param s The new Classpath value * @param s The new Classpath value
*/ */
public void setClasspath( String s )
public void setClasspath( final Path s )
{ {
this.classpath = getProject().translatePath( s );
this.classpath = s.toString();
} }


/** /**
@@ -85,9 +85,9 @@ public class Ejbc extends MatchingTask
* *
* @param dirName the name of the directory into which code is generated * @param dirName the name of the directory into which code is generated
*/ */
public void setDest( String dirName )
public void setDest( final File dirName )
{ {
generatedFilesDirectory = new File( dirName );
generatedFilesDirectory = dirName;
} }


public void setKeepgenerated( String newKeepgenerated ) public void setKeepgenerated( String newKeepgenerated )
@@ -159,8 +159,8 @@ public class Ejbc extends MatchingTask
} }


String systemClassPath = System.getProperty( "java.class.path" ); String systemClassPath = System.getProperty( "java.class.path" );
String execClassPath = getProject().translatePath( systemClassPath + ":" + classpath +
":" + generatedFilesDirectory );
String execClassPath =
systemClassPath + File.separator + classpath + File.separator + generatedFilesDirectory;
// get all the files in the descriptor directory // get all the files in the descriptor directory
DirectoryScanner ds = super.getDirectoryScanner( descriptorDirectory ); DirectoryScanner ds = super.getDirectoryScanner( descriptorDirectory );




+ 3
- 2
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java View File

@@ -8,6 +8,7 @@
package org.apache.tools.ant.taskdefs.optional.vss; package org.apache.tools.ant.taskdefs.optional.vss;


import java.io.IOException; import java.io.IOException;
import java.io.File;
import java.util.Properties; import java.util.Properties;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
@@ -134,9 +135,9 @@ public abstract class MSVSS extends Task
* *
* @param dir the directory containing ss.exe * @param dir the directory containing ss.exe
*/ */
public final void setSsdir( String dir )
public final void setSsdir( final File dir )
{ {
m_SSDir = getProject().translatePath( dir );
m_SSDir = dir.toString();
} }


/** /**


Loading…
Cancel
Save