git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270441 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -138,42 +138,6 @@ public class Project | |||
| 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 | |||
| * versions, prints the verbose log messages | |||
| @@ -8,6 +8,7 @@ | |||
| package org.apache.tools.ant.taskdefs.optional.ccm; | |||
| import java.io.IOException; | |||
| import java.io.File; | |||
| import org.apache.myrmidon.api.TaskException; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.Task; | |||
| @@ -65,9 +66,9 @@ public abstract class Continuus | |||
| * | |||
| * @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(); | |||
| } | |||
| /** | |||
| @@ -7,9 +7,9 @@ | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional.clearcase; | |||
| import java.io.File; | |||
| import java.io.IOException; | |||
| import org.apache.myrmidon.api.TaskException; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.Task; | |||
| import org.apache.tools.ant.taskdefs.exec.Execute; | |||
| 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 | |||
| */ | |||
| public final void setClearToolDir( String dir ) | |||
| public final void setClearToolDir( final File dir ) | |||
| { | |||
| m_ClearToolDir = getProject().translatePath( dir ); | |||
| m_ClearToolDir = dir.toString(); | |||
| } | |||
| /** | |||
| @@ -51,9 +51,9 @@ public class DDCreator extends MatchingTask | |||
| * | |||
| * @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 execClassPath = getProject().translatePath( systemClassPath + ":" + classpath ); | |||
| String execClassPath = systemClassPath + File.separator + classpath; | |||
| Java ddCreatorTask = (Java)getProject().createTask( "java" ); | |||
| ddCreatorTask.setFork( true ); | |||
| ddCreatorTask.setClassname( "org.apache.tools.ant.taskdefs.optional.ejb.DDCreatorHelper" ); | |||
| @@ -62,9 +62,9 @@ public class Ejbc extends MatchingTask | |||
| * | |||
| * @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 | |||
| */ | |||
| public void setDest( String dirName ) | |||
| public void setDest( final File dirName ) | |||
| { | |||
| generatedFilesDirectory = new File( dirName ); | |||
| generatedFilesDirectory = dirName; | |||
| } | |||
| public void setKeepgenerated( String newKeepgenerated ) | |||
| @@ -159,8 +159,8 @@ public class Ejbc extends MatchingTask | |||
| } | |||
| 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 | |||
| DirectoryScanner ds = super.getDirectoryScanner( descriptorDirectory ); | |||
| @@ -8,6 +8,7 @@ | |||
| package org.apache.tools.ant.taskdefs.optional.vss; | |||
| import java.io.IOException; | |||
| import java.io.File; | |||
| import java.util.Properties; | |||
| import org.apache.myrmidon.api.TaskException; | |||
| import org.apache.tools.ant.Project; | |||
| @@ -134,9 +135,9 @@ public abstract class MSVSS extends Task | |||
| * | |||
| * @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(); | |||
| } | |||
| /** | |||
| @@ -138,42 +138,6 @@ public class Project | |||
| 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 | |||
| * versions, prints the verbose log messages | |||
| @@ -8,6 +8,7 @@ | |||
| package org.apache.tools.ant.taskdefs.optional.ccm; | |||
| import java.io.IOException; | |||
| import java.io.File; | |||
| import org.apache.myrmidon.api.TaskException; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.Task; | |||
| @@ -65,9 +66,9 @@ public abstract class Continuus | |||
| * | |||
| * @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(); | |||
| } | |||
| /** | |||
| @@ -7,9 +7,9 @@ | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional.clearcase; | |||
| import java.io.File; | |||
| import java.io.IOException; | |||
| import org.apache.myrmidon.api.TaskException; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.Task; | |||
| import org.apache.tools.ant.taskdefs.exec.Execute; | |||
| 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 | |||
| */ | |||
| public final void setClearToolDir( String dir ) | |||
| public final void setClearToolDir( final File dir ) | |||
| { | |||
| m_ClearToolDir = getProject().translatePath( dir ); | |||
| m_ClearToolDir = dir.toString(); | |||
| } | |||
| /** | |||
| @@ -51,9 +51,9 @@ public class DDCreator extends MatchingTask | |||
| * | |||
| * @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 execClassPath = getProject().translatePath( systemClassPath + ":" + classpath ); | |||
| String execClassPath = systemClassPath + File.separator + classpath; | |||
| Java ddCreatorTask = (Java)getProject().createTask( "java" ); | |||
| ddCreatorTask.setFork( true ); | |||
| ddCreatorTask.setClassname( "org.apache.tools.ant.taskdefs.optional.ejb.DDCreatorHelper" ); | |||
| @@ -62,9 +62,9 @@ public class Ejbc extends MatchingTask | |||
| * | |||
| * @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 | |||
| */ | |||
| public void setDest( String dirName ) | |||
| public void setDest( final File dirName ) | |||
| { | |||
| generatedFilesDirectory = new File( dirName ); | |||
| generatedFilesDirectory = dirName; | |||
| } | |||
| public void setKeepgenerated( String newKeepgenerated ) | |||
| @@ -159,8 +159,8 @@ public class Ejbc extends MatchingTask | |||
| } | |||
| 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 | |||
| DirectoryScanner ds = super.getDirectoryScanner( descriptorDirectory ); | |||
| @@ -8,6 +8,7 @@ | |||
| package org.apache.tools.ant.taskdefs.optional.vss; | |||
| import java.io.IOException; | |||
| import java.io.File; | |||
| import java.util.Properties; | |||
| import org.apache.myrmidon.api.TaskException; | |||
| import org.apache.tools.ant.Project; | |||
| @@ -134,9 +135,9 @@ public abstract class MSVSS extends Task | |||
| * | |||
| * @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(); | |||
| } | |||
| /** | |||