git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270797 13f79535-47bb-0310-9956-ffa450edef68master
@@ -15,6 +15,7 @@ import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.EnvironmentData; | |||
import org.apache.tools.ant.types.EnvironmentVariable; | |||
import org.apache.tools.ant.util.FileUtils; | |||
/** | |||
* Task to interact with a CVS repository. | |||
@@ -204,37 +205,37 @@ public class Cvs | |||
command.setExecutable( "cvs" ); | |||
if( m_cvsRoot != null ) | |||
{ | |||
command.createArgument().setValue( "-d" ); | |||
command.createArgument().setValue( m_cvsRoot ); | |||
command.addArgument( "-d" ); | |||
command.addArgument( m_cvsRoot ); | |||
} | |||
if( m_noexec ) | |||
{ | |||
command.createArgument().setValue( "-n" ); | |||
command.addArgument( "-n" ); | |||
} | |||
if( m_quiet ) | |||
{ | |||
command.createArgument().setValue( "-q" ); | |||
command.addArgument( "-q" ); | |||
} | |||
command.createArgument().setLine( m_command ); | |||
command.addArguments( FileUtils.translateCommandline( m_command ) ); | |||
if( null != m_date ) | |||
{ | |||
command.createArgument().setValue( "-D" ); | |||
command.createArgument().setValue( m_date ); | |||
command.addArgument( "-D" ); | |||
command.addArgument( m_date ); | |||
} | |||
if( null != m_tag ) | |||
{ | |||
command.createArgument().setValue( "-r" ); | |||
command.createArgument().setValue( m_tag ); | |||
command.addArgument( "-r" ); | |||
command.addArgument( m_tag ); | |||
} | |||
if( m_module != null ) | |||
{ | |||
command.createArgument().setLine( m_module ); | |||
command.addArguments( FileUtils.translateCommandline( m_module ) ); | |||
} | |||
return command; | |||
} | |||
@@ -98,9 +98,9 @@ public class Exec | |||
/** | |||
* Add a nested arg element - a command line argument. | |||
*/ | |||
public Argument createArg() | |||
public void addArg( final Argument argument ) | |||
{ | |||
return m_command.createArgument(); | |||
m_command.addArgument( argument ); | |||
} | |||
public void execute() | |||
@@ -11,8 +11,9 @@ import java.io.BufferedReader; | |||
import java.io.File; | |||
import java.io.FileInputStream; | |||
import java.io.FileOutputStream; | |||
import java.io.IOException; | |||
import java.io.InputStreamReader; | |||
import java.io.IOException; | |||
import java.io.InputStream; | |||
import java.security.DigestInputStream; | |||
import java.security.MessageDigest; | |||
import java.security.NoSuchAlgorithmException; | |||
@@ -20,9 +21,10 @@ import java.security.NoSuchProviderException; | |||
import java.util.ArrayList; | |||
import java.util.Enumeration; | |||
import java.util.Hashtable; | |||
import org.apache.avalon.excalibur.io.IOUtil; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.types.DirectoryScanner; | |||
import org.apache.tools.ant.taskdefs.condition.Condition; | |||
import org.apache.tools.ant.types.DirectoryScanner; | |||
import org.apache.tools.ant.types.FileSet; | |||
/** | |||
@@ -31,61 +33,73 @@ import org.apache.tools.ant.types.FileSet; | |||
* | |||
* @author <a href="mailto:umagesh@rediffmail.com">Magesh Umasankar</a> | |||
*/ | |||
public class Checksum extends MatchingTask implements Condition | |||
public class Checksum | |||
extends MatchingTask | |||
implements Condition | |||
{ | |||
/** | |||
* File for which checksum is to be calculated. | |||
*/ | |||
private File file = null; | |||
private File m_file; | |||
/** | |||
* MessageDigest algorithm to be used. | |||
*/ | |||
private String algorithm = "MD5"; | |||
private String m_algorithm = "MD5"; | |||
/** | |||
* MessageDigest Algorithm provider | |||
*/ | |||
private String provider = null; | |||
private String m_provider; | |||
/** | |||
* ArrayList to hold source file sets. | |||
*/ | |||
private ArrayList filesets = new ArrayList(); | |||
private ArrayList m_filesets = new ArrayList(); | |||
/** | |||
* Stores SourceFile, DestFile pairs and SourceFile, Property String pairs. | |||
*/ | |||
private Hashtable includeFileMap = new Hashtable(); | |||
private Hashtable m_includeFileMap = new Hashtable(); | |||
/** | |||
* File Extension that is be to used to create or identify destination file | |||
*/ | |||
private String fileext; | |||
private String m_fileext; | |||
/** | |||
* Create new destination file? Defaults to false. | |||
*/ | |||
private boolean forceOverwrite; | |||
private boolean m_forceOverwrite; | |||
/** | |||
* is this task being used as a nested condition element? | |||
*/ | |||
private boolean isCondition; | |||
private boolean m_isCondition; | |||
/** | |||
* Message Digest instance | |||
*/ | |||
private MessageDigest messageDigest; | |||
private MessageDigest m_messageDigest; | |||
/** | |||
* Holds generated checksum and gets set as a Project Property. | |||
*/ | |||
private String property; | |||
private String m_property; | |||
/** | |||
* Contains the result of a checksum verification. ("true" or "false") | |||
*/ | |||
private String verifyProperty; | |||
private String m_verifyProperty; | |||
/** | |||
* Sets the MessageDigest algorithm to be used to calculate the checksum. | |||
* | |||
* @param algorithm The new Algorithm value | |||
*/ | |||
public void setAlgorithm( String algorithm ) | |||
public void setAlgorithm( final String algorithm ) | |||
{ | |||
this.algorithm = algorithm; | |||
m_algorithm = algorithm; | |||
} | |||
/** | |||
@@ -93,9 +107,9 @@ public class Checksum extends MatchingTask implements Condition | |||
* | |||
* @param file The new File value | |||
*/ | |||
public void setFile( File file ) | |||
public void setFile( final File file ) | |||
{ | |||
this.file = file; | |||
m_file = file; | |||
} | |||
/** | |||
@@ -104,9 +118,9 @@ public class Checksum extends MatchingTask implements Condition | |||
* | |||
* @param fileext The new Fileext value | |||
*/ | |||
public void setFileext( String fileext ) | |||
public void setFileext( final String fileext ) | |||
{ | |||
this.fileext = fileext; | |||
m_fileext = fileext; | |||
} | |||
/** | |||
@@ -117,7 +131,7 @@ public class Checksum extends MatchingTask implements Condition | |||
*/ | |||
public void setForceOverwrite( boolean forceOverwrite ) | |||
{ | |||
this.forceOverwrite = forceOverwrite; | |||
this.m_forceOverwrite = forceOverwrite; | |||
} | |||
/** | |||
@@ -127,7 +141,7 @@ public class Checksum extends MatchingTask implements Condition | |||
*/ | |||
public void setProperty( String property ) | |||
{ | |||
this.property = property; | |||
this.m_property = property; | |||
} | |||
/** | |||
@@ -136,9 +150,9 @@ public class Checksum extends MatchingTask implements Condition | |||
* | |||
* @param provider The new Provider value | |||
*/ | |||
public void setProvider( String provider ) | |||
public void setProvider( final String provider ) | |||
{ | |||
this.provider = provider; | |||
m_provider = provider; | |||
} | |||
/** | |||
@@ -147,9 +161,9 @@ public class Checksum extends MatchingTask implements Condition | |||
* | |||
* @param verifyProperty The new Verifyproperty value | |||
*/ | |||
public void setVerifyproperty( String verifyProperty ) | |||
public void setVerifyproperty( final String verifyProperty ) | |||
{ | |||
this.verifyProperty = verifyProperty; | |||
m_verifyProperty = verifyProperty; | |||
} | |||
/** | |||
@@ -157,9 +171,9 @@ public class Checksum extends MatchingTask implements Condition | |||
* | |||
* @param set The feature to be added to the Fileset attribute | |||
*/ | |||
public void addFileset( FileSet set ) | |||
public void addFileset( final FileSet set ) | |||
{ | |||
filesets.add( set ); | |||
m_filesets.add( set ); | |||
} | |||
/** | |||
@@ -167,12 +181,11 @@ public class Checksum extends MatchingTask implements Condition | |||
* | |||
* @return Returns true if the checksum verification test passed, false | |||
* otherwise. | |||
* @exception TaskException Description of Exception | |||
*/ | |||
public boolean eval() | |||
throws TaskException | |||
{ | |||
isCondition = true; | |||
m_isCondition = true; | |||
return validateAndExecute(); | |||
} | |||
@@ -184,10 +197,10 @@ public class Checksum extends MatchingTask implements Condition | |||
public void execute() | |||
throws TaskException | |||
{ | |||
boolean value = validateAndExecute(); | |||
if( verifyProperty != null ) | |||
final boolean value = validateAndExecute(); | |||
if( m_verifyProperty != null ) | |||
{ | |||
setProperty( verifyProperty, new Boolean( value ).toString() ); | |||
setProperty( m_verifyProperty, new Boolean( value ).toString() ); | |||
} | |||
} | |||
@@ -197,36 +210,37 @@ public class Checksum extends MatchingTask implements Condition | |||
* @param file The feature to be added to the ToIncludeFileMap attribute | |||
* @exception TaskException Description of Exception | |||
*/ | |||
private void addToIncludeFileMap( File file ) | |||
private void addToIncludeFileMap( final File file ) | |||
throws TaskException | |||
{ | |||
if( file != null ) | |||
{ | |||
if( file.exists() ) | |||
{ | |||
if( property == null ) | |||
if( m_property == null ) | |||
{ | |||
File dest = new File( file.getParent(), file.getName() + fileext ); | |||
if( forceOverwrite || isCondition || | |||
final File dest = new File( file.getParent(), file.getName() + m_fileext ); | |||
if( m_forceOverwrite || m_isCondition || | |||
( file.lastModified() > dest.lastModified() ) ) | |||
{ | |||
includeFileMap.put( file, dest ); | |||
m_includeFileMap.put( file, dest ); | |||
} | |||
else | |||
{ | |||
getLogger().debug( file + " omitted as " + dest + " is up to date." ); | |||
final String message = file + " omitted as " + dest + | |||
" is up to date."; | |||
getLogger().debug( message ); | |||
} | |||
} | |||
else | |||
{ | |||
includeFileMap.put( file, property ); | |||
m_includeFileMap.put( file, m_property ); | |||
} | |||
} | |||
else | |||
{ | |||
String message = "Could not find file " | |||
+ file.getAbsolutePath() | |||
+ " to generate checksum for."; | |||
final String message = "Could not find file " + file.getAbsolutePath() + | |||
" to generate checksum for."; | |||
getLogger().info( message ); | |||
throw new TaskException( message ); | |||
} | |||
@@ -235,253 +249,266 @@ public class Checksum extends MatchingTask implements Condition | |||
/** | |||
* Generate checksum(s) using the message digest created earlier. | |||
* | |||
* @return Description of the Returned Value | |||
* @exception TaskException Description of Exception | |||
*/ | |||
private boolean generateChecksums() | |||
throws TaskException | |||
{ | |||
boolean checksumMatches = true; | |||
final Enumeration includes = m_includeFileMap.keys(); | |||
while( includes.hasMoreElements() ) | |||
{ | |||
final File src = (File)includes.nextElement(); | |||
if( !m_isCondition ) | |||
{ | |||
final String message = "Calculating " + m_algorithm + " checksum for " + src; | |||
getLogger().info( message ); | |||
} | |||
checksumMatches = z( src, checksumMatches ); | |||
} | |||
return checksumMatches; | |||
} | |||
private boolean z( final File src, boolean checksumMatches ) | |||
throws TaskException | |||
{ | |||
FileInputStream fis = null; | |||
FileOutputStream fos = null; | |||
try | |||
{ | |||
for( Enumeration e = includeFileMap.keys(); e.hasMoreElements(); ) | |||
fis = new FileInputStream( src ); | |||
final byte[] fileDigest = buildDigest( fis ); | |||
IOUtil.shutdownStream( fis ); | |||
String checksum = ""; | |||
for( int i = 0; i < fileDigest.length; i++ ) | |||
{ | |||
messageDigest.reset(); | |||
File src = (File)e.nextElement(); | |||
if( !isCondition ) | |||
final String hexStr = Integer.toHexString( 0x00ff & fileDigest[ i ] ); | |||
if( hexStr.length() < 2 ) | |||
{ | |||
getLogger().info( "Calculating " + algorithm + " checksum for " + src ); | |||
checksum += "0"; | |||
} | |||
fis = new FileInputStream( src ); | |||
DigestInputStream dis = new DigestInputStream( fis, | |||
messageDigest ); | |||
while( dis.read() != -1 ) | |||
; | |||
dis.close(); | |||
fis.close(); | |||
fis = null; | |||
byte[] fileDigest = messageDigest.digest(); | |||
String checksum = ""; | |||
for( int i = 0; i < fileDigest.length; i++ ) | |||
checksum += hexStr; | |||
} | |||
//can either be a property name string or a file | |||
Object destination = m_includeFileMap.get( src ); | |||
if( destination instanceof String ) | |||
{ | |||
String prop = (String)destination; | |||
if( m_isCondition ) | |||
{ | |||
String hexStr = Integer.toHexString( 0x00ff & fileDigest[ i ] ); | |||
if( hexStr.length() < 2 ) | |||
{ | |||
checksum += "0"; | |||
} | |||
checksum += hexStr; | |||
checksumMatches = checksum.equals( m_property ); | |||
} | |||
//can either be a property name string or a file | |||
Object destination = includeFileMap.get( src ); | |||
if( destination instanceof java.lang.String ) | |||
else | |||
{ | |||
String prop = (String)destination; | |||
if( isCondition ) | |||
{ | |||
checksumMatches = checksum.equals( property ); | |||
} | |||
else | |||
{ | |||
setProperty( prop, checksum ); | |||
} | |||
setProperty( prop, checksum ); | |||
} | |||
else if( destination instanceof java.io.File ) | |||
} | |||
else if( destination instanceof File ) | |||
{ | |||
final File file = (File)destination; | |||
if( m_isCondition ) | |||
{ | |||
if( isCondition ) | |||
if( file.exists() && | |||
file.length() == checksum.length() ) | |||
{ | |||
File existingFile = (File)destination; | |||
if( existingFile.exists() && | |||
existingFile.length() == checksum.length() ) | |||
{ | |||
fis = new FileInputStream( existingFile ); | |||
InputStreamReader isr = new InputStreamReader( fis ); | |||
BufferedReader br = new BufferedReader( isr ); | |||
String suppliedChecksum = br.readLine(); | |||
fis.close(); | |||
fis = null; | |||
br.close(); | |||
isr.close(); | |||
checksumMatches = | |||
checksum.equals( suppliedChecksum ); | |||
} | |||
else | |||
{ | |||
checksumMatches = false; | |||
} | |||
fis = new FileInputStream( file ); | |||
InputStreamReader isr = new InputStreamReader( fis ); | |||
BufferedReader br = new BufferedReader( isr ); | |||
String suppliedChecksum = br.readLine(); | |||
fis.close(); | |||
fis = null; | |||
br.close(); | |||
isr.close(); | |||
checksumMatches = | |||
checksum.equals( suppliedChecksum ); | |||
} | |||
else | |||
{ | |||
File dest = (File)destination; | |||
fos = new FileOutputStream( dest ); | |||
fos.write( checksum.getBytes() ); | |||
fos.close(); | |||
fos = null; | |||
checksumMatches = false; | |||
} | |||
} | |||
else | |||
{ | |||
fos = new FileOutputStream( file ); | |||
fos.write( checksum.getBytes() ); | |||
fos.close(); | |||
fos = null; | |||
} | |||
} | |||
} | |||
catch( Exception e ) | |||
catch( final Exception e ) | |||
{ | |||
throw new TaskException( "Error", e ); | |||
throw new TaskException( e.getMessage(), e ); | |||
} | |||
finally | |||
{ | |||
if( fis != null ) | |||
{ | |||
try | |||
{ | |||
fis.close(); | |||
} | |||
catch( IOException e ) | |||
{ | |||
} | |||
} | |||
if( fos != null ) | |||
{ | |||
try | |||
{ | |||
fos.close(); | |||
} | |||
catch( IOException e ) | |||
{ | |||
} | |||
} | |||
IOUtil.shutdownStream( fis ); | |||
IOUtil.shutdownStream( fos ); | |||
} | |||
return checksumMatches; | |||
} | |||
private byte[] buildDigest( final InputStream input ) | |||
throws IOException | |||
{ | |||
m_messageDigest.reset(); | |||
final DigestInputStream digester = | |||
new DigestInputStream( input, m_messageDigest ); | |||
while( digester.read() != -1 ) | |||
{ | |||
} | |||
digester.close(); | |||
return m_messageDigest.digest(); | |||
} | |||
/** | |||
* Validate attributes and get down to business. | |||
* | |||
* @return Description of the Returned Value | |||
* @exception TaskException Description of Exception | |||
*/ | |||
private boolean validateAndExecute() | |||
throws TaskException | |||
{ | |||
if( file == null && filesets.size() == 0 ) | |||
if( null == m_file && 0 == m_filesets.size() ) | |||
{ | |||
throw new TaskException( | |||
"Specify at least one source - a file or a fileset." ); | |||
final String message = "Specify at least one source - a file or a fileset."; | |||
throw new TaskException( message ); | |||
} | |||
if( file != null && file.exists() && file.isDirectory() ) | |||
if( null != m_file && m_file.exists() && m_file.isDirectory() ) | |||
{ | |||
throw new TaskException( | |||
"Checksum cannot be generated for directories" ); | |||
final String message = "Checksum cannot be generated for directories"; | |||
throw new TaskException( message ); | |||
} | |||
if( property != null && fileext != null ) | |||
if( null != m_property && null != m_fileext ) | |||
{ | |||
throw new TaskException( | |||
"Property and FileExt cannot co-exist." ); | |||
final String message = "Property and FileExt cannot co-exist."; | |||
throw new TaskException( message ); | |||
} | |||
if( property != null ) | |||
if( m_property != null ) | |||
{ | |||
if( forceOverwrite ) | |||
if( m_forceOverwrite ) | |||
{ | |||
throw new TaskException( | |||
"ForceOverwrite cannot be used when Property is specified" ); | |||
final String message = | |||
"ForceOverwrite cannot be used when Property is specified"; | |||
throw new TaskException( message ); | |||
} | |||
if( file != null ) | |||
if( m_file != null ) | |||
{ | |||
if( filesets.size() > 0 ) | |||
if( m_filesets.size() > 0 ) | |||
{ | |||
throw new TaskException( | |||
"Multiple files cannot be used when Property is specified" ); | |||
final String message = | |||
"Multiple files cannot be used when Property is specified"; | |||
throw new TaskException( message ); | |||
} | |||
} | |||
else | |||
{ | |||
if( filesets.size() > 1 ) | |||
if( m_filesets.size() > 1 ) | |||
{ | |||
throw new TaskException( | |||
"Multiple files cannot be used when Property is specified" ); | |||
final String message = | |||
"Multiple files cannot be used when Property is specified"; | |||
throw new TaskException( message ); | |||
} | |||
} | |||
} | |||
if( verifyProperty != null ) | |||
if( m_verifyProperty != null ) | |||
{ | |||
isCondition = true; | |||
m_isCondition = true; | |||
} | |||
if( verifyProperty != null && forceOverwrite ) | |||
if( m_verifyProperty != null && m_forceOverwrite ) | |||
{ | |||
throw new TaskException( | |||
"VerifyProperty and ForceOverwrite cannot co-exist." ); | |||
final String message = "VerifyProperty and ForceOverwrite cannot co-exist."; | |||
throw new TaskException( message ); | |||
} | |||
if( isCondition && forceOverwrite ) | |||
if( m_isCondition && m_forceOverwrite ) | |||
{ | |||
throw new TaskException( | |||
"ForceOverwrite cannot be used when conditions are being used." ); | |||
final String message = "ForceOverwrite cannot be used when conditions are being used."; | |||
throw new TaskException( message ); | |||
} | |||
if( fileext == null ) | |||
if( m_fileext == null ) | |||
{ | |||
fileext = "." + algorithm; | |||
m_fileext = "." + m_algorithm; | |||
} | |||
else if( fileext.trim().length() == 0 ) | |||
else if( m_fileext.trim().length() == 0 ) | |||
{ | |||
throw new TaskException( | |||
"File extension when specified must not be an empty string" ); | |||
final String message = "File extension when specified must not be an empty string"; | |||
throw new TaskException( message ); | |||
} | |||
messageDigest = null; | |||
if( provider != null ) | |||
setupMessageDigest(); | |||
if( m_messageDigest == null ) | |||
{ | |||
final String message = "Unable to create Message Digest"; | |||
throw new TaskException( message ); | |||
} | |||
addIncludes(); | |||
return generateChecksums(); | |||
} | |||
private void setupMessageDigest() | |||
throws TaskException | |||
{ | |||
m_messageDigest = null; | |||
if( m_provider != null ) | |||
{ | |||
try | |||
{ | |||
messageDigest = MessageDigest.getInstance( algorithm, provider ); | |||
m_messageDigest = MessageDigest.getInstance( m_algorithm, m_provider ); | |||
} | |||
catch( NoSuchAlgorithmException noalgo ) | |||
catch( final NoSuchAlgorithmException nsae ) | |||
{ | |||
throw new TaskException( noalgo.toString(), noalgo ); | |||
throw new TaskException( nsae.toString(), nsae ); | |||
} | |||
catch( NoSuchProviderException noprovider ) | |||
catch( final NoSuchProviderException nspe ) | |||
{ | |||
throw new TaskException( noprovider.toString(), noprovider ); | |||
throw new TaskException( nspe.toString(), nspe ); | |||
} | |||
} | |||
else | |||
{ | |||
try | |||
{ | |||
messageDigest = MessageDigest.getInstance( algorithm ); | |||
m_messageDigest = MessageDigest.getInstance( m_algorithm ); | |||
} | |||
catch( NoSuchAlgorithmException noalgo ) | |||
catch( final NoSuchAlgorithmException nsae ) | |||
{ | |||
throw new TaskException( noalgo.toString(), noalgo ); | |||
throw new TaskException( nsae.toString(), nsae ); | |||
} | |||
} | |||
} | |||
if( messageDigest == null ) | |||
{ | |||
throw new TaskException( "Unable to create Message Digest" ); | |||
} | |||
addToIncludeFileMap( file ); | |||
private void addIncludes() | |||
throws TaskException | |||
{ | |||
addToIncludeFileMap( m_file ); | |||
int sizeofFileSet = filesets.size(); | |||
for( int i = 0; i < sizeofFileSet; i++ ) | |||
final int size = m_filesets.size(); | |||
for( int i = 0; i < size; i++ ) | |||
{ | |||
FileSet fs = (FileSet)filesets.get( i ); | |||
DirectoryScanner ds = fs.getDirectoryScanner(); | |||
String[] srcFiles = ds.getIncludedFiles(); | |||
final FileSet fileSet = (FileSet)m_filesets.get( i ); | |||
final DirectoryScanner scanner = fileSet.getDirectoryScanner(); | |||
final String[] srcFiles = scanner.getIncludedFiles(); | |||
for( int j = 0; j < srcFiles.length; j++ ) | |||
{ | |||
File src = new File( fs.getDir(), srcFiles[ j ] ); | |||
final File src = new File( fileSet.getDir(), srcFiles[ j ] ); | |||
addToIncludeFileMap( src ); | |||
} | |||
} | |||
return generateChecksums(); | |||
} | |||
} |
@@ -106,17 +106,17 @@ public class Java | |||
/** | |||
* Creates a nested arg element. | |||
*/ | |||
public Argument createArg() | |||
public void addArg( final Argument argument ) | |||
{ | |||
return m_cmdl.createArgument(); | |||
m_cmdl.addArgument( argument ); | |||
} | |||
/** | |||
* Creates a nested jvmarg element. | |||
*/ | |||
public Argument createJvmarg() | |||
public void addJvmarg( final Argument argument ) | |||
{ | |||
return m_cmdl.createVmArgument(); | |||
m_cmdl.addVmArgument( argument ); | |||
} | |||
public void execute() | |||
@@ -192,7 +192,7 @@ public class Java | |||
for( int i = 0; i < size; i++ ) | |||
{ | |||
final String arg = (String)args.get( i ); | |||
java.createArgument().setValue( arg ); | |||
java.addArgument( arg ); | |||
} | |||
run( java ); | |||
} | |||
@@ -154,35 +154,35 @@ public class Patch | |||
if( m_backups ) | |||
{ | |||
cmd.createArgument().setValue( "-b" ); | |||
cmd.addArgument( "-b" ); | |||
} | |||
if( null != m_strip ) | |||
{ | |||
cmd.createArgument().setValue( "-p" + m_strip.intValue() ); | |||
cmd.addArgument( "-p" + m_strip.intValue() ); | |||
} | |||
if( m_quiet ) | |||
{ | |||
cmd.createArgument().setValue( "-s" ); | |||
cmd.addArgument( "-s" ); | |||
} | |||
if( m_reverse ) | |||
{ | |||
cmd.createArgument().setValue( "-R" ); | |||
cmd.addArgument( "-R" ); | |||
} | |||
cmd.createArgument().setValue( "-i" ); | |||
cmd.createArgument().setFile( m_patchFile ); | |||
cmd.addArgument( "-i" ); | |||
cmd.addArgument( m_patchFile ); | |||
if( m_ignorewhitespace ) | |||
{ | |||
cmd.createArgument().setValue( "-l" ); | |||
cmd.addArgument( "-l" ); | |||
} | |||
if( null != m_originalFile ) | |||
{ | |||
cmd.createArgument().setFile( m_originalFile ); | |||
cmd.addArgument( m_originalFile ); | |||
} | |||
return cmd; | |||
} | |||
@@ -22,6 +22,7 @@ import org.apache.tools.ant.types.SourceFileScanner; | |||
import org.apache.aut.tar.TarConstants; | |||
import org.apache.aut.tar.TarEntry; | |||
import org.apache.aut.tar.TarOutputStream; | |||
import org.apache.avalon.excalibur.io.IOUtil; | |||
/** | |||
* Creates a TAR archive. | |||
@@ -128,7 +129,7 @@ public class Tar | |||
} | |||
// add the main fileset to the list of filesets to process. | |||
TarFileSet mainFileSet = new TarFileSet( /*fileset*/ ); | |||
final TarFileSet mainFileSet = new TarFileSet( /*fileset*/ ); | |||
mainFileSet.setDir( baseDir ); | |||
filesets.add( mainFileSet ); | |||
} | |||
@@ -222,212 +223,88 @@ public class Tar | |||
} | |||
} | |||
protected boolean archiveIsUpToDate( String[] files ) | |||
private boolean archiveIsUpToDate( final String[] files ) | |||
throws TaskException | |||
{ | |||
SourceFileScanner sfs = new SourceFileScanner( this ); | |||
MergingMapper mm = new MergingMapper(); | |||
mm.setTo( tarFile.getAbsolutePath() ); | |||
return sfs.restrict( files, baseDir, null, mm ).length == 0; | |||
final SourceFileScanner scanner = new SourceFileScanner( this ); | |||
final MergingMapper mapper = new MergingMapper(); | |||
mapper.setTo( tarFile.getAbsolutePath() ); | |||
return scanner.restrict( files, baseDir, null, mapper ).length == 0; | |||
} | |||
protected void tarFile( File file, TarOutputStream tOut, String vPath, | |||
TarFileSet tarFileSet ) | |||
private void tarFile( final File file, | |||
final TarOutputStream output, | |||
String path, | |||
final TarFileSet tarFileSet ) | |||
throws IOException, TaskException | |||
{ | |||
FileInputStream fIn = null; | |||
// don't add "" to the archive | |||
if( vPath.length() <= 0 ) | |||
if( path.length() <= 0 ) | |||
{ | |||
return; | |||
} | |||
if( file.isDirectory() && !vPath.endsWith( "/" ) ) | |||
if( file.isDirectory() && !path.endsWith( "/" ) ) | |||
{ | |||
vPath += "/"; | |||
path += "/"; | |||
} | |||
try | |||
if( path.length() >= TarConstants.NAMELEN ) | |||
{ | |||
if( vPath.length() >= TarConstants.NAMELEN ) | |||
if( longFileMode.isOmitMode() ) | |||
{ | |||
if( longFileMode.isOmitMode() ) | |||
{ | |||
getLogger().info( "Omitting: " + vPath ); | |||
return; | |||
} | |||
else if( longFileMode.isWarnMode() ) | |||
{ | |||
final String message = "Entry: " + vPath + " longer than " + | |||
TarConstants.NAMELEN + " characters."; | |||
getLogger().warn( message ); | |||
if( !longWarningGiven ) | |||
{ | |||
final String message2 = "Resulting tar file can only be processed successfully" | |||
+ " by GNU compatible tar commands"; | |||
getLogger().warn( message2 ); | |||
longWarningGiven = true; | |||
} | |||
} | |||
else if( longFileMode.isFailMode() ) | |||
final String message = "Omitting: " + path; | |||
getLogger().info( message ); | |||
return; | |||
} | |||
else if( longFileMode.isWarnMode() ) | |||
{ | |||
final String message = "Entry: " + path + " longer than " + | |||
TarConstants.NAMELEN + " characters."; | |||
getLogger().warn( message ); | |||
if( !longWarningGiven ) | |||
{ | |||
throw new TaskException( | |||
"Entry: " + vPath + " longer than " + | |||
TarConstants.NAMELEN + "characters." ); | |||
final String message2 = "Resulting tar file can only be processed successfully" | |||
+ " by GNU compatible tar commands"; | |||
getLogger().warn( message2 ); | |||
longWarningGiven = true; | |||
} | |||
} | |||
TarEntry te = new TarEntry( vPath ); | |||
te.setModTime( file.lastModified() ); | |||
if( !file.isDirectory() ) | |||
else if( longFileMode.isFailMode() ) | |||
{ | |||
te.setSize( file.length() ); | |||
te.setMode( tarFileSet.getMode() ); | |||
final String message = "Entry: " + path + " longer than " + | |||
TarConstants.NAMELEN + "characters."; | |||
throw new TaskException( message ); | |||
} | |||
te.setUserName( tarFileSet.getUserName() ); | |||
te.setGroupName( tarFileSet.getGroup() ); | |||
tOut.putNextEntry( te ); | |||
} | |||
FileInputStream input = null; | |||
try | |||
{ | |||
final TarEntry entry = new TarEntry( path ); | |||
entry.setModTime( file.lastModified() ); | |||
if( !file.isDirectory() ) | |||
{ | |||
fIn = new FileInputStream( file ); | |||
byte[] buffer = new byte[ 8 * 1024 ]; | |||
int count = 0; | |||
do | |||
{ | |||
tOut.write( buffer, 0, count ); | |||
count = fIn.read( buffer, 0, buffer.length ); | |||
} while( count != -1 ); | |||
entry.setSize( file.length() ); | |||
entry.setMode( tarFileSet.getMode() ); | |||
} | |||
entry.setUserName( tarFileSet.getUserName() ); | |||
entry.setGroupName( tarFileSet.getGroup() ); | |||
tOut.closeEntry(); | |||
} | |||
finally | |||
{ | |||
if( fIn != null ) | |||
fIn.close(); | |||
} | |||
} | |||
public static class TarFileSet extends FileSet | |||
{ | |||
private String[] files = null; | |||
private int mode = 0100644; | |||
private String userName = ""; | |||
private String groupName = ""; | |||
public void setGroup( String groupName ) | |||
{ | |||
this.groupName = groupName; | |||
} | |||
output.putNextEntry( entry ); | |||
public void setMode( String octalString ) | |||
{ | |||
this.mode = 0100000 | Integer.parseInt( octalString, 8 ); | |||
} | |||
public void setUserName( String userName ) | |||
{ | |||
this.userName = userName; | |||
} | |||
/** | |||
* Get a list of files and directories specified in the fileset. | |||
* | |||
* @param p Description of Parameter | |||
* @return a list of file and directory names, relative to the baseDir | |||
* for the project. | |||
*/ | |||
public String[] getFiles() | |||
throws TaskException | |||
{ | |||
if( files == null ) | |||
if( !file.isDirectory() ) | |||
{ | |||
final DirectoryScanner scanner = getDirectoryScanner(); | |||
final String[] directories = scanner.getIncludedDirectories(); | |||
final String[] filesPerSe = scanner.getIncludedFiles(); | |||
files = new String[ directories.length + filesPerSe.length ]; | |||
System.arraycopy( directories, 0, files, 0, directories.length ); | |||
System.arraycopy( filesPerSe, 0, files, directories.length, | |||
filesPerSe.length ); | |||
input = new FileInputStream( file ); | |||
IOUtil.copy( input, output ); | |||
} | |||
return files; | |||
output.closeEntry(); | |||
} | |||
public String getGroup() | |||
{ | |||
return groupName; | |||
} | |||
public int getMode() | |||
{ | |||
return mode; | |||
} | |||
public String getUserName() | |||
{ | |||
return userName; | |||
} | |||
} | |||
/** | |||
* Valid Modes for LongFile attribute to Tar Task | |||
* | |||
* @author <a href="mailto:umagesh@apache.org">Magesh Umasankar</a> | |||
*/ | |||
public static class TarLongFileMode extends EnumeratedAttribute | |||
{ | |||
// permissable values for longfile attribute | |||
public final static String WARN = "warn"; | |||
public final static String FAIL = "fail"; | |||
public final static String TRUNCATE = "truncate"; | |||
public final static String GNU = "gnu"; | |||
public final static String OMIT = "omit"; | |||
private final String[] validModes = {WARN, FAIL, TRUNCATE, GNU, OMIT}; | |||
public TarLongFileMode() | |||
throws TaskException | |||
{ | |||
super(); | |||
setValue( WARN ); | |||
} | |||
public String[] getValues() | |||
{ | |||
return validModes; | |||
} | |||
public boolean isFailMode() | |||
{ | |||
return FAIL.equalsIgnoreCase( getValue() ); | |||
} | |||
public boolean isGnuMode() | |||
{ | |||
return GNU.equalsIgnoreCase( getValue() ); | |||
} | |||
public boolean isOmitMode() | |||
{ | |||
return OMIT.equalsIgnoreCase( getValue() ); | |||
} | |||
public boolean isTruncateMode() | |||
{ | |||
return TRUNCATE.equalsIgnoreCase( getValue() ); | |||
} | |||
public boolean isWarnMode() | |||
finally | |||
{ | |||
return WARN.equalsIgnoreCase( getValue() ); | |||
if( input != null ) | |||
input.close(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,75 @@ | |||
/* | |||
* Copyright (C) The Apache Software Foundation. All rights reserved. | |||
* | |||
* This software is published under the terms of the Apache Software License | |||
* version 1.1, a copy of which has been included with this distribution in | |||
* the LICENSE.txt file. | |||
*/ | |||
package org.apache.tools.ant.taskdefs; | |||
import org.apache.tools.ant.types.FileSet; | |||
import org.apache.tools.ant.types.DirectoryScanner; | |||
import org.apache.myrmidon.api.TaskException; | |||
public class TarFileSet | |||
extends FileSet | |||
{ | |||
private String[] m_files; | |||
private int m_mode = 0100644; | |||
private String m_userName = ""; | |||
private String m_groupName = ""; | |||
public void setGroup( final String groupName ) | |||
{ | |||
m_groupName = groupName; | |||
} | |||
public void setMode( final String octalString ) | |||
{ | |||
m_mode = 0100000 | Integer.parseInt( octalString, 8 ); | |||
} | |||
public void setUserName( final String userName ) | |||
{ | |||
m_userName = userName; | |||
} | |||
/** | |||
* Get a list of files and directories specified in the fileset. | |||
* | |||
* @return a list of file and directory names, relative to the baseDir | |||
* for the project. | |||
*/ | |||
protected String[] getFiles() | |||
throws TaskException | |||
{ | |||
if( m_files == null ) | |||
{ | |||
final DirectoryScanner scanner = getDirectoryScanner(); | |||
final String[] directories = scanner.getIncludedDirectories(); | |||
final String[] filesPerSe = scanner.getIncludedFiles(); | |||
m_files = new String[ directories.length + filesPerSe.length ]; | |||
System.arraycopy( directories, 0, m_files, 0, directories.length ); | |||
System.arraycopy( filesPerSe, 0, m_files, directories.length, | |||
filesPerSe.length ); | |||
} | |||
return m_files; | |||
} | |||
protected String getGroup() | |||
{ | |||
return m_groupName; | |||
} | |||
protected int getMode() | |||
{ | |||
return m_mode; | |||
} | |||
protected String getUserName() | |||
{ | |||
return m_userName; | |||
} | |||
} |
@@ -0,0 +1,66 @@ | |||
/* | |||
* Copyright (C) The Apache Software Foundation. All rights reserved. | |||
* | |||
* This software is published under the terms of the Apache Software License | |||
* version 1.1, a copy of which has been included with this distribution in | |||
* the LICENSE.txt file. | |||
*/ | |||
package org.apache.tools.ant.taskdefs; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.types.EnumeratedAttribute; | |||
/** | |||
* Valid Modes for LongFile attribute to Tar Task | |||
* | |||
* @author <a href="mailto:umagesh@apache.org">Magesh Umasankar</a> | |||
*/ | |||
public class TarLongFileMode | |||
extends EnumeratedAttribute | |||
{ | |||
// permissable values for longfile attribute | |||
public final static String WARN = "warn"; | |||
public final static String FAIL = "fail"; | |||
public final static String TRUNCATE = "truncate"; | |||
public final static String GNU = "gnu"; | |||
public final static String OMIT = "omit"; | |||
private final String[] validModes = {WARN, FAIL, TRUNCATE, GNU, OMIT}; | |||
public TarLongFileMode() | |||
throws TaskException | |||
{ | |||
super(); | |||
setValue( WARN ); | |||
} | |||
public String[] getValues() | |||
{ | |||
return validModes; | |||
} | |||
public boolean isFailMode() | |||
{ | |||
return FAIL.equalsIgnoreCase( getValue() ); | |||
} | |||
public boolean isGnuMode() | |||
{ | |||
return GNU.equalsIgnoreCase( getValue() ); | |||
} | |||
public boolean isOmitMode() | |||
{ | |||
return OMIT.equalsIgnoreCase( getValue() ); | |||
} | |||
public boolean isTruncateMode() | |||
{ | |||
return TRUNCATE.equalsIgnoreCase( getValue() ); | |||
} | |||
public boolean isWarnMode() | |||
{ | |||
return WARN.equalsIgnoreCase( getValue() ); | |||
} | |||
} |
@@ -20,6 +20,7 @@ import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.Path; | |||
import org.apache.tools.ant.types.FileSet; | |||
import org.apache.tools.ant.util.FileUtils; | |||
/** | |||
* This is the default implementation for the CompilerAdapter interface. | |||
@@ -133,7 +134,7 @@ public abstract class DefaultCompilerAdapter | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( memoryParameterPrefix + "ms" + m_memoryInitialSize ); | |||
cmd.addArgument( memoryParameterPrefix + "ms" + m_memoryInitialSize ); | |||
} | |||
} | |||
@@ -146,54 +147,54 @@ public abstract class DefaultCompilerAdapter | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( memoryParameterPrefix + "mx" + m_memoryMaximumSize ); | |||
cmd.addArgument( memoryParameterPrefix + "mx" + m_memoryMaximumSize ); | |||
} | |||
} | |||
if( m_attributes.getNowarn() ) | |||
{ | |||
cmd.createArgument().setValue( "-nowarn" ); | |||
cmd.addArgument( "-nowarn" ); | |||
} | |||
if( m_deprecation == true ) | |||
{ | |||
cmd.createArgument().setValue( "-deprecation" ); | |||
cmd.addArgument( "-deprecation" ); | |||
} | |||
if( m_destDir != null ) | |||
{ | |||
cmd.createArgument().setValue( "-d" ); | |||
cmd.createArgument().setFile( m_destDir ); | |||
cmd.addArgument( "-d" ); | |||
cmd.addArgument( m_destDir ); | |||
} | |||
cmd.createArgument().setValue( "-classpath" ); | |||
cmd.createArgument().setPath( classpath ); | |||
cmd.addArgument( "-classpath" ); | |||
cmd.addArguments( FileUtils.translateCommandline( classpath ) ); | |||
cmd.createArgument().setValue( "-sourcepath" ); | |||
cmd.createArgument().setPath( src ); | |||
cmd.addArgument( "-sourcepath" ); | |||
cmd.addArguments( FileUtils.translateCommandline( src ) ); | |||
if( target != null ) | |||
{ | |||
cmd.createArgument().setValue( "-target" ); | |||
cmd.createArgument().setValue( target ); | |||
cmd.addArgument( "-target" ); | |||
cmd.addArgument( target ); | |||
} | |||
if( m_bootclasspath != null ) | |||
{ | |||
cmd.createArgument().setValue( "-bootclasspath" ); | |||
cmd.createArgument().setPath( m_bootclasspath ); | |||
cmd.addArgument( "-bootclasspath" ); | |||
cmd.addArguments( FileUtils.translateCommandline( m_bootclasspath ) ); | |||
} | |||
if( m_extdirs != null ) | |||
{ | |||
cmd.createArgument().setValue( "-extdirs" ); | |||
cmd.createArgument().setPath( m_extdirs ); | |||
cmd.addArgument( "-extdirs" ); | |||
cmd.addArguments( FileUtils.translateCommandline( m_extdirs ) ); | |||
} | |||
if( m_encoding != null ) | |||
{ | |||
cmd.createArgument().setValue( "-encoding" ); | |||
cmd.createArgument().setValue( m_encoding ); | |||
cmd.addArgument( "-encoding" ); | |||
cmd.addArgument( m_encoding ); | |||
} | |||
if( m_debug ) | |||
{ | |||
@@ -202,30 +203,30 @@ public abstract class DefaultCompilerAdapter | |||
String debugLevel = m_attributes.getDebugLevel(); | |||
if( debugLevel != null ) | |||
{ | |||
cmd.createArgument().setValue( "-g:" + debugLevel ); | |||
cmd.addArgument( "-g:" + debugLevel ); | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( "-g" ); | |||
cmd.addArgument( "-g" ); | |||
} | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( "-g" ); | |||
cmd.addArgument( "-g" ); | |||
} | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( "-g:none" ); | |||
cmd.addArgument( "-g:none" ); | |||
} | |||
if( m_optimize ) | |||
{ | |||
cmd.createArgument().setValue( "-O" ); | |||
cmd.addArgument( "-O" ); | |||
} | |||
if( m_verbose ) | |||
{ | |||
cmd.createArgument().setValue( "-verbose" ); | |||
cmd.addArgument( "-verbose" ); | |||
} | |||
addCurrentCompilerArgs( cmd ); | |||
@@ -262,8 +263,8 @@ public abstract class DefaultCompilerAdapter | |||
setupJavacCommandlineSwitches( cmd, true ); | |||
if( m_attributes.getSource() != null ) | |||
{ | |||
cmd.createArgument().setValue( "-source" ); | |||
cmd.createArgument().setValue( m_attributes.getSource() ); | |||
cmd.addArgument( "-source" ); | |||
cmd.addArgument( m_attributes.getSource() ); | |||
} | |||
return cmd; | |||
} | |||
@@ -410,7 +411,7 @@ public abstract class DefaultCompilerAdapter | |||
for( int i = 0; i < m_compileList.length; i++ ) | |||
{ | |||
String arg = m_compileList[ i ].getAbsolutePath(); | |||
cmd.createArgument().setValue( arg ); | |||
cmd.addArgument( arg ); | |||
niceSourceList.append( " " + arg + StringUtil.LINE_SEPARATOR ); | |||
} | |||
@@ -10,6 +10,7 @@ package org.apache.tools.ant.taskdefs.compilers; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.Path; | |||
import org.apache.tools.ant.util.FileUtils; | |||
/** | |||
* The implementation of the gcj compiler. This is primarily a cut-and-paste | |||
@@ -72,8 +73,8 @@ public class Gcj extends DefaultCompilerAdapter | |||
if( m_destDir != null ) | |||
{ | |||
cmd.createArgument().setValue( "-d" ); | |||
cmd.createArgument().setFile( m_destDir ); | |||
cmd.addArgument( "-d" ); | |||
cmd.addArgument( m_destDir ); | |||
if( m_destDir.mkdirs() ) | |||
{ | |||
@@ -82,26 +83,26 @@ public class Gcj extends DefaultCompilerAdapter | |||
; | |||
} | |||
cmd.createArgument().setValue( "-classpath" ); | |||
cmd.createArgument().setPath( classpath ); | |||
cmd.addArgument( "-classpath" ); | |||
cmd.addArguments( FileUtils.translateCommandline( classpath ) ); | |||
if( m_encoding != null ) | |||
{ | |||
cmd.createArgument().setValue( "--encoding=" + m_encoding ); | |||
cmd.addArgument( "--encoding=" + m_encoding ); | |||
} | |||
if( m_debug ) | |||
{ | |||
cmd.createArgument().setValue( "-g1" ); | |||
cmd.addArgument( "-g1" ); | |||
} | |||
if( m_optimize ) | |||
{ | |||
cmd.createArgument().setValue( "-O" ); | |||
cmd.addArgument( "-O" ); | |||
} | |||
/** | |||
* gcj should be set for generate class. | |||
*/ | |||
cmd.createArgument().setValue( "-C" ); | |||
cmd.addArgument( "-C" ); | |||
addCurrentCompilerArgs( cmd ); | |||
@@ -10,6 +10,7 @@ package org.apache.tools.ant.taskdefs.compilers; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.Path; | |||
import org.apache.tools.ant.util.FileUtils; | |||
/** | |||
* The implementation of the jikes compiler. This is primarily a cut-and-paste | |||
@@ -83,37 +84,37 @@ public class Jikes | |||
cmd.setExecutable( "jikes" ); | |||
if( m_deprecation == true ) | |||
cmd.createArgument().setValue( "-deprecation" ); | |||
cmd.addArgument( "-deprecation" ); | |||
if( m_destDir != null ) | |||
{ | |||
cmd.createArgument().setValue( "-d" ); | |||
cmd.createArgument().setFile( m_destDir ); | |||
cmd.addArgument( "-d" ); | |||
cmd.addArgument( m_destDir ); | |||
} | |||
cmd.createArgument().setValue( "-classpath" ); | |||
cmd.createArgument().setPath( classpath ); | |||
cmd.addArgument( "-classpath" ); | |||
cmd.addArguments( FileUtils.translateCommandline( classpath ) ); | |||
if( m_encoding != null ) | |||
{ | |||
cmd.createArgument().setValue( "-encoding" ); | |||
cmd.createArgument().setValue( m_encoding ); | |||
cmd.addArgument( "-encoding" ); | |||
cmd.addArgument( m_encoding ); | |||
} | |||
if( m_debug ) | |||
{ | |||
cmd.createArgument().setValue( "-g" ); | |||
cmd.addArgument( "-g" ); | |||
} | |||
if( m_optimize ) | |||
{ | |||
cmd.createArgument().setValue( "-O" ); | |||
cmd.addArgument( "-O" ); | |||
} | |||
if( m_verbose ) | |||
{ | |||
cmd.createArgument().setValue( "-verbose" ); | |||
cmd.addArgument( "-verbose" ); | |||
} | |||
if( m_depend ) | |||
{ | |||
cmd.createArgument().setValue( "-depend" ); | |||
cmd.addArgument( "-depend" ); | |||
} | |||
if( m_attributes.getNowarn() ) | |||
@@ -124,7 +125,7 @@ public class Jikes | |||
* let the magic property win over the attribute for backwards | |||
* compatibility | |||
*/ | |||
cmd.createArgument().setValue( "-nowarn" ); | |||
cmd.addArgument( "-nowarn" ); | |||
} | |||
addCurrentCompilerArgs( cmd ); | |||
@@ -10,6 +10,7 @@ package org.apache.tools.ant.taskdefs.compilers; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.Path; | |||
import org.apache.tools.ant.util.FileUtils; | |||
/** | |||
* The implementation of the jvc compiler from microsoft. This is primarily a | |||
@@ -65,32 +66,32 @@ public class Jvc extends DefaultCompilerAdapter | |||
if( m_destDir != null ) | |||
{ | |||
cmd.createArgument().setValue( "/d" ); | |||
cmd.createArgument().setFile( m_destDir ); | |||
cmd.addArgument( "/d" ); | |||
cmd.addArgument( m_destDir ); | |||
} | |||
// Add the Classpath before the "internal" one. | |||
cmd.createArgument().setValue( "/cp:p" ); | |||
cmd.createArgument().setPath( classpath ); | |||
cmd.addArgument( "/cp:p" ); | |||
cmd.addArguments( FileUtils.translateCommandline( classpath ) ); | |||
// Enable MS-Extensions and ... | |||
cmd.createArgument().setValue( "/x-" ); | |||
cmd.addArgument( "/x-" ); | |||
// ... do not display a Message about this. | |||
cmd.createArgument().setValue( "/nomessage" ); | |||
cmd.addArgument( "/nomessage" ); | |||
// Do not display Logo | |||
cmd.createArgument().setValue( "/nologo" ); | |||
cmd.addArgument( "/nologo" ); | |||
if( m_debug ) | |||
{ | |||
cmd.createArgument().setValue( "/g" ); | |||
cmd.addArgument( "/g" ); | |||
} | |||
if( m_optimize ) | |||
{ | |||
cmd.createArgument().setValue( "/O" ); | |||
cmd.addArgument( "/O" ); | |||
} | |||
if( m_verbose ) | |||
{ | |||
cmd.createArgument().setValue( "/verbose" ); | |||
cmd.addArgument( "/verbose" ); | |||
} | |||
addCurrentCompilerArgs( cmd ); | |||
@@ -11,6 +11,7 @@ import java.lang.reflect.Method; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.Path; | |||
import org.apache.tools.ant.util.FileUtils; | |||
/** | |||
* The implementation of the Java compiler for KJC. This is primarily a | |||
@@ -72,17 +73,17 @@ public class Kjc extends DefaultCompilerAdapter | |||
if( m_deprecation == true ) | |||
{ | |||
cmd.createArgument().setValue( "-deprecation" ); | |||
cmd.addArgument( "-deprecation" ); | |||
} | |||
if( m_destDir != null ) | |||
{ | |||
cmd.createArgument().setValue( "-d" ); | |||
cmd.createArgument().setFile( m_destDir ); | |||
cmd.addArgument( "-d" ); | |||
cmd.addArgument( m_destDir ); | |||
} | |||
// generate the clsspath | |||
cmd.createArgument().setValue( "-classpath" ); | |||
cmd.addArgument( "-classpath" ); | |||
Path cp = new Path(); | |||
@@ -100,29 +101,29 @@ public class Kjc extends DefaultCompilerAdapter | |||
cp.append( classpath ); | |||
cp.append( src ); | |||
cmd.createArgument().setPath( cp ); | |||
cmd.addArguments( FileUtils.translateCommandline( cp ) ); | |||
// kjc-1.5A doesn't support -encoding option now. | |||
// but it will be supported near the feature. | |||
if( m_encoding != null ) | |||
{ | |||
cmd.createArgument().setValue( "-encoding" ); | |||
cmd.createArgument().setValue( m_encoding ); | |||
cmd.addArgument( "-encoding" ); | |||
cmd.addArgument( m_encoding ); | |||
} | |||
if( m_debug ) | |||
{ | |||
cmd.createArgument().setValue( "-g" ); | |||
cmd.addArgument( "-g" ); | |||
} | |||
if( m_optimize ) | |||
{ | |||
cmd.createArgument().setValue( "-O2" ); | |||
cmd.addArgument( "-O2" ); | |||
} | |||
if( m_verbose ) | |||
{ | |||
cmd.createArgument().setValue( "-verbose" ); | |||
cmd.addArgument( "-verbose" ); | |||
} | |||
addCurrentCompilerArgs( cmd ); | |||
@@ -162,12 +162,10 @@ public class ExecTask | |||
/** | |||
* Add a nested arg element - a command line argument. | |||
* | |||
* @return Description of the Returned Value | |||
*/ | |||
public Argument createArg() | |||
public void addArg( final Argument argument ) | |||
{ | |||
return m_command.createArgument(); | |||
m_command.addArgument( argument ); | |||
} | |||
/** | |||
@@ -20,6 +20,7 @@ import org.apache.aut.nativelib.Os; | |||
import org.apache.aut.nativelib.ExecOutputHandler; | |||
import org.apache.tools.ant.types.DirectoryScanner; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.util.FileUtils; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.FileSet; | |||
@@ -89,7 +90,7 @@ public class Javadoc | |||
public void setAccess( AccessType at ) | |||
{ | |||
m_command.createArgument().setValue( "-" + at.getValue() ); | |||
m_command.addArgument( "-" + at.getValue() ); | |||
} | |||
public void setAdditionalparam( String add ) | |||
@@ -155,14 +156,14 @@ public class Javadoc | |||
public void setDestdir( File dir ) | |||
{ | |||
m_destDir = dir; | |||
m_command.createArgument().setValue( "-d" ); | |||
m_command.createArgument().setFile( m_destDir ); | |||
m_command.addArgument( "-d" ); | |||
m_command.addArgument( m_destDir ); | |||
} | |||
public void setDocencoding( String enc ) | |||
{ | |||
m_command.createArgument().setValue( "-docencoding" ); | |||
m_command.createArgument().setValue( enc ); | |||
m_command.addArgument( "-docencoding" ); | |||
m_command.addArgument( enc ); | |||
} | |||
public void setDoclet( String src ) | |||
@@ -193,8 +194,8 @@ public class Javadoc | |||
public void setEncoding( String enc ) | |||
{ | |||
m_command.createArgument().setValue( "-encoding" ); | |||
m_command.createArgument().setValue( enc ); | |||
m_command.addArgument( "-encoding" ); | |||
m_command.addArgument( enc ); | |||
} | |||
public void setExcludePackageNames( String src ) | |||
@@ -211,8 +212,8 @@ public class Javadoc | |||
public void setExtdirs( String src ) | |||
{ | |||
m_command.createArgument().setValue( "-extdirs" ); | |||
m_command.createArgument().setValue( src ); | |||
m_command.addArgument( "-extdirs" ); | |||
m_command.addArgument( src ); | |||
} | |||
public void setFooter( String src ) | |||
@@ -236,8 +237,8 @@ public class Javadoc | |||
public void setHelpfile( File f ) | |||
{ | |||
m_command.createArgument().setValue( "-helpfile" ); | |||
m_command.createArgument().setFile( f ); | |||
m_command.addArgument( "-helpfile" ); | |||
m_command.addArgument( f ); | |||
} | |||
public void setLink( String src ) | |||
@@ -268,13 +269,13 @@ public class Javadoc | |||
public void setLocale( String src ) | |||
{ | |||
m_command.createArgument().setValue( "-locale" ); | |||
m_command.createArgument().setValue( src ); | |||
m_command.addArgument( "-locale" ); | |||
m_command.addArgument( src ); | |||
} | |||
public void setMaxmemory( final String max ) | |||
{ | |||
m_command.createArgument().setValue( "-J-Xmx" + max ); | |||
m_command.addArgument( "-J-Xmx" + max ); | |||
} | |||
public void setNodeprecated( boolean b ) | |||
@@ -314,8 +315,8 @@ public class Javadoc | |||
public void setOverview( File f ) | |||
{ | |||
m_command.createArgument().setValue( "-overview" ); | |||
m_command.createArgument().setFile( f ); | |||
m_command.addArgument( "-overview" ); | |||
m_command.addArgument( f ); | |||
} | |||
public void setPackage( boolean b ) | |||
@@ -393,8 +394,8 @@ public class Javadoc | |||
public void setStylesheetfile( File f ) | |||
{ | |||
m_command.createArgument().setValue( "-stylesheetfile" ); | |||
m_command.createArgument().setFile( f ); | |||
m_command.addArgument( "-stylesheetfile" ); | |||
m_command.addArgument( f ); | |||
} | |||
public void setUse( boolean b ) | |||
@@ -536,23 +537,23 @@ public class Javadoc | |||
if( m_doctitle != null ) | |||
{ | |||
m_command.createArgument().setValue( "-doctitle" ); | |||
m_command.createArgument().setValue( m_doctitle.getText() ); | |||
m_command.addArgument( "-doctitle" ); | |||
m_command.addArgument( m_doctitle.getText() ); | |||
} | |||
if( m_header != null ) | |||
{ | |||
m_command.createArgument().setValue( "-header" ); | |||
m_command.createArgument().setValue( m_header.getText() ); | |||
m_command.addArgument( "-header" ); | |||
m_command.addArgument( m_header.getText() ); | |||
} | |||
if( m_footer != null ) | |||
{ | |||
m_command.createArgument().setValue( "-footer" ); | |||
m_command.createArgument().setValue( m_footer.getText() ); | |||
m_command.addArgument( "-footer" ); | |||
m_command.addArgument( m_footer.getText() ); | |||
} | |||
if( m_bottom != null ) | |||
{ | |||
m_command.createArgument().setValue( "-bottom" ); | |||
m_command.createArgument().setValue( m_bottom.getText() ); | |||
m_command.addArgument( "-bottom" ); | |||
m_command.addArgument( m_bottom.getText() ); | |||
} | |||
Commandline cmd = new Commandline();//(Commandline)m_command.clone(); | |||
@@ -567,13 +568,13 @@ public class Javadoc | |||
{ | |||
classpath.addPath( m_classpath ); | |||
} | |||
cmd.createArgument().setValue( "-classpath" ); | |||
cmd.createArgument().setValue( classpath.toString() ); | |||
cmd.addArgument( "-classpath" ); | |||
cmd.addArgument( classpath.toString() ); | |||
if( m_version && m_doclet == null ) | |||
cmd.createArgument().setValue( "-version" ); | |||
cmd.addArgument( "-version" ); | |||
if( m_author && m_doclet == null ) | |||
cmd.createArgument().setValue( "-author" ); | |||
cmd.addArgument( "-author" ); | |||
if( m_doclet == null ) | |||
{ | |||
@@ -596,12 +597,12 @@ public class Javadoc | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( "-doclet" ); | |||
cmd.createArgument().setValue( m_doclet.getName() ); | |||
cmd.addArgument( "-doclet" ); | |||
cmd.addArgument( m_doclet.getName() ); | |||
if( m_doclet.getPath() != null ) | |||
{ | |||
cmd.createArgument().setValue( "-docletpath" ); | |||
cmd.createArgument().setPath( m_doclet.getPath() ); | |||
cmd.addArgument( "-docletpath" ); | |||
cmd.addArguments( FileUtils.translateCommandline( m_doclet.getPath() ) ); | |||
} | |||
for( Iterator e = m_doclet.getParams(); e.hasNext(); ) | |||
{ | |||
@@ -611,18 +612,18 @@ public class Javadoc | |||
throw new TaskException( "Doclet parameters must have a name" ); | |||
} | |||
cmd.createArgument().setValue( param.getName() ); | |||
cmd.addArgument( param.getName() ); | |||
if( param.getValue() != null ) | |||
{ | |||
cmd.createArgument().setValue( param.getValue() ); | |||
cmd.addArgument( param.getValue() ); | |||
} | |||
} | |||
} | |||
if( m_bootclasspath != null ) | |||
{ | |||
cmd.createArgument().setValue( "-bootclasspath" ); | |||
cmd.createArgument().setPath( m_bootclasspath ); | |||
cmd.addArgument( "-bootclasspath" ); | |||
cmd.addArguments( FileUtils.translateCommandline( m_bootclasspath ) ); | |||
} | |||
// add the links arguments | |||
@@ -648,9 +649,9 @@ public class Javadoc | |||
File packageList = new File( packageListLocation, "package-list" ); | |||
if( packageList.exists() ) | |||
{ | |||
cmd.createArgument().setValue( "-linkoffline" ); | |||
cmd.createArgument().setValue( la.getHref() ); | |||
cmd.createArgument().setValue( packageListLocation.getAbsolutePath() ); | |||
cmd.addArgument( "-linkoffline" ); | |||
cmd.addArgument( la.getHref() ); | |||
cmd.addArgument( packageListLocation.getAbsolutePath() ); | |||
} | |||
else | |||
{ | |||
@@ -659,8 +660,8 @@ public class Javadoc | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( "-link" ); | |||
cmd.createArgument().setValue( la.getHref() ); | |||
cmd.addArgument( "-link" ); | |||
cmd.addArgument( la.getHref() ); | |||
} | |||
} | |||
} | |||
@@ -687,9 +688,9 @@ public class Javadoc | |||
{ | |||
String name = grp.substring( 0, space ); | |||
String pkgList = grp.substring( space + 1 ); | |||
cmd.createArgument().setValue( "-group" ); | |||
cmd.createArgument().setValue( name ); | |||
cmd.createArgument().setValue( pkgList ); | |||
cmd.addArgument( "-group" ); | |||
cmd.addArgument( name ); | |||
cmd.addArgument( pkgList ); | |||
} | |||
} | |||
} | |||
@@ -706,9 +707,9 @@ public class Javadoc | |||
{ | |||
throw new TaskException( "The title and packages must be specified for group elements." ); | |||
} | |||
cmd.createArgument().setValue( "-group" ); | |||
cmd.createArgument().setValue( title ); | |||
cmd.createArgument().setValue( packages ); | |||
cmd.addArgument( "-group" ); | |||
cmd.addArgument( title ); | |||
cmd.addArgument( packages ); | |||
} | |||
} | |||
@@ -729,7 +730,7 @@ public class Javadoc | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( name ); | |||
cmd.addArgument( name ); | |||
} | |||
} | |||
@@ -763,7 +764,7 @@ public class Javadoc | |||
if( m_tmpList == null ) | |||
{ | |||
m_tmpList = File.createTempFile( "javadoc", "", getBaseDirectory() ); | |||
cmd.createArgument().setValue( "@" + m_tmpList.getAbsolutePath() ); | |||
cmd.addArgument( "@" + m_tmpList.getAbsolutePath() ); | |||
} | |||
srcListWriter = new PrintWriter( new FileWriter( m_tmpList.getAbsolutePath(), | |||
true ) ); | |||
@@ -780,7 +781,7 @@ public class Javadoc | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( sourceFileName ); | |||
cmd.addArgument( sourceFileName ); | |||
} | |||
} | |||
@@ -800,7 +801,7 @@ public class Javadoc | |||
if( m_packageList != null ) | |||
{ | |||
cmd.createArgument().setValue( "@" + m_packageList ); | |||
cmd.addArgument( "@" + m_packageList ); | |||
} | |||
getLogger().debug( "Javadoc args: " + cmd ); | |||
@@ -873,8 +874,8 @@ public class Javadoc | |||
{ | |||
if( value != null && value.length() != 0 ) | |||
{ | |||
m_command.createArgument().setValue( key ); | |||
m_command.createArgument().setValue( value ); | |||
m_command.addArgument( key ); | |||
m_command.addArgument( value ); | |||
} | |||
else | |||
{ | |||
@@ -886,7 +887,7 @@ public class Javadoc | |||
{ | |||
if( b ) | |||
{ | |||
m_command.createArgument().setValue( arg ); | |||
m_command.addArgument( arg ); | |||
} | |||
} | |||
@@ -969,7 +970,7 @@ public class Javadoc | |||
if( m_useExternalFile ) | |||
{ | |||
m_tmpList = File.createTempFile( "javadoc", "", getBaseDirectory() ); | |||
toExecute.createArgument().setValue( "@" + m_tmpList.getAbsolutePath() ); | |||
toExecute.addArgument( "@" + m_tmpList.getAbsolutePath() ); | |||
packageListWriter = new PrintWriter( new FileWriter( m_tmpList ) ); | |||
} | |||
@@ -1008,7 +1009,7 @@ public class Javadoc | |||
} | |||
else | |||
{ | |||
toExecute.createArgument().setValue( pkgDir ); | |||
toExecute.addArgument( pkgDir ); | |||
} | |||
addedPackages.add( pkgDir ); | |||
} | |||
@@ -105,9 +105,9 @@ public class ANTLR extends Task | |||
* the JVM. | |||
* @see #setFork(boolean) | |||
*/ | |||
public Argument createJvmarg() | |||
public void addJvmarg( final Argument argument ) | |||
{ | |||
return commandline.createVmArgument(); | |||
commandline.addVmArgument( argument ); | |||
} | |||
public void execute() | |||
@@ -122,9 +122,9 @@ public class ANTLR extends Task | |||
//TODO: use ANTLR to parse the grammer file to do this. | |||
if( target.lastModified() > getGeneratedFile().lastModified() ) | |||
{ | |||
commandline.createArgument().setValue( "-o" ); | |||
commandline.createArgument().setValue( outputDirectory.toString() ); | |||
commandline.createArgument().setValue( target.toString() ); | |||
commandline.addArgument( "-o" ); | |||
commandline.addArgument( outputDirectory.toString() ); | |||
commandline.addArgument( target.toString() ); | |||
if( fork ) | |||
{ | |||
@@ -247,13 +247,13 @@ public class Cab | |||
{ | |||
final Commandline cmd = new Commandline(); | |||
cmd.setExecutable( "cabarc" ); | |||
cmd.createArgument().setValue( "-r" ); | |||
cmd.createArgument().setValue( "-p" ); | |||
cmd.addArgument( "-r" ); | |||
cmd.addArgument( "-p" ); | |||
if( !m_compress ) | |||
{ | |||
cmd.createArgument().setValue( "-m" ); | |||
cmd.createArgument().setValue( "none" ); | |||
cmd.addArgument( "-m" ); | |||
cmd.addArgument( "none" ); | |||
} | |||
if( m_options != null ) | |||
@@ -261,9 +261,9 @@ public class Cab | |||
cmd.createArgument().setLine( m_options ); | |||
} | |||
cmd.createArgument().setValue( "n" ); | |||
cmd.createArgument().setFile( m_cabFile ); | |||
cmd.createArgument().setValue( "@" + listFile.getAbsolutePath() ); | |||
cmd.addArgument( "n" ); | |||
cmd.addArgument( m_cabFile ); | |||
cmd.addArgument( "@" + listFile.getAbsolutePath() ); | |||
return cmd; | |||
} | |||
@@ -17,6 +17,7 @@ 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.Path; | |||
import org.apache.tools.ant.util.FileUtils; | |||
/** | |||
* Task to generate JNI header files using javah. This task can take the | |||
@@ -219,7 +220,7 @@ public class Javah | |||
while( tok.hasMoreTokens() ) | |||
{ | |||
final String aClass = tok.nextToken().trim(); | |||
cmd.createArgument().setValue( aClass ); | |||
cmd.addArgument( aClass ); | |||
niceClassList.append( " " + aClass + StringUtil.LINE_SEPARATOR ); | |||
n++; | |||
} | |||
@@ -230,7 +231,7 @@ public class Javah | |||
{ | |||
final ClassArgument arg = (ClassArgument)enum.next(); | |||
final String aClass = arg.getName(); | |||
cmd.createArgument().setValue( aClass ); | |||
cmd.addArgument( aClass ); | |||
niceClassList.append( " " + aClass + StringUtil.LINE_SEPARATOR ); | |||
n++; | |||
} | |||
@@ -256,33 +257,33 @@ public class Javah | |||
if( m_destDir != null ) | |||
{ | |||
cmd.createArgument().setValue( "-d" ); | |||
cmd.createArgument().setFile( m_destDir ); | |||
cmd.addArgument( "-d" ); | |||
cmd.addArgument( m_destDir ); | |||
} | |||
if( m_outputFile != null ) | |||
{ | |||
cmd.createArgument().setValue( "-o" ); | |||
cmd.createArgument().setFile( m_outputFile ); | |||
cmd.addArgument( "-o" ); | |||
cmd.addArgument( m_outputFile ); | |||
} | |||
if( m_classpath != null ) | |||
{ | |||
cmd.createArgument().setValue( "-classpath" ); | |||
cmd.createArgument().setPath( m_classpath ); | |||
cmd.addArgument( "-classpath" ); | |||
cmd.addArguments( FileUtils.translateCommandline( m_classpath ) ); | |||
} | |||
if( m_verbose ) | |||
{ | |||
cmd.createArgument().setValue( "-verbose" ); | |||
cmd.addArgument( "-verbose" ); | |||
} | |||
if( m_old ) | |||
{ | |||
cmd.createArgument().setValue( "-old" ); | |||
cmd.addArgument( "-old" ); | |||
} | |||
if( m_force ) | |||
{ | |||
cmd.createArgument().setValue( "-force" ); | |||
cmd.addArgument( "-force" ); | |||
} | |||
if( m_stubs ) | |||
@@ -292,12 +293,12 @@ public class Javah | |||
final String message = "stubs only available in old mode."; | |||
throw new TaskException( message ); | |||
} | |||
cmd.createArgument().setValue( "-stubs" ); | |||
cmd.addArgument( "-stubs" ); | |||
} | |||
if( m_bootclasspath != null ) | |||
{ | |||
cmd.createArgument().setValue( "-bootclasspath" ); | |||
cmd.createArgument().setPath( m_bootclasspath ); | |||
cmd.addArgument( "-bootclasspath" ); | |||
cmd.addArguments( FileUtils.translateCommandline( m_bootclasspath ) ); | |||
} | |||
logAndAddFilesToCompile( cmd ); | |||
@@ -115,7 +115,7 @@ public class CCMCheck extends Continuus | |||
// ccm co /t .. files | |||
// as specified in the CLEARTOOL.EXE help | |||
commandLine.setExecutable( getCcmCommand() ); | |||
commandLine.createArgument().setValue( getCcmAction() ); | |||
commandLine.addArgument( getCcmAction() ); | |||
checkOptions( commandLine ); | |||
@@ -136,19 +136,19 @@ public class CCMCheck extends Continuus | |||
{ | |||
if( getComment() != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_COMMENT ); | |||
cmd.createArgument().setValue( getComment() ); | |||
cmd.addArgument( FLAG_COMMENT ); | |||
cmd.addArgument( getComment() ); | |||
} | |||
if( getTask() != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_TASK ); | |||
cmd.createArgument().setValue( getTask() ); | |||
cmd.addArgument( FLAG_TASK ); | |||
cmd.addArgument( getTask() ); | |||
}// end of if () | |||
if( getFile() != null ) | |||
{ | |||
cmd.createArgument().setValue( _file.getAbsolutePath() ); | |||
cmd.addArgument( _file.getAbsolutePath() ); | |||
}// end of if () | |||
} | |||
} | |||
@@ -143,8 +143,8 @@ public class CCMCreateTask | |||
//create task ok, set this task as the default one | |||
final Commandline cmd = new Commandline(); | |||
cmd.setExecutable( getCcmCommand() ); | |||
cmd.createArgument().setValue( COMMAND_DEFAULT_TASK ); | |||
cmd.createArgument().setValue( m_task ); | |||
cmd.addArgument( COMMAND_DEFAULT_TASK ); | |||
cmd.addArgument( m_task ); | |||
getLogger().debug( commandLine.toString() ); | |||
@@ -164,7 +164,7 @@ public class CCMCreateTask | |||
// build the command line from what we got the format | |||
// as specified in the CCM.EXE help | |||
commandLine.setExecutable( getCcmCommand() ); | |||
commandLine.createArgument().setValue( getCcmAction() ); | |||
commandLine.addArgument( getCcmAction() ); | |||
checkOptions( commandLine ); | |||
@@ -184,32 +184,32 @@ public class CCMCreateTask | |||
{ | |||
if( m_comment != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_COMMENT ); | |||
cmd.createArgument().setValue( "\"" + m_comment + "\"" ); | |||
cmd.addArgument( FLAG_COMMENT ); | |||
cmd.addArgument( "\"" + m_comment + "\"" ); | |||
} | |||
if( m_platform != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_PLATFORM ); | |||
cmd.createArgument().setValue( m_platform ); | |||
cmd.addArgument( FLAG_PLATFORM ); | |||
cmd.addArgument( m_platform ); | |||
} | |||
if( m_resolver != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_RESOLVER ); | |||
cmd.createArgument().setValue( m_resolver ); | |||
cmd.addArgument( FLAG_RESOLVER ); | |||
cmd.addArgument( m_resolver ); | |||
} | |||
if( m_subSystem != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_SUBSYSTEM ); | |||
cmd.createArgument().setValue( "\"" + m_subSystem + "\"" ); | |||
cmd.addArgument( FLAG_SUBSYSTEM ); | |||
cmd.addArgument( "\"" + m_subSystem + "\"" ); | |||
} | |||
if( m_release != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_RELEASE ); | |||
cmd.createArgument().setValue( m_release ); | |||
cmd.addArgument( FLAG_RELEASE ); | |||
cmd.addArgument( m_release ); | |||
} | |||
} | |||
@@ -81,7 +81,7 @@ public class CCMReconfigure | |||
// build the command line from what we got the format | |||
// as specified in the CCM.EXE help | |||
cmd.setExecutable( getCcmCommand() ); | |||
cmd.createArgument().setValue( getCcmAction() ); | |||
cmd.addArgument( getCcmAction() ); | |||
checkOptions( cmd ); | |||
@@ -100,18 +100,18 @@ public class CCMReconfigure | |||
{ | |||
if( m_recurse == true ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_RECURSE ); | |||
cmd.addArgument( FLAG_RECURSE ); | |||
} | |||
if( m_verbose == true ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_VERBOSE ); | |||
cmd.addArgument( FLAG_VERBOSE ); | |||
} | |||
if( m_ccmProject != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_PROJECT ); | |||
cmd.createArgument().setValue( m_ccmProject ); | |||
cmd.addArgument( FLAG_PROJECT ); | |||
cmd.addArgument( m_ccmProject ); | |||
} | |||
} | |||
} | |||
@@ -335,7 +335,7 @@ public class CCCheckin extends ClearCase | |||
// cleartool checkin [options...] [viewpath ...] | |||
// as specified in the CLEARTOOL.EXE help | |||
commandLine.setExecutable( getClearToolCommand() ); | |||
commandLine.createArgument().setValue( COMMAND_CHECKIN ); | |||
commandLine.addArgument( COMMAND_CHECKIN ); | |||
checkOptions( commandLine ); | |||
@@ -362,8 +362,8 @@ public class CCCheckin extends ClearCase | |||
* Windows filename with a space and it is enclosed in double | |||
* quotes ("). This breaks clearcase. | |||
*/ | |||
cmd.createArgument().setValue( FLAG_COMMENT ); | |||
cmd.createArgument().setValue( getComment() ); | |||
cmd.addArgument( FLAG_COMMENT ); | |||
cmd.addArgument( getComment() ); | |||
} | |||
} | |||
@@ -382,8 +382,8 @@ public class CCCheckin extends ClearCase | |||
* Windows filename with a space and it is enclosed in double | |||
* quotes ("). This breaks clearcase. | |||
*/ | |||
cmd.createArgument().setValue( FLAG_COMMENTFILE ); | |||
cmd.createArgument().setValue( getCommentFile() ); | |||
cmd.addArgument( FLAG_COMMENTFILE ); | |||
cmd.addArgument( getCommentFile() ); | |||
} | |||
} | |||
@@ -408,36 +408,36 @@ public class CCCheckin extends ClearCase | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( FLAG_NOCOMMENT ); | |||
cmd.addArgument( FLAG_NOCOMMENT ); | |||
} | |||
} | |||
if( getNoWarn() ) | |||
{ | |||
// -nwarn | |||
cmd.createArgument().setValue( FLAG_NOWARN ); | |||
cmd.addArgument( FLAG_NOWARN ); | |||
} | |||
if( getPreserveTime() ) | |||
{ | |||
// -ptime | |||
cmd.createArgument().setValue( FLAG_PRESERVETIME ); | |||
cmd.addArgument( FLAG_PRESERVETIME ); | |||
} | |||
if( getKeepCopy() ) | |||
{ | |||
// -keep | |||
cmd.createArgument().setValue( FLAG_KEEPCOPY ); | |||
cmd.addArgument( FLAG_KEEPCOPY ); | |||
} | |||
if( getIdentical() ) | |||
{ | |||
// -identical | |||
cmd.createArgument().setValue( FLAG_IDENTICAL ); | |||
cmd.addArgument( FLAG_IDENTICAL ); | |||
} | |||
// viewpath | |||
cmd.createArgument().setValue( getViewPath() ); | |||
cmd.addArgument( getViewPath() ); | |||
} | |||
} | |||
@@ -423,7 +423,7 @@ public class CCCheckout extends ClearCase | |||
// cleartool checkout [options...] [viewpath ...] | |||
// as specified in the CLEARTOOL.EXE help | |||
commandLine.setExecutable( getClearToolCommand() ); | |||
commandLine.createArgument().setValue( COMMAND_CHECKOUT ); | |||
commandLine.addArgument( COMMAND_CHECKOUT ); | |||
checkOptions( commandLine ); | |||
@@ -450,8 +450,8 @@ public class CCCheckout extends ClearCase | |||
* Windows filename with a space and it is enclosed in double | |||
* quotes ("). This breaks clearcase. | |||
*/ | |||
cmd.createArgument().setValue( FLAG_BRANCH ); | |||
cmd.createArgument().setValue( getBranch() ); | |||
cmd.addArgument( FLAG_BRANCH ); | |||
cmd.addArgument( getBranch() ); | |||
} | |||
} | |||
@@ -470,8 +470,8 @@ public class CCCheckout extends ClearCase | |||
* Windows filename with a space and it is enclosed in double | |||
* quotes ("). This breaks clearcase. | |||
*/ | |||
cmd.createArgument().setValue( FLAG_COMMENT ); | |||
cmd.createArgument().setValue( getComment() ); | |||
cmd.addArgument( FLAG_COMMENT ); | |||
cmd.addArgument( getComment() ); | |||
} | |||
} | |||
@@ -490,8 +490,8 @@ public class CCCheckout extends ClearCase | |||
* Windows filename with a space and it is enclosed in double | |||
* quotes ("). This breaks clearcase. | |||
*/ | |||
cmd.createArgument().setValue( FLAG_COMMENTFILE ); | |||
cmd.createArgument().setValue( getCommentFile() ); | |||
cmd.addArgument( FLAG_COMMENTFILE ); | |||
cmd.addArgument( getCommentFile() ); | |||
} | |||
} | |||
@@ -510,8 +510,8 @@ public class CCCheckout extends ClearCase | |||
* Windows filename with a space and it is enclosed in double | |||
* quotes ("). This breaks clearcase. | |||
*/ | |||
cmd.createArgument().setValue( FLAG_OUT ); | |||
cmd.createArgument().setValue( getOut() ); | |||
cmd.addArgument( FLAG_OUT ); | |||
cmd.addArgument( getOut() ); | |||
} | |||
} | |||
@@ -526,12 +526,12 @@ public class CCCheckout extends ClearCase | |||
if( getReserved() ) | |||
{ | |||
// -reserved | |||
cmd.createArgument().setValue( FLAG_RESERVED ); | |||
cmd.addArgument( FLAG_RESERVED ); | |||
} | |||
else | |||
{ | |||
// -unreserved | |||
cmd.createArgument().setValue( FLAG_UNRESERVED ); | |||
cmd.addArgument( FLAG_UNRESERVED ); | |||
} | |||
if( getOut() != null ) | |||
@@ -544,7 +544,7 @@ public class CCCheckout extends ClearCase | |||
if( getNoData() ) | |||
{ | |||
// -ndata | |||
cmd.createArgument().setValue( FLAG_NODATA ); | |||
cmd.addArgument( FLAG_NODATA ); | |||
} | |||
} | |||
@@ -559,7 +559,7 @@ public class CCCheckout extends ClearCase | |||
if( getVersion() ) | |||
{ | |||
// -version | |||
cmd.createArgument().setValue( FLAG_VERSION ); | |||
cmd.addArgument( FLAG_VERSION ); | |||
} | |||
} | |||
@@ -567,7 +567,7 @@ public class CCCheckout extends ClearCase | |||
if( getNoWarn() ) | |||
{ | |||
// -nwarn | |||
cmd.createArgument().setValue( FLAG_NOWARN ); | |||
cmd.addArgument( FLAG_NOWARN ); | |||
} | |||
if( getComment() != null ) | |||
@@ -584,12 +584,12 @@ public class CCCheckout extends ClearCase | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( FLAG_NOCOMMENT ); | |||
cmd.addArgument( FLAG_NOCOMMENT ); | |||
} | |||
} | |||
// viewpath | |||
cmd.createArgument().setValue( getViewPath() ); | |||
cmd.addArgument( getViewPath() ); | |||
} | |||
} | |||
@@ -127,7 +127,7 @@ public class CCUnCheckout extends ClearCase | |||
// cleartool uncheckout [options...] [viewpath ...] | |||
// as specified in the CLEARTOOL.EXE help | |||
commandLine.setExecutable( getClearToolCommand() ); | |||
commandLine.createArgument().setValue( COMMAND_UNCHECKOUT ); | |||
commandLine.addArgument( COMMAND_UNCHECKOUT ); | |||
checkOptions( commandLine ); | |||
@@ -150,16 +150,16 @@ public class CCUnCheckout extends ClearCase | |||
if( getKeepCopy() ) | |||
{ | |||
// -keep | |||
cmd.createArgument().setValue( FLAG_KEEPCOPY ); | |||
cmd.addArgument( FLAG_KEEPCOPY ); | |||
} | |||
else | |||
{ | |||
// -rm | |||
cmd.createArgument().setValue( FLAG_RM ); | |||
cmd.addArgument( FLAG_RM ); | |||
} | |||
// viewpath | |||
cmd.createArgument().setValue( getViewPath() ); | |||
cmd.addArgument( getViewPath() ); | |||
} | |||
} | |||
@@ -336,7 +336,7 @@ public class CCUpdate extends ClearCase | |||
// cleartool update [options...] [viewpath ...] | |||
// as specified in the CLEARTOOL.EXE help | |||
commandLine.setExecutable( getClearToolCommand() ); | |||
commandLine.createArgument().setValue( COMMAND_UPDATE ); | |||
commandLine.addArgument( COMMAND_UPDATE ); | |||
// Check the command line options | |||
checkOptions( commandLine ); | |||
@@ -371,8 +371,8 @@ public class CCUpdate extends ClearCase | |||
* Windows filename with a space and it is enclosed in double | |||
* quotes ("). This breaks clearcase. | |||
*/ | |||
cmd.createArgument().setValue( FLAG_LOG ); | |||
cmd.createArgument().setValue( getLog() ); | |||
cmd.addArgument( FLAG_LOG ); | |||
cmd.addArgument( getLog() ); | |||
} | |||
} | |||
@@ -387,40 +387,40 @@ public class CCUpdate extends ClearCase | |||
if( getGraphical() ) | |||
{ | |||
// -graphical | |||
cmd.createArgument().setValue( FLAG_GRAPHICAL ); | |||
cmd.addArgument( FLAG_GRAPHICAL ); | |||
} | |||
else | |||
{ | |||
if( getOverwrite() ) | |||
{ | |||
// -overwrite | |||
cmd.createArgument().setValue( FLAG_OVERWRITE ); | |||
cmd.addArgument( FLAG_OVERWRITE ); | |||
} | |||
else | |||
{ | |||
if( getRename() ) | |||
{ | |||
// -rename | |||
cmd.createArgument().setValue( FLAG_RENAME ); | |||
cmd.addArgument( FLAG_RENAME ); | |||
} | |||
else | |||
{ | |||
// -noverwrite | |||
cmd.createArgument().setValue( FLAG_NOVERWRITE ); | |||
cmd.addArgument( FLAG_NOVERWRITE ); | |||
} | |||
} | |||
if( getCurrentTime() ) | |||
{ | |||
// -ctime | |||
cmd.createArgument().setValue( FLAG_CURRENTTIME ); | |||
cmd.addArgument( FLAG_CURRENTTIME ); | |||
} | |||
else | |||
{ | |||
if( getPreserveTime() ) | |||
{ | |||
// -ptime | |||
cmd.createArgument().setValue( FLAG_PRESERVETIME ); | |||
cmd.addArgument( FLAG_PRESERVETIME ); | |||
} | |||
} | |||
@@ -429,7 +429,7 @@ public class CCUpdate extends ClearCase | |||
} | |||
// viewpath | |||
cmd.createArgument().setValue( getViewPath() ); | |||
cmd.addArgument( getViewPath() ); | |||
} | |||
} | |||
@@ -125,7 +125,7 @@ public class NetCommand | |||
{ | |||
if( argument != null && argument.length() != 0 ) | |||
{ | |||
_commandLine.createArgument().setValue( argument ); | |||
_commandLine.addArgument( argument ); | |||
} | |||
} | |||
@@ -23,6 +23,7 @@ import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler; | |||
import org.apache.tools.ant.types.Argument; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.Path; | |||
import org.apache.tools.ant.util.FileUtils; | |||
/** | |||
* BorlandDeploymentTool is dedicated to the Borland Application Server 4.5 and | |||
@@ -392,24 +393,24 @@ public class BorlandDeploymentTool | |||
//debug ? | |||
if( java2iiopdebug ) | |||
{ | |||
cmd.createArgument().setValue( "-VBJdebug" ); | |||
cmd.addArgument( "-VBJdebug" ); | |||
}// end of if () | |||
//set the classpath | |||
cmd.createArgument().setValue( "-VBJclasspath" ); | |||
cmd.createArgument().setPath( getCombinedClasspath() ); | |||
cmd.addArgument( "-VBJclasspath" ); | |||
cmd.addArguments( FileUtils.translateCommandline( getCombinedClasspath() ) ); | |||
//list file | |||
cmd.createArgument().setValue( "-list_files" ); | |||
cmd.addArgument( "-list_files" ); | |||
//no TIE classes | |||
cmd.createArgument().setValue( "-no_tie" ); | |||
cmd.addArgument( "-no_tie" ); | |||
//root dir | |||
cmd.createArgument().setValue( "-root_dir" ); | |||
cmd.createArgument().setValue( getConfig().srcDir.getAbsolutePath() ); | |||
cmd.addArgument( "-root_dir" ); | |||
cmd.addArgument( getConfig().srcDir.getAbsolutePath() ); | |||
//compiling order | |||
cmd.createArgument().setValue( "-compile" ); | |||
cmd.addArgument( "-compile" ); | |||
//add the home class | |||
while( ithomes.hasNext() ) | |||
{ | |||
cmd.createArgument().setValue( ithomes.next().toString() ); | |||
cmd.addArgument( ithomes.next().toString() ); | |||
} | |||
return cmd; | |||
} | |||
@@ -178,20 +178,20 @@ public class BorlandGenerateClient extends Task | |||
{ | |||
final Commandline cmd = new Commandline(); | |||
cmd.setExecutable( "iastool" ); | |||
cmd.createArgument().setValue( "generateclient" ); | |||
cmd.addArgument( "generateclient" ); | |||
if( debug ) | |||
{ | |||
cmd.createArgument().setValue( "-trace" ); | |||
cmd.addArgument( "-trace" ); | |||
} | |||
cmd.createArgument().setValue( "-short" ); | |||
cmd.createArgument().setValue( "-jarfile" ); | |||
cmd.addArgument( "-short" ); | |||
cmd.addArgument( "-jarfile" ); | |||
// ejb jar file | |||
cmd.createArgument().setValue( ejbjarfile.getAbsolutePath() ); | |||
cmd.addArgument( ejbjarfile.getAbsolutePath() ); | |||
//client jar file | |||
cmd.createArgument().setValue( "-single" ); | |||
cmd.createArgument().setValue( "-clientjarfile" ); | |||
cmd.createArgument().setValue( clientjarfile.getAbsolutePath() ); | |||
cmd.addArgument( "-single" ); | |||
cmd.addArgument( "-clientjarfile" ); | |||
cmd.addArgument( clientjarfile.getAbsolutePath() ); | |||
return cmd; | |||
} | |||
@@ -137,7 +137,7 @@ public class JJTree extends Task | |||
{ | |||
String name = (String)iter.nextElement(); | |||
Object value = optionalAttrs.get( name ); | |||
cmdl.createArgument().setValue( "-" + name + ":" + value.toString() ); | |||
cmdl.addArgument( "-" + name + ":" + value.toString() ); | |||
} | |||
if( target == null || !target.isFile() ) | |||
@@ -156,8 +156,7 @@ public class JJTree extends Task | |||
} | |||
// convert backslashes to slashes, otherwise jjtree will put this as | |||
// comments and this seems to confuse javacc | |||
cmdl.createArgument().setValue( | |||
"-OUTPUT_DIRECTORY:" + outputDirectory.getAbsolutePath().replace( '\\', '/' ) ); | |||
cmdl.addArgument( "-OUTPUT_DIRECTORY:" + outputDirectory.getAbsolutePath().replace( '\\', '/' ) ); | |||
String targetName = target.getName(); | |||
final File javaFile = new File( outputDirectory, | |||
@@ -167,7 +166,7 @@ public class JJTree extends Task | |||
getLogger().info( "Target is already built - skipping (" + target + ")" ); | |||
return; | |||
} | |||
cmdl.createArgument().setValue( target.getAbsolutePath() ); | |||
cmdl.addArgument( target.getAbsolutePath() ); | |||
if( javaccHome == null || !javaccHome.isDirectory() ) | |||
{ | |||
@@ -177,9 +176,8 @@ public class JJTree extends Task | |||
classpath.addLocation( new File( javaccHome, "JavaCC.zip" ) ); | |||
classpath.addJavaRuntime(); | |||
final Argument arg = cmdl.createVmArgument(); | |||
arg.setValue( "-mx140M" ); | |||
arg.setValue( "-Dinstall.root=" + javaccHome.getAbsolutePath() ); | |||
cmdl.addVmArgument( "-mx140M" ); | |||
cmdl.addVmArgument( "-Dinstall.root=" + javaccHome.getAbsolutePath() ); | |||
final Execute2 exe = new Execute2(); | |||
setupLogger( exe ); | |||
@@ -193,7 +193,7 @@ public class JavaCC extends Task | |||
{ | |||
String name = (String)iter.nextElement(); | |||
Object value = optionalAttrs.get( name ); | |||
cmdl.createArgument().setValue( "-" + name + ":" + value.toString() ); | |||
cmdl.addArgument( "-" + name + ":" + value.toString() ); | |||
} | |||
// check the target is a file | |||
@@ -211,8 +211,7 @@ public class JavaCC extends Task | |||
{ | |||
throw new TaskException( "Outputdir not a directory." ); | |||
} | |||
cmdl.createArgument().setValue( | |||
"-OUTPUT_DIRECTORY:" + outputDirectory.getAbsolutePath() ); | |||
cmdl.addArgument( "-OUTPUT_DIRECTORY:" + outputDirectory.getAbsolutePath() ); | |||
// determine if the generated java file is up-to-date | |||
final File javaFile = getOutputJavaFile( outputDirectory, target ); | |||
@@ -221,7 +220,7 @@ public class JavaCC extends Task | |||
getLogger().debug( "Target is already built - skipping (" + target + ")" ); | |||
return; | |||
} | |||
cmdl.createArgument().setValue( target.getAbsolutePath() ); | |||
cmdl.addArgument( target.getAbsolutePath() ); | |||
if( javaccHome == null || !javaccHome.isDirectory() ) | |||
{ | |||
@@ -231,9 +230,8 @@ public class JavaCC extends Task | |||
classpath.addLocation( new File( javaccHome, "JavaCC.zip" ) ); | |||
classpath.addJavaRuntime(); | |||
final Argument arg = cmdl.createVmArgument(); | |||
arg.setValue( "-mx140M" ); | |||
arg.setValue( "-Dinstall.root=" + javaccHome.getAbsolutePath() ); | |||
cmdl.addVmArgument( "-mx140M" ); | |||
cmdl.addVmArgument( "-Dinstall.root=" + javaccHome.getAbsolutePath() ); | |||
runCommand( cmdl.getCommandline() ); | |||
} | |||
@@ -137,19 +137,6 @@ public class JDependTask | |||
return path; | |||
} | |||
/** | |||
* Create a new JVM argument. Ignored if no JVM is forked. | |||
* | |||
* @param commandline Description of Parameter | |||
* @return create a new JVM argument so that any argument can be passed to | |||
* the JVM. | |||
* @see #setFork(boolean) | |||
*/ | |||
public Argument createJvmarg( final CommandlineJava commandline ) | |||
{ | |||
return commandline.createVmArgument(); | |||
} | |||
/** | |||
* Maybe creates a nested classpath element. | |||
*/ | |||
@@ -226,16 +213,16 @@ public class JDependTask | |||
// hope it will be reviewed by anybody competent | |||
if( m_compileClasspath.toString().length() > 0 ) | |||
{ | |||
createJvmarg( commandline ).setValue( "-classpath" ); | |||
createJvmarg( commandline ).setValue( m_compileClasspath.toString() ); | |||
commandline.addVmArgument( "-classpath" ); | |||
commandline.addVmArgument( m_compileClasspath.toString() ); | |||
} | |||
if( m_outputFile != null ) | |||
{ | |||
// having a space between the file and its path causes commandline to add quotes " | |||
// around the argument thus making JDepend not taking it into account. Thus we split it in two | |||
commandline.createArgument().setValue( "-file" ); | |||
commandline.createArgument().setValue( m_outputFile.getPath() ); | |||
commandline.addArgument( "-file" ); | |||
commandline.addArgument( m_outputFile.getPath() ); | |||
// we have to find a cleaner way to put this output | |||
} | |||
@@ -247,7 +234,7 @@ public class JDependTask | |||
// not necessary as JDepend would fail, but why loose some time? | |||
if( !f.exists() || !f.isDirectory() ) | |||
throw new TaskException( "\"" + f.getPath() + "\" does not represent a valid directory. JDepend would fail." ); | |||
commandline.createArgument().setValue( f.getPath() ); | |||
commandline.addArgument( f.getPath() ); | |||
} | |||
final Execute2 exe = new Execute2(); | |||
@@ -66,7 +66,7 @@ public abstract class DefaultCompilerAdapter | |||
while( enum.hasNext() ) | |||
{ | |||
String arg = (String)enum.next(); | |||
cmd.createArgument().setValue( arg ); | |||
cmd.addArgument( arg ); | |||
niceSourceList.append( " " + arg + StringUtil.LINE_SEPARATOR ); | |||
} | |||
@@ -68,36 +68,36 @@ public class JasperC | |||
JspC jspc = getJspc(); | |||
if( jspc.getDestdir() != null ) | |||
{ | |||
cmd.createArgument().setValue( "-d" ); | |||
cmd.createArgument().setFile( jspc.getDestdir() ); | |||
cmd.addArgument( "-d" ); | |||
cmd.addArgument( jspc.getDestdir() ); | |||
} | |||
if( jspc.getPackage() != null ) | |||
{ | |||
cmd.createArgument().setValue( "-p" ); | |||
cmd.createArgument().setValue( jspc.getPackage() ); | |||
cmd.addArgument( "-p" ); | |||
cmd.addArgument( jspc.getPackage() ); | |||
} | |||
if( jspc.getVerbose() != 0 ) | |||
{ | |||
cmd.createArgument().setValue( "-v" + jspc.getVerbose() ); | |||
cmd.addArgument( "-v" + jspc.getVerbose() ); | |||
} | |||
if( jspc.isMapped() ) | |||
{ | |||
cmd.createArgument().setValue( "-mapped" ); | |||
cmd.addArgument( "-mapped" ); | |||
} | |||
if( jspc.getIeplugin() != null ) | |||
{ | |||
cmd.createArgument().setValue( "-ieplugin" ); | |||
cmd.createArgument().setValue( jspc.getIeplugin() ); | |||
cmd.addArgument( "-ieplugin" ); | |||
cmd.addArgument( jspc.getIeplugin() ); | |||
} | |||
if( jspc.getUriroot() != null ) | |||
{ | |||
cmd.createArgument().setValue( "-uriroot" ); | |||
cmd.createArgument().setValue( jspc.getUriroot().toString() ); | |||
cmd.addArgument( "-uriroot" ); | |||
cmd.addArgument( jspc.getUriroot().toString() ); | |||
} | |||
if( jspc.getUribase() != null ) | |||
{ | |||
cmd.createArgument().setValue( "-uribase" ); | |||
cmd.createArgument().setValue( jspc.getUribase().toString() ); | |||
cmd.addArgument( "-uribase" ); | |||
cmd.addArgument( jspc.getUribase().toString() ); | |||
} | |||
logAndAddFilesToCompile( getJspc(), getJspc().getCompileList(), cmd ); | |||
return cmd; | |||
@@ -265,7 +265,7 @@ public class JUnitTask extends Task | |||
*/ | |||
public void setMaxmemory( String max ) | |||
{ | |||
createJvmarg().setValue( "-Xmx" + max ); | |||
commandline.addVmArgument( "-Xmx" + max ); | |||
} | |||
/** | |||
@@ -361,9 +361,9 @@ public class JUnitTask extends Task | |||
* the JVM. | |||
* @see #setFork(boolean) | |||
*/ | |||
public Argument createJvmarg() | |||
public void addJvmarg( final Argument argument ) | |||
{ | |||
return commandline.createVmArgument(); | |||
commandline.addVmArgument( argument ); | |||
} | |||
/** | |||
@@ -596,14 +596,14 @@ public class JUnitTask extends Task | |||
CommandlineJava cmd = commandline;//(CommandlineJava)commandline.clone(); | |||
cmd.setClassname( "org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" ); | |||
cmd.createArgument().setValue( test.getName() ); | |||
cmd.createArgument().setValue( "filtertrace=" + test.getFiltertrace() ); | |||
cmd.createArgument().setValue( "haltOnError=" + test.getHaltonerror() ); | |||
cmd.createArgument().setValue( "haltOnFailure=" + test.getHaltonfailure() ); | |||
cmd.addArgument( test.getName() ); | |||
cmd.addArgument( "filtertrace=" + test.getFiltertrace() ); | |||
cmd.addArgument( "haltOnError=" + test.getHaltonerror() ); | |||
cmd.addArgument( "haltOnFailure=" + test.getHaltonfailure() ); | |||
if( summary ) | |||
{ | |||
getLogger().info( "Running " + test.getName() ); | |||
cmd.createArgument().setValue( "formatter=org.apache.tools.ant.taskdefs.optional.junit.SummaryJUnitResultFormatter" ); | |||
cmd.addArgument( "formatter=org.apache.tools.ant.taskdefs.optional.junit.SummaryJUnitResultFormatter" ); | |||
} | |||
StringBuffer formatterArg = new StringBuffer( 128 ); | |||
@@ -619,13 +619,13 @@ public class JUnitTask extends Task | |||
formatterArg.append( "," ); | |||
formatterArg.append( outFile ); | |||
} | |||
cmd.createArgument().setValue( formatterArg.toString() ); | |||
cmd.addArgument( formatterArg.toString() ); | |||
formatterArg.setLength( 0 ); | |||
} | |||
// Create a temporary file to pass the Ant properties to the forked test | |||
File propsFile = new File( "junit" + ( new Random( System.currentTimeMillis() ) ).nextLong() + ".properties" ); | |||
cmd.createArgument().setValue( "propsfile=" + propsFile.getAbsolutePath() ); | |||
cmd.addArgument( "propsfile=" + propsFile.getAbsolutePath() ); | |||
Hashtable p = getProject().getProperties(); | |||
Properties props = new Properties(); | |||
for( Enumeration enum = p.keys(); enum.hasMoreElements(); ) | |||
@@ -116,7 +116,7 @@ public abstract class AbstractMetamataTask | |||
*/ | |||
public void setMaxmemory( String max ) | |||
{ | |||
createJvmarg().setValue( "-Xmx" + max ); | |||
m_cmdl.addVmArgument( "-Xmx" + max ); | |||
} | |||
/** | |||
@@ -150,9 +150,9 @@ public abstract class AbstractMetamataTask | |||
/** | |||
* Creates a nested jvmarg element. | |||
*/ | |||
public Argument createJvmarg() | |||
public void addJvmarg( final Argument argument ) | |||
{ | |||
return m_cmdl.createVmArgument(); | |||
m_cmdl.addVmArgument( argument ); | |||
} | |||
/** | |||
@@ -200,8 +200,7 @@ public abstract class AbstractMetamataTask | |||
classPath.addLocation( jar ); | |||
// set the metamata.home property | |||
final Argument vmArgs = m_cmdl.createVmArgument(); | |||
vmArgs.setValue( "-Dmetamata.home=" + m_metamataHome.getAbsolutePath() ); | |||
m_cmdl.addVmArgument( "-Dmetamata.home=" + m_metamataHome.getAbsolutePath() ); | |||
// retrieve all the files we want to scan | |||
m_includedFiles = scanFileSets(); | |||
@@ -98,7 +98,7 @@ public class MParse | |||
*/ | |||
public void setMaxmemory( String max ) | |||
{ | |||
createJvmarg().setValue( "-Xmx" + max ); | |||
m_cmdl.addVmArgument( "-Xmx" + max ); | |||
} | |||
/** | |||
@@ -147,12 +147,10 @@ public class MParse | |||
/** | |||
* Creates a nested jvmarg element. | |||
* | |||
* @return Description of the Returned Value | |||
*/ | |||
public Argument createJvmarg() | |||
public void addJvmarg( final Argument argument ) | |||
{ | |||
return m_cmdl.createVmArgument(); | |||
m_cmdl.addVmArgument( argument ); | |||
} | |||
/** | |||
@@ -207,8 +205,7 @@ public class MParse | |||
} | |||
// set the metamata.home property | |||
final Argument vmArgs = m_cmdl.createVmArgument(); | |||
vmArgs.setValue( "-Dmetamata.home=" + m_metahome.getAbsolutePath() ); | |||
m_cmdl.addVmArgument( "-Dmetamata.home=" + m_metahome.getAbsolutePath() ); | |||
// write all the options to a temp file and use it ro run the process | |||
String[] options = getOptions(); | |||
@@ -140,15 +140,15 @@ public abstract class P4Base | |||
//Check API for these - it's how CVS does it... | |||
if( m_p4Port != null && m_p4Port.length() != 0 ) | |||
{ | |||
cmd.createArgument().setValue( m_p4Port ); | |||
cmd.addArgument( m_p4Port ); | |||
} | |||
if( m_p4User != null && m_p4User.length() != 0 ) | |||
{ | |||
cmd.createArgument().setValue( m_p4User ); | |||
cmd.addArgument( m_p4User ); | |||
} | |||
if( m_p4Client != null && m_p4Client.length() != 0 ) | |||
{ | |||
cmd.createArgument().setValue( m_p4Client ); | |||
cmd.addArgument( m_p4Client ); | |||
} | |||
cmd.createArgument().setLine( command ); | |||
@@ -216,28 +216,28 @@ public class Pvcs | |||
if( m_force ) | |||
{ | |||
cmd.createArgument().setValue( "-Y" ); | |||
cmd.addArgument( "-Y" ); | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( "-N" ); | |||
cmd.addArgument( "-N" ); | |||
} | |||
if( null != m_promotiongroup ) | |||
{ | |||
cmd.createArgument().setValue( "-G" + m_promotiongroup ); | |||
cmd.addArgument( "-G" + m_promotiongroup ); | |||
} | |||
else if( null != m_label ) | |||
{ | |||
cmd.createArgument().setValue( "-r" + m_label ); | |||
cmd.addArgument( "-r" + m_label ); | |||
} | |||
if( m_updateOnly ) | |||
{ | |||
cmd.createArgument().setValue( "-U" ); | |||
cmd.addArgument( "-U" ); | |||
} | |||
cmd.createArgument().setValue( "@" + filelist.getAbsolutePath() ); | |||
cmd.addArgument( "@" + filelist.getAbsolutePath() ); | |||
return cmd; | |||
} | |||
@@ -319,18 +319,18 @@ public class Pvcs | |||
final Commandline cmd = new Commandline(); | |||
cmd.setExecutable( getExecutable( PCLI_EXE ) ); | |||
cmd.createArgument().setValue( "lvf" ); | |||
cmd.createArgument().setValue( "-z" ); | |||
cmd.createArgument().setValue( "-aw" ); | |||
cmd.addArgument( "lvf" ); | |||
cmd.addArgument( "-z" ); | |||
cmd.addArgument( "-aw" ); | |||
if( m_workspace != null ) | |||
{ | |||
cmd.createArgument().setValue( "-sp" + m_workspace ); | |||
cmd.addArgument( "-sp" + m_workspace ); | |||
} | |||
cmd.createArgument().setValue( "-pr" + m_repository ); | |||
cmd.addArgument( "-pr" + m_repository ); | |||
if( m_pvcsProject != null ) | |||
{ | |||
cmd.createArgument().setValue( m_pvcsProject ); | |||
cmd.addArgument( m_pvcsProject ); | |||
} | |||
if( !m_pvcsProjects.isEmpty() ) | |||
@@ -345,7 +345,7 @@ public class Pvcs | |||
final String message = "name is a required attribute of pvcsproject"; | |||
throw new TaskException( message ); | |||
} | |||
cmd.createArgument().setValue( name ); | |||
cmd.addArgument( name ); | |||
} | |||
} | |||
return cmd; | |||
@@ -109,9 +109,9 @@ public class CovMerge extends Task | |||
cmdl.setExecutable( new File( home, "jpcovmerge" ).getAbsolutePath() ); | |||
if( verbose ) | |||
{ | |||
cmdl.createArgument().setValue( "-v" ); | |||
cmdl.addArgument( "-v" ); | |||
} | |||
cmdl.createArgument().setValue( "-jp_paramfile=" + paramfile.getAbsolutePath() ); | |||
cmdl.addArgument( "-jp_paramfile=" + paramfile.getAbsolutePath() ); | |||
final Execute2 exe = new Execute2(); | |||
setupLogger( exe ); | |||
@@ -242,7 +242,7 @@ public class CovReport extends Task | |||
String[] params = getParameters(); | |||
for( int i = 0; i < params.length; i++ ) | |||
{ | |||
cmdl.createArgument().setValue( params[ i ] ); | |||
cmdl.addArgument( params[ i ] ); | |||
} | |||
// use the custom handler for stdin issues | |||
@@ -172,12 +172,10 @@ public class Coverage | |||
/** | |||
* the command arguments | |||
* | |||
* @return Description of the Returned Value | |||
*/ | |||
public Argument createArg() | |||
public void addArg( final Argument argument ) | |||
{ | |||
return cmdlJava.createArgument(); | |||
cmdlJava.addArgument( argument ); | |||
} | |||
/** | |||
@@ -203,9 +201,9 @@ public class Coverage | |||
* | |||
* @return Description of the Returned Value | |||
*/ | |||
public Argument createJvmarg() | |||
public void addJvmarg( final Argument argument ) | |||
{ | |||
return cmdlJava.createVmArgument(); | |||
cmdlJava.addVmArgument( argument ); | |||
} | |||
public Socket createSocket() | |||
@@ -249,7 +247,7 @@ public class Coverage | |||
{ | |||
// we need to run Coverage from his directory due to dll/jar issues | |||
cmdl.setExecutable( new File( m_home, "jplauncher" ).getAbsolutePath() ); | |||
cmdl.createArgument().setValue( "-jp_input=" + paramfile.getAbsolutePath() ); | |||
cmdl.addArgument( "-jp_input=" + paramfile.getAbsolutePath() ); | |||
// use the custom handler for stdin issues | |||
final Execute2 exe = new Execute2(); | |||
@@ -187,7 +187,7 @@ public abstract class MSVSS extends Task | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( FLAG_LOGIN + m_vssLogin ); | |||
cmd.addArgument( FLAG_LOGIN + m_vssLogin ); | |||
} | |||
} | |||
@@ -99,20 +99,20 @@ public class MSVSSCHECKIN extends MSVSS | |||
if( m_AutoResponse == null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_AUTORESPONSE_DEF ); | |||
cmd.addArgument( FLAG_AUTORESPONSE_DEF ); | |||
} | |||
else if( m_AutoResponse.equalsIgnoreCase( "Y" ) ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_AUTORESPONSE_YES ); | |||
cmd.addArgument( FLAG_AUTORESPONSE_YES ); | |||
} | |||
else if( m_AutoResponse.equalsIgnoreCase( "N" ) ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_AUTORESPONSE_NO ); | |||
cmd.addArgument( FLAG_AUTORESPONSE_NO ); | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( FLAG_AUTORESPONSE_DEF ); | |||
cmd.addArgument( FLAG_AUTORESPONSE_DEF ); | |||
}// end of else | |||
} | |||
@@ -157,7 +157,7 @@ public class MSVSSCHECKIN extends MSVSS | |||
getLogger().info( "Created dir: " + dir.getAbsolutePath() ); | |||
} | |||
cmd.createArgument().setValue( FLAG_OVERRIDE_WORKING_DIR + m_LocalPath ); | |||
cmd.addArgument( FLAG_OVERRIDE_WORKING_DIR + m_LocalPath ); | |||
} | |||
} | |||
@@ -172,7 +172,7 @@ public class MSVSSCHECKIN extends MSVSS | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( FLAG_RECURSION ); | |||
cmd.addArgument( FLAG_RECURSION ); | |||
} | |||
} | |||
@@ -187,7 +187,7 @@ public class MSVSSCHECKIN extends MSVSS | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( FLAG_WRITABLE ); | |||
cmd.addArgument( FLAG_WRITABLE ); | |||
} | |||
} | |||
@@ -218,10 +218,10 @@ public class MSVSSCHECKIN extends MSVSS | |||
// ss Checkin VSS items [-H] [-C] [-I-] [-N] [-O] [-R] [-W] [-Y] [-?] | |||
// as specified in the SS.EXE help | |||
commandLine.setExecutable( getSSCommand() ); | |||
commandLine.createArgument().setValue( COMMAND_CHECKIN ); | |||
commandLine.addArgument( COMMAND_CHECKIN ); | |||
// VSS items | |||
commandLine.createArgument().setValue( getVsspath() ); | |||
commandLine.addArgument( getVsspath() ); | |||
// -GL | |||
getLocalpathCommand( commandLine ); | |||
// -I- or -I-Y or -I-N | |||
@@ -233,7 +233,7 @@ public class MSVSSCHECKIN extends MSVSS | |||
// -Y | |||
getLoginCommand( commandLine ); | |||
// -C | |||
commandLine.createArgument().setValue( "-C" + getComment() ); | |||
commandLine.addArgument( "-C" + getComment() ); | |||
result = run( commandLine ); | |||
if( result != 0 ) | |||
@@ -136,20 +136,20 @@ public class MSVSSCHECKOUT extends MSVSS | |||
if( m_AutoResponse == null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_AUTORESPONSE_DEF ); | |||
cmd.addArgument( FLAG_AUTORESPONSE_DEF ); | |||
} | |||
else if( m_AutoResponse.equalsIgnoreCase( "Y" ) ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_AUTORESPONSE_YES ); | |||
cmd.addArgument( FLAG_AUTORESPONSE_YES ); | |||
} | |||
else if( m_AutoResponse.equalsIgnoreCase( "N" ) ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_AUTORESPONSE_NO ); | |||
cmd.addArgument( FLAG_AUTORESPONSE_NO ); | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( FLAG_AUTORESPONSE_DEF ); | |||
cmd.addArgument( FLAG_AUTORESPONSE_DEF ); | |||
}// end of else | |||
} | |||
@@ -184,7 +184,7 @@ public class MSVSSCHECKOUT extends MSVSS | |||
getLogger().info( "Created dir: " + dir.getAbsolutePath() ); | |||
} | |||
cmd.createArgument().setValue( FLAG_OVERRIDE_WORKING_DIR + m_LocalPath ); | |||
cmd.addArgument( FLAG_OVERRIDE_WORKING_DIR + m_LocalPath ); | |||
} | |||
} | |||
@@ -199,7 +199,7 @@ public class MSVSSCHECKOUT extends MSVSS | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( FLAG_RECURSION ); | |||
cmd.addArgument( FLAG_RECURSION ); | |||
} | |||
} | |||
@@ -214,15 +214,15 @@ public class MSVSSCHECKOUT extends MSVSS | |||
if( m_Version != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_VERSION + m_Version ); | |||
cmd.addArgument( FLAG_VERSION + m_Version ); | |||
} | |||
else if( m_Date != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_VERSION_DATE + m_Date ); | |||
cmd.addArgument( FLAG_VERSION_DATE + m_Date ); | |||
} | |||
else if( m_Label != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_VERSION_LABEL + m_Label ); | |||
cmd.addArgument( FLAG_VERSION_LABEL + m_Label ); | |||
} | |||
} | |||
@@ -253,10 +253,10 @@ public class MSVSSCHECKOUT extends MSVSS | |||
// ss Checkout VSS items [-G] [-C] [-H] [-I-] [-N] [-O] [-R] [-V] [-Y] [-?] | |||
// as specified in the SS.EXE help | |||
commandLine.setExecutable( getSSCommand() ); | |||
commandLine.createArgument().setValue( COMMAND_CHECKOUT ); | |||
commandLine.addArgument( COMMAND_CHECKOUT ); | |||
// VSS items | |||
commandLine.createArgument().setValue( getVsspath() ); | |||
commandLine.addArgument( getVsspath() ); | |||
// -GL | |||
getLocalpathCommand( commandLine ); | |||
// -I- or -I-Y or -I-N | |||
@@ -344,20 +344,20 @@ public class MSVSSGET extends MSVSS | |||
if( m_AutoResponse == null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_AUTORESPONSE_DEF ); | |||
cmd.addArgument( FLAG_AUTORESPONSE_DEF ); | |||
} | |||
else if( m_AutoResponse.equalsIgnoreCase( "Y" ) ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_AUTORESPONSE_YES ); | |||
cmd.addArgument( FLAG_AUTORESPONSE_YES ); | |||
} | |||
else if( m_AutoResponse.equalsIgnoreCase( "N" ) ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_AUTORESPONSE_NO ); | |||
cmd.addArgument( FLAG_AUTORESPONSE_NO ); | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( FLAG_AUTORESPONSE_DEF ); | |||
cmd.addArgument( FLAG_AUTORESPONSE_DEF ); | |||
}// end of else | |||
} | |||
@@ -392,7 +392,7 @@ public class MSVSSGET extends MSVSS | |||
getLogger().info( "Created dir: " + dir.getAbsolutePath() ); | |||
} | |||
cmd.createArgument().setValue( FLAG_OVERRIDE_WORKING_DIR + m_LocalPath ); | |||
cmd.addArgument( FLAG_OVERRIDE_WORKING_DIR + m_LocalPath ); | |||
} | |||
} | |||
@@ -400,7 +400,7 @@ public class MSVSSGET extends MSVSS | |||
{ | |||
if( m_Quiet ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_QUIET ); | |||
cmd.addArgument( FLAG_QUIET ); | |||
} | |||
} | |||
@@ -415,7 +415,7 @@ public class MSVSSGET extends MSVSS | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( FLAG_RECURSION ); | |||
cmd.addArgument( FLAG_RECURSION ); | |||
} | |||
} | |||
@@ -430,15 +430,15 @@ public class MSVSSGET extends MSVSS | |||
if( m_Version != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_VERSION + m_Version ); | |||
cmd.addArgument( FLAG_VERSION + m_Version ); | |||
} | |||
else if( m_Date != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_VERSION_DATE + m_Date ); | |||
cmd.addArgument( FLAG_VERSION_DATE + m_Date ); | |||
} | |||
else if( m_Label != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_VERSION_LABEL + m_Label ); | |||
cmd.addArgument( FLAG_VERSION_LABEL + m_Label ); | |||
} | |||
} | |||
@@ -453,7 +453,7 @@ public class MSVSSGET extends MSVSS | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( FLAG_WRITABLE ); | |||
cmd.addArgument( FLAG_WRITABLE ); | |||
} | |||
} | |||
@@ -484,10 +484,10 @@ public class MSVSSGET extends MSVSS | |||
// ss Get VSS items [-G] [-H] [-I-] [-N] [-O] [-R] [-V] [-W] [-Y] [-?] | |||
// as specified in the SS.EXE help | |||
commandLine.setExecutable( getSSCommand() ); | |||
commandLine.createArgument().setValue( COMMAND_GET ); | |||
commandLine.addArgument( COMMAND_GET ); | |||
// VSS items | |||
commandLine.createArgument().setValue( getVsspath() ); | |||
commandLine.addArgument( getVsspath() ); | |||
// -GL | |||
getLocalpathCommand( commandLine ); | |||
// -I- or -I-Y or -I-N | |||
@@ -237,13 +237,13 @@ public class MSVSSHISTORY extends MSVSS | |||
// ss History elements [-H] [-L] [-N] [-O] [-V] [-Y] [-#] [-?] | |||
// as specified in the SS.EXE help | |||
commandLine.setExecutable( getSSCommand() ); | |||
commandLine.createArgument().setValue( COMMAND_HISTORY ); | |||
commandLine.addArgument( COMMAND_HISTORY ); | |||
// VSS items | |||
commandLine.createArgument().setValue( getVsspath() ); | |||
commandLine.addArgument( getVsspath() ); | |||
// -I- | |||
commandLine.createArgument().setValue( "-I-" );// ignore all errors | |||
commandLine.addArgument( "-I-" );// ignore all errors | |||
// -V | |||
// Label an existing file or project version | |||
@@ -253,13 +253,13 @@ public class MSVSSHISTORY extends MSVSS | |||
// -R | |||
if( m_Recursive ) | |||
{ | |||
commandLine.createArgument().setValue( FLAG_RECURSION ); | |||
commandLine.addArgument( FLAG_RECURSION ); | |||
} | |||
// -B / -D / -F- | |||
if( m_Style.length() > 0 ) | |||
{ | |||
commandLine.createArgument().setValue( m_Style ); | |||
commandLine.addArgument( m_Style ); | |||
} | |||
// -Y | |||
@@ -288,7 +288,7 @@ public class MSVSSHISTORY extends MSVSS | |||
{ | |||
if( m_OutputFileName != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_OUTPUT + m_OutputFileName ); | |||
cmd.addArgument( FLAG_OUTPUT + m_OutputFileName ); | |||
} | |||
} | |||
@@ -303,7 +303,7 @@ public class MSVSSHISTORY extends MSVSS | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( FLAG_RECURSION ); | |||
cmd.addArgument( FLAG_RECURSION ); | |||
} | |||
} | |||
@@ -316,7 +316,7 @@ public class MSVSSHISTORY extends MSVSS | |||
{ | |||
if( m_User != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_USER + m_User ); | |||
cmd.addArgument( FLAG_USER + m_User ); | |||
} | |||
} | |||
@@ -336,7 +336,7 @@ public class MSVSSHISTORY extends MSVSS | |||
if( m_FromDate != null && m_ToDate != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_VERSION_DATE + m_ToDate + VALUE_FROMDATE + m_FromDate ); | |||
cmd.addArgument( FLAG_VERSION_DATE + m_ToDate + VALUE_FROMDATE + m_FromDate ); | |||
} | |||
else if( m_ToDate != null && m_NumDays != Integer.MIN_VALUE ) | |||
{ | |||
@@ -350,7 +350,7 @@ public class MSVSSHISTORY extends MSVSS | |||
String msg = "Error parsing date: " + m_ToDate; | |||
throw new TaskException( msg ); | |||
} | |||
cmd.createArgument().setValue( FLAG_VERSION_DATE + m_ToDate + VALUE_FROMDATE + startDate ); | |||
cmd.addArgument( FLAG_VERSION_DATE + m_ToDate + VALUE_FROMDATE + startDate ); | |||
} | |||
else if( m_FromDate != null && m_NumDays != Integer.MIN_VALUE ) | |||
{ | |||
@@ -364,17 +364,17 @@ public class MSVSSHISTORY extends MSVSS | |||
String msg = "Error parsing date: " + m_FromDate; | |||
throw new TaskException( msg ); | |||
} | |||
cmd.createArgument().setValue( FLAG_VERSION_DATE + endDate + VALUE_FROMDATE + m_FromDate ); | |||
cmd.addArgument( FLAG_VERSION_DATE + endDate + VALUE_FROMDATE + m_FromDate ); | |||
} | |||
else | |||
{ | |||
if( m_FromDate != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_VERSION + VALUE_FROMDATE + m_FromDate ); | |||
cmd.addArgument( FLAG_VERSION + VALUE_FROMDATE + m_FromDate ); | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( FLAG_VERSION_DATE + m_ToDate ); | |||
cmd.addArgument( FLAG_VERSION_DATE + m_ToDate ); | |||
} | |||
} | |||
} | |||
@@ -395,15 +395,15 @@ public class MSVSSHISTORY extends MSVSS | |||
if( m_FromLabel != null && m_ToLabel != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_VERSION_LABEL + m_ToLabel + VALUE_FROMLABEL + m_FromLabel ); | |||
cmd.addArgument( FLAG_VERSION_LABEL + m_ToLabel + VALUE_FROMLABEL + m_FromLabel ); | |||
} | |||
else if( m_FromLabel != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_VERSION + VALUE_FROMLABEL + m_FromLabel ); | |||
cmd.addArgument( FLAG_VERSION + VALUE_FROMLABEL + m_FromLabel ); | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( FLAG_VERSION_LABEL + m_ToLabel ); | |||
cmd.addArgument( FLAG_VERSION_LABEL + m_ToLabel ); | |||
} | |||
} | |||
@@ -247,20 +247,20 @@ public class MSVSSLABEL extends MSVSS | |||
if( m_AutoResponse == null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_AUTORESPONSE_DEF ); | |||
cmd.addArgument( FLAG_AUTORESPONSE_DEF ); | |||
} | |||
else if( m_AutoResponse.equalsIgnoreCase( "Y" ) ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_AUTORESPONSE_YES ); | |||
cmd.addArgument( FLAG_AUTORESPONSE_YES ); | |||
} | |||
else if( m_AutoResponse.equalsIgnoreCase( "N" ) ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_AUTORESPONSE_NO ); | |||
cmd.addArgument( FLAG_AUTORESPONSE_NO ); | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( FLAG_AUTORESPONSE_DEF ); | |||
cmd.addArgument( FLAG_AUTORESPONSE_DEF ); | |||
}// end of else | |||
} | |||
@@ -294,7 +294,7 @@ public class MSVSSLABEL extends MSVSS | |||
{ | |||
if( m_Label != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_LABEL + m_Label ); | |||
cmd.addArgument( FLAG_LABEL + m_Label ); | |||
} | |||
} | |||
@@ -307,7 +307,7 @@ public class MSVSSLABEL extends MSVSS | |||
{ | |||
if( m_Version != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_VERSION + m_Version ); | |||
cmd.addArgument( FLAG_VERSION + m_Version ); | |||
} | |||
} | |||
@@ -343,13 +343,13 @@ public class MSVSSLABEL extends MSVSS | |||
// ss Label VSS items [-C] [-H] [-I-] [-Llabel] [-N] [-O] [-V] [-Y] [-?] | |||
// as specified in the SS.EXE help | |||
commandLine.setExecutable( getSSCommand() ); | |||
commandLine.createArgument().setValue( COMMAND_LABEL ); | |||
commandLine.addArgument( COMMAND_LABEL ); | |||
// VSS items | |||
commandLine.createArgument().setValue( getVsspath() ); | |||
commandLine.addArgument( getVsspath() ); | |||
// -C | |||
commandLine.createArgument().setValue( "-C" + getComment() ); | |||
commandLine.addArgument( "-C" + getComment() ); | |||
// -I- or -I-Y or -I-N | |||
getAutoresponse( commandLine ); | |||
@@ -16,6 +16,7 @@ import org.apache.tools.ant.taskdefs.Rmic; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.Path; | |||
import org.apache.tools.ant.util.mappers.FileNameMapper; | |||
import org.apache.tools.ant.util.FileUtils; | |||
/** | |||
* This is the default implementation for the RmicAdapter interface. Currently, | |||
@@ -101,65 +102,65 @@ public abstract class DefaultRmicAdapter | |||
{ | |||
for( int i = 0; i < options.length; i++ ) | |||
{ | |||
cmd.createArgument().setValue( options[ i ] ); | |||
cmd.addArgument( options[ i ] ); | |||
} | |||
} | |||
Path classpath = getCompileClasspath(); | |||
cmd.createArgument().setValue( "-d" ); | |||
cmd.createArgument().setFile( attributes.getBase() ); | |||
cmd.addArgument( "-d" ); | |||
cmd.addArgument( attributes.getBase() ); | |||
if( attributes.getExtdirs() != null ) | |||
{ | |||
cmd.createArgument().setValue( "-extdirs" ); | |||
cmd.createArgument().setPath( attributes.getExtdirs() ); | |||
cmd.addArgument( "-extdirs" ); | |||
cmd.addArguments( FileUtils.translateCommandline( attributes.getExtdirs() ) ); | |||
} | |||
cmd.createArgument().setValue( "-classpath" ); | |||
cmd.createArgument().setPath( classpath ); | |||
cmd.addArgument( "-classpath" ); | |||
cmd.addArguments( FileUtils.translateCommandline( classpath ) ); | |||
String stubVersion = attributes.getStubVersion(); | |||
if( null != stubVersion ) | |||
{ | |||
if( "1.1".equals( stubVersion ) ) | |||
cmd.createArgument().setValue( "-v1.1" ); | |||
cmd.addArgument( "-v1.1" ); | |||
else if( "1.2".equals( stubVersion ) ) | |||
cmd.createArgument().setValue( "-v1.2" ); | |||
cmd.addArgument( "-v1.2" ); | |||
else | |||
cmd.createArgument().setValue( "-vcompat" ); | |||
cmd.addArgument( "-vcompat" ); | |||
} | |||
if( null != attributes.getSourceBase() ) | |||
{ | |||
cmd.createArgument().setValue( "-keepgenerated" ); | |||
cmd.addArgument( "-keepgenerated" ); | |||
} | |||
if( attributes.getIiop() ) | |||
{ | |||
getLogger().info( "IIOP has been turned on." ); | |||
cmd.createArgument().setValue( "-iiop" ); | |||
cmd.addArgument( "-iiop" ); | |||
if( attributes.getIiopopts() != null ) | |||
{ | |||
getLogger().info( "IIOP Options: " + attributes.getIiopopts() ); | |||
cmd.createArgument().setValue( attributes.getIiopopts() ); | |||
cmd.addArgument( attributes.getIiopopts() ); | |||
} | |||
} | |||
if( attributes.getIdl() ) | |||
{ | |||
cmd.createArgument().setValue( "-idl" ); | |||
cmd.addArgument( "-idl" ); | |||
getLogger().info( "IDL has been turned on." ); | |||
if( attributes.getIdlopts() != null ) | |||
{ | |||
cmd.createArgument().setValue( attributes.getIdlopts() ); | |||
cmd.addArgument( attributes.getIdlopts() ); | |||
getLogger().info( "IDL Options: " + attributes.getIdlopts() ); | |||
} | |||
} | |||
if( attributes.getDebug() ) | |||
{ | |||
cmd.createArgument().setValue( "-g" ); | |||
cmd.addArgument( "-g" ); | |||
} | |||
logAndAddFilesToCompile( cmd ); | |||
@@ -225,7 +226,7 @@ public abstract class DefaultRmicAdapter | |||
for( int i = 0; i < compileList.size(); i++ ) | |||
{ | |||
String arg = (String)compileList.get( i ); | |||
cmd.createArgument().setValue( arg ); | |||
cmd.addArgument( arg ); | |||
niceSourceList.append( " " + arg ); | |||
} | |||
@@ -11,6 +11,7 @@ import org.apache.myrmidon.api.AbstractTask; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.Argument; | |||
import java.io.IOException; | |||
/** | |||
@@ -162,78 +163,78 @@ public class GenerateKey | |||
final Commandline cmd = new Commandline(); | |||
cmd.setExecutable( "keytool" ); | |||
cmd.createArgument().setValue( "-genkey " ); | |||
cmd.addArgument( "-genkey " ); | |||
if( m_verbose ) | |||
{ | |||
cmd.createArgument().setValue( "-v " ); | |||
cmd.addArgument( "-v " ); | |||
} | |||
cmd.createArgument().setValue( "-alias" ); | |||
cmd.createArgument().setValue( m_alias ); | |||
cmd.addArgument( "-alias" ); | |||
cmd.addArgument( m_alias ); | |||
if( null != m_dname ) | |||
{ | |||
cmd.createArgument().setValue( "-dname" ); | |||
cmd.createArgument().setValue( m_dname ); | |||
cmd.addArgument( "-dname" ); | |||
cmd.addArgument( m_dname ); | |||
} | |||
if( null != m_expandedDname ) | |||
{ | |||
cmd.createArgument().setValue( "-dname" ); | |||
cmd.createArgument().setValue( m_expandedDname.toString() ); | |||
cmd.addArgument( "-dname" ); | |||
cmd.addArgument( m_expandedDname.toString() ); | |||
} | |||
if( null != m_keystore ) | |||
{ | |||
cmd.createArgument().setValue( "-keystore" ); | |||
cmd.createArgument().setValue( m_keystore ); | |||
cmd.addArgument( "-keystore" ); | |||
cmd.addArgument( m_keystore ); | |||
} | |||
if( null != m_storepass ) | |||
{ | |||
cmd.createArgument().setValue( "-storepass" ); | |||
cmd.createArgument().setValue( m_storepass ); | |||
cmd.addArgument( "-storepass" ); | |||
cmd.addArgument( m_storepass ); | |||
} | |||
if( null != m_storetype ) | |||
{ | |||
cmd.createArgument().setValue( "-storetype" ); | |||
cmd.createArgument().setValue( m_storetype ); | |||
cmd.addArgument( "-storetype" ); | |||
cmd.addArgument( m_storetype ); | |||
} | |||
cmd.createArgument().setValue( "-keypass" ); | |||
cmd.addArgument( "-keypass" ); | |||
if( null != m_keypass ) | |||
{ | |||
cmd.createArgument().setValue( m_keypass ); | |||
cmd.addArgument( m_keypass ); | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( m_storepass ); | |||
cmd.addArgument( m_storepass ); | |||
} | |||
if( null != m_sigalg ) | |||
{ | |||
cmd.createArgument().setValue( "-sigalg" ); | |||
cmd.createArgument().setValue( m_sigalg ); | |||
cmd.addArgument( "-sigalg" ); | |||
cmd.addArgument( m_sigalg ); | |||
} | |||
if( null != m_keyalg ) | |||
{ | |||
cmd.createArgument().setValue( "-keyalg" ); | |||
cmd.createArgument().setValue( m_keyalg ); | |||
cmd.addArgument( "-keyalg" ); | |||
cmd.addArgument( m_keyalg ); | |||
} | |||
if( 0 < m_keysize ) | |||
{ | |||
cmd.createArgument().setValue( "-keysize" ); | |||
cmd.createArgument().setValue( "" + m_keysize ); | |||
cmd.addArgument( "-keysize" ); | |||
cmd.addArgument( "" + m_keysize ); | |||
} | |||
if( 0 < m_validity ) | |||
{ | |||
cmd.createArgument().setValue( "-validity" ); | |||
cmd.createArgument().setValue( "" + m_validity ); | |||
cmd.addArgument( "-validity" ); | |||
cmd.addArgument( "" + m_validity ); | |||
} | |||
return cmd; | |||
} | |||
@@ -19,6 +19,7 @@ import org.apache.tools.ant.types.DirectoryScanner; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.FileSet; | |||
import org.apache.tools.ant.types.Argument; | |||
/** | |||
* Sign a archive. | |||
@@ -309,58 +310,58 @@ public class SignJar | |||
if( null != m_keystore ) | |||
{ | |||
cmd.createArgument().setValue( "-keystore" ); | |||
cmd.createArgument().setValue( m_keystore.toString() ); | |||
cmd.addArgument( "-keystore" ); | |||
cmd.addArgument( m_keystore.toString() ); | |||
} | |||
if( null != m_storepass ) | |||
{ | |||
cmd.createArgument().setValue( "-storepass" ); | |||
cmd.createArgument().setValue( m_storepass ); | |||
cmd.addArgument( "-storepass" ); | |||
cmd.addArgument( m_storepass ); | |||
} | |||
if( null != m_storetype ) | |||
{ | |||
cmd.createArgument().setValue( "-storetype" ); | |||
cmd.createArgument().setValue( m_storetype ); | |||
cmd.addArgument( "-storetype" ); | |||
cmd.addArgument( m_storetype ); | |||
} | |||
if( null != m_keypass ) | |||
{ | |||
cmd.createArgument().setValue( "-keypass" ); | |||
cmd.createArgument().setValue( m_keypass ); | |||
cmd.addArgument( "-keypass" ); | |||
cmd.addArgument( m_keypass ); | |||
} | |||
if( null != m_sigfile ) | |||
{ | |||
cmd.createArgument().setValue( "-sigfile" ); | |||
cmd.createArgument().setValue( m_sigfile.toString() ); | |||
cmd.addArgument( "-sigfile" ); | |||
cmd.addArgument( m_sigfile.toString() ); | |||
} | |||
if( null != jarTarget ) | |||
{ | |||
cmd.createArgument().setValue( "-signedjar" ); | |||
cmd.createArgument().setValue( jarTarget.toString() ); | |||
cmd.addArgument( "-signedjar" ); | |||
cmd.addArgument( jarTarget.toString() ); | |||
} | |||
if( m_verbose ) | |||
{ | |||
cmd.createArgument().setValue( "-verbose" ); | |||
cmd.addArgument( "-verbose" ); | |||
} | |||
if( m_internalsf ) | |||
{ | |||
cmd.createArgument().setValue( "-internalsf" ); | |||
cmd.addArgument( "-internalsf" ); | |||
} | |||
if( m_sectionsonly ) | |||
{ | |||
cmd.createArgument().setValue( "-sectionsonly" ); | |||
cmd.addArgument( "-sectionsonly" ); | |||
} | |||
cmd.createArgument().setValue( jarSource.toString() ); | |||
cmd.addArgument( jarSource.toString() ); | |||
cmd.createArgument().setValue( m_alias ); | |||
cmd.addArgument( m_alias ); | |||
return cmd; | |||
} | |||
} | |||
@@ -14,6 +14,7 @@ import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.DirectoryScanner; | |||
import org.apache.tools.ant.util.mappers.Mapper; | |||
import org.apache.tools.ant.types.SourceFileScanner; | |||
import org.apache.tools.ant.types.Argument; | |||
import org.apache.tools.ant.util.mappers.FileNameMapper; | |||
import org.apache.tools.ant.util.mappers.IdentityMapper; | |||
@@ -231,17 +232,17 @@ public class Native2Ascii | |||
// it's cleaner here) | |||
if( m_reverse ) | |||
{ | |||
cmd.createArgument().setValue( "-reverse" ); | |||
cmd.addArgument( "-reverse" ); | |||
} | |||
if( m_encoding != null ) | |||
{ | |||
cmd.createArgument().setValue( "-encoding" ); | |||
cmd.createArgument().setValue( m_encoding ); | |||
cmd.addArgument( "-encoding" ); | |||
cmd.addArgument( m_encoding ); | |||
} | |||
cmd.createArgument().setFile( srcFile ); | |||
cmd.createArgument().setFile( destFile ); | |||
cmd.addArgument( srcFile ); | |||
cmd.addArgument( destFile ); | |||
return cmd; | |||
} | |||
} |
@@ -13,6 +13,7 @@ import org.apache.myrmidon.api.AbstractTask; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.Argument; | |||
/** | |||
* @author lucas@collab.net | |||
@@ -119,26 +120,26 @@ public class Rpm | |||
cmd.setExecutable( "rpm" ); | |||
if( m_topDir != null ) | |||
{ | |||
cmd.createArgument().setValue( "--define" ); | |||
cmd.createArgument().setValue( "_topdir" + m_topDir ); | |||
cmd.addArgument( "--define" ); | |||
cmd.addArgument( "_topdir" + m_topDir ); | |||
} | |||
cmd.createArgument().setLine( m_command ); | |||
if( m_cleanBuildDir ) | |||
{ | |||
cmd.createArgument().setValue( "--clean" ); | |||
cmd.addArgument( "--clean" ); | |||
} | |||
if( m_removeSpec ) | |||
{ | |||
cmd.createArgument().setValue( "--rmspec" ); | |||
cmd.addArgument( "--rmspec" ); | |||
} | |||
if( m_removeSource ) | |||
{ | |||
cmd.createArgument().setValue( "--rmsource" ); | |||
cmd.addArgument( "--rmsource" ); | |||
} | |||
cmd.createArgument().setValue( "SPECS/" + m_specFile ); | |||
cmd.addArgument( "SPECS/" + m_specFile ); | |||
return cmd; | |||
} | |||
} |
@@ -18,6 +18,20 @@ public class Argument | |||
{ | |||
private String[] m_parts; | |||
public Argument() | |||
{ | |||
} | |||
public Argument( final String value ) | |||
{ | |||
setValue( value ); | |||
} | |||
public Argument( final File file ) | |||
{ | |||
setFile( file ); | |||
} | |||
/** | |||
* Sets a single commandline argument to the absolute filename of the | |||
* given file. | |||
@@ -100,7 +100,7 @@ public class Commandline | |||
{ | |||
for( int i = 0; i < line.length; i++ ) | |||
{ | |||
createArgument().setValue( line[ i ] ); | |||
addArgument( line[ i ] ); | |||
} | |||
} | |||
@@ -117,6 +117,21 @@ public class Commandline | |||
return argument; | |||
} | |||
public void addArgument( final File argument ) | |||
{ | |||
addArgument( new Argument( argument ) ); | |||
} | |||
public void addArgument( final String argument ) | |||
{ | |||
addArgument( new Argument( argument ) ); | |||
} | |||
public void addArgument( final Argument argument ) | |||
{ | |||
m_arguments.add( argument ); | |||
} | |||
/** | |||
* Return a marker. <p> | |||
* | |||
@@ -7,10 +7,10 @@ | |||
*/ | |||
package org.apache.tools.ant.types; | |||
import org.apache.myrmidon.api.TaskException; | |||
import java.io.File; | |||
import org.apache.aut.nativelib.Os; | |||
import org.apache.avalon.excalibur.util.StringUtil; | |||
import java.io.File; | |||
import org.apache.myrmidon.api.TaskException; | |||
/** | |||
* A representation of a Java command line that is nothing more than a composite | |||
@@ -23,11 +23,11 @@ import java.io.File; | |||
public class CommandlineJava | |||
implements Cloneable | |||
{ | |||
private Commandline vmCommand = new Commandline(); | |||
private Commandline javaCommand = new Commandline(); | |||
private SysProperties sysProperties = new SysProperties(); | |||
private Path classpath; | |||
private String maxMemory; | |||
private Commandline m_vmCommand = new Commandline(); | |||
private Commandline m_javaCommand = new Commandline(); | |||
private SysProperties m_sysProperties = new SysProperties(); | |||
private Path m_classpath; | |||
private String m_maxMemory; | |||
/** | |||
* Indicate whether it will execute a jar file or not, in this case the | |||
@@ -47,7 +47,7 @@ public class CommandlineJava | |||
*/ | |||
public void setClassname( String classname ) | |||
{ | |||
javaCommand.setExecutable( classname ); | |||
m_javaCommand.setExecutable( classname ); | |||
executeJar = false; | |||
} | |||
@@ -58,7 +58,7 @@ public class CommandlineJava | |||
*/ | |||
public void setJar( String jarpathname ) | |||
{ | |||
javaCommand.setExecutable( jarpathname ); | |||
m_javaCommand.setExecutable( jarpathname ); | |||
executeJar = true; | |||
} | |||
@@ -69,18 +69,18 @@ public class CommandlineJava | |||
*/ | |||
public void setMaxmemory( String max ) | |||
{ | |||
this.maxMemory = max; | |||
this.m_maxMemory = max; | |||
} | |||
public void setSystemProperties() | |||
throws TaskException | |||
{ | |||
sysProperties.setSystem(); | |||
m_sysProperties.setSystem(); | |||
} | |||
public void setVm( String vm ) | |||
{ | |||
vmCommand.setExecutable( vm ); | |||
m_vmCommand.setExecutable( vm ); | |||
} | |||
/** | |||
@@ -92,14 +92,14 @@ public class CommandlineJava | |||
{ | |||
if( !executeJar ) | |||
{ | |||
return javaCommand.getExecutable(); | |||
return m_javaCommand.getExecutable(); | |||
} | |||
return null; | |||
} | |||
public Path getClasspath() | |||
{ | |||
return classpath; | |||
return m_classpath; | |||
} | |||
/** | |||
@@ -125,22 +125,22 @@ public class CommandlineJava | |||
System.arraycopy( vmArgs, 1, result, pos, vmArgs.length - 1 ); | |||
pos += vmArgs.length - 1; | |||
// properties are part of the vm options... | |||
if( sysProperties.size() > 0 ) | |||
if( m_sysProperties.size() > 0 ) | |||
{ | |||
System.arraycopy( sysProperties.getJavaVariables(), 0, | |||
result, pos, sysProperties.size() ); | |||
pos += sysProperties.size(); | |||
System.arraycopy( m_sysProperties.getJavaVariables(), 0, | |||
result, pos, m_sysProperties.size() ); | |||
pos += m_sysProperties.size(); | |||
} | |||
// classpath is a vm option too.. | |||
if( classpath != null && classpath.toString().trim().length() > 0 ) | |||
if( m_classpath != null && m_classpath.toString().trim().length() > 0 ) | |||
{ | |||
result[ pos++ ] = "-classpath"; | |||
result[ pos++ ] = classpath.toString(); | |||
result[ pos++ ] = m_classpath.toString(); | |||
} | |||
// this is the classname to run as well as its arguments. | |||
// in case of 'executeJar', the executable is a jar file. | |||
System.arraycopy( javaCommand.getCommandline(), 0, | |||
result, pos, javaCommand.size() ); | |||
System.arraycopy( m_javaCommand.getCommandline(), 0, | |||
result, pos, m_javaCommand.size() ); | |||
return result; | |||
} | |||
@@ -153,19 +153,19 @@ public class CommandlineJava | |||
{ | |||
if( executeJar ) | |||
{ | |||
return javaCommand.getExecutable(); | |||
return m_javaCommand.getExecutable(); | |||
} | |||
return null; | |||
} | |||
public Commandline getJavaCommand() | |||
{ | |||
return javaCommand; | |||
return m_javaCommand; | |||
} | |||
public SysProperties getSystemProperties() | |||
{ | |||
return sysProperties; | |||
return m_sysProperties; | |||
} | |||
public Commandline getVmCommand() | |||
@@ -175,32 +175,47 @@ public class CommandlineJava | |||
public void addSysproperty( EnvironmentVariable sysp ) | |||
{ | |||
sysProperties.addVariable( sysp ); | |||
m_sysProperties.addVariable( sysp ); | |||
} | |||
public Argument createArgument() | |||
{ | |||
return javaCommand.createArgument(); | |||
return m_javaCommand.createArgument(); | |||
} | |||
public void addArgument( final String argument ) | |||
{ | |||
m_javaCommand.addArgument( argument ); | |||
} | |||
public void addArgument( final Argument argument ) | |||
{ | |||
m_javaCommand.addArgument( argument ); | |||
} | |||
public Path createClasspath() | |||
{ | |||
if( classpath == null ) | |||
if( m_classpath == null ) | |||
{ | |||
classpath = new Path(); | |||
m_classpath = new Path(); | |||
} | |||
return classpath; | |||
return m_classpath; | |||
} | |||
public Argument createVmArgument() | |||
public void addVmArgument( final String argument ) | |||
{ | |||
return vmCommand.createArgument(); | |||
m_vmCommand.addArgument( argument ); | |||
} | |||
public void addVmArgument( final Argument argument ) | |||
{ | |||
m_vmCommand.addArgument( argument ); | |||
} | |||
public void restoreSystemProperties() | |||
throws TaskException | |||
{ | |||
sysProperties.restoreSystem(); | |||
m_sysProperties.restoreSystem(); | |||
} | |||
/** | |||
@@ -212,9 +227,9 @@ public class CommandlineJava | |||
public int size() | |||
throws TaskException | |||
{ | |||
int size = getActualVMCommand().size() + javaCommand.size() + sysProperties.size(); | |||
int size = getActualVMCommand().size() + m_javaCommand.size() + m_sysProperties.size(); | |||
// classpath is "-classpath <classpath>" -> 2 args | |||
if( classpath != null && classpath.toString().trim().length() > 0 ) | |||
if( m_classpath != null && m_classpath.toString().trim().length() > 0 ) | |||
{ | |||
size += 2; | |||
} | |||
@@ -230,7 +245,7 @@ public class CommandlineJava | |||
{ | |||
try | |||
{ | |||
String[] line = getCommandline(); | |||
final String[] line = getCommandline(); | |||
return StringUtil.join( line, " " ); | |||
} | |||
catch( TaskException e ) | |||
@@ -243,9 +258,9 @@ public class CommandlineJava | |||
{ | |||
Commandline actualVMCommand = new Commandline(); | |||
//(Commandline)vmCommand.clone(); | |||
if( maxMemory != null ) | |||
if( m_maxMemory != null ) | |||
{ | |||
actualVMCommand.createArgument().setValue( "-Xmx" + maxMemory ); | |||
actualVMCommand.addArgument( "-Xmx" + m_maxMemory ); | |||
} | |||
return actualVMCommand; | |||
} | |||
@@ -262,7 +277,7 @@ public class CommandlineJava | |||
// PATH. | |||
File jExecutable = | |||
new File( System.getProperty( "java.home" ) + | |||
"/../bin/java" + extension ); | |||
"/../bin/java" + extension ); | |||
if( jExecutable.exists() && !Os.isFamily( "netware" ) ) | |||
{ | |||
@@ -276,5 +291,4 @@ public class CommandlineJava | |||
return "java"; | |||
} | |||
} | |||
} |
@@ -19,9 +19,9 @@ import java.util.ArrayList; | |||
import java.util.Stack; | |||
import java.util.StringTokenizer; | |||
import org.apache.avalon.excalibur.io.FileUtil; | |||
import org.apache.avalon.framework.logger.Logger; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.types.FilterSetCollection; | |||
import org.apache.tools.ant.types.Path; | |||
/** | |||
* This class also encapsulates methods which allow Files to be refered to using | |||
@@ -298,6 +298,12 @@ public class FileUtils | |||
} | |||
} | |||
public static String[] translateCommandline( Path to_process ) | |||
throws TaskException | |||
{ | |||
return translateCommandline( to_process.toString() ); | |||
} | |||
public static String[] translateCommandline( String to_process ) | |||
throws TaskException | |||
{ | |||
@@ -405,7 +411,7 @@ public class FileUtils | |||
public static void translateFileSep( StringBuffer buffer ) | |||
{ | |||
int len = buffer.length(); | |||
for ( int pos = 0; pos < len; pos++ ) | |||
for( int pos = 0; pos < len; pos++ ) | |||
{ | |||
char ch = buffer.charAt( pos ); | |||
if( ch == '/' || ch == '\\' ) | |||
@@ -11,8 +11,9 @@ import java.io.BufferedReader; | |||
import java.io.File; | |||
import java.io.FileInputStream; | |||
import java.io.FileOutputStream; | |||
import java.io.IOException; | |||
import java.io.InputStreamReader; | |||
import java.io.IOException; | |||
import java.io.InputStream; | |||
import java.security.DigestInputStream; | |||
import java.security.MessageDigest; | |||
import java.security.NoSuchAlgorithmException; | |||
@@ -20,9 +21,10 @@ import java.security.NoSuchProviderException; | |||
import java.util.ArrayList; | |||
import java.util.Enumeration; | |||
import java.util.Hashtable; | |||
import org.apache.avalon.excalibur.io.IOUtil; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.types.DirectoryScanner; | |||
import org.apache.tools.ant.taskdefs.condition.Condition; | |||
import org.apache.tools.ant.types.DirectoryScanner; | |||
import org.apache.tools.ant.types.FileSet; | |||
/** | |||
@@ -31,61 +33,73 @@ import org.apache.tools.ant.types.FileSet; | |||
* | |||
* @author <a href="mailto:umagesh@rediffmail.com">Magesh Umasankar</a> | |||
*/ | |||
public class Checksum extends MatchingTask implements Condition | |||
public class Checksum | |||
extends MatchingTask | |||
implements Condition | |||
{ | |||
/** | |||
* File for which checksum is to be calculated. | |||
*/ | |||
private File file = null; | |||
private File m_file; | |||
/** | |||
* MessageDigest algorithm to be used. | |||
*/ | |||
private String algorithm = "MD5"; | |||
private String m_algorithm = "MD5"; | |||
/** | |||
* MessageDigest Algorithm provider | |||
*/ | |||
private String provider = null; | |||
private String m_provider; | |||
/** | |||
* ArrayList to hold source file sets. | |||
*/ | |||
private ArrayList filesets = new ArrayList(); | |||
private ArrayList m_filesets = new ArrayList(); | |||
/** | |||
* Stores SourceFile, DestFile pairs and SourceFile, Property String pairs. | |||
*/ | |||
private Hashtable includeFileMap = new Hashtable(); | |||
private Hashtable m_includeFileMap = new Hashtable(); | |||
/** | |||
* File Extension that is be to used to create or identify destination file | |||
*/ | |||
private String fileext; | |||
private String m_fileext; | |||
/** | |||
* Create new destination file? Defaults to false. | |||
*/ | |||
private boolean forceOverwrite; | |||
private boolean m_forceOverwrite; | |||
/** | |||
* is this task being used as a nested condition element? | |||
*/ | |||
private boolean isCondition; | |||
private boolean m_isCondition; | |||
/** | |||
* Message Digest instance | |||
*/ | |||
private MessageDigest messageDigest; | |||
private MessageDigest m_messageDigest; | |||
/** | |||
* Holds generated checksum and gets set as a Project Property. | |||
*/ | |||
private String property; | |||
private String m_property; | |||
/** | |||
* Contains the result of a checksum verification. ("true" or "false") | |||
*/ | |||
private String verifyProperty; | |||
private String m_verifyProperty; | |||
/** | |||
* Sets the MessageDigest algorithm to be used to calculate the checksum. | |||
* | |||
* @param algorithm The new Algorithm value | |||
*/ | |||
public void setAlgorithm( String algorithm ) | |||
public void setAlgorithm( final String algorithm ) | |||
{ | |||
this.algorithm = algorithm; | |||
m_algorithm = algorithm; | |||
} | |||
/** | |||
@@ -93,9 +107,9 @@ public class Checksum extends MatchingTask implements Condition | |||
* | |||
* @param file The new File value | |||
*/ | |||
public void setFile( File file ) | |||
public void setFile( final File file ) | |||
{ | |||
this.file = file; | |||
m_file = file; | |||
} | |||
/** | |||
@@ -104,9 +118,9 @@ public class Checksum extends MatchingTask implements Condition | |||
* | |||
* @param fileext The new Fileext value | |||
*/ | |||
public void setFileext( String fileext ) | |||
public void setFileext( final String fileext ) | |||
{ | |||
this.fileext = fileext; | |||
m_fileext = fileext; | |||
} | |||
/** | |||
@@ -117,7 +131,7 @@ public class Checksum extends MatchingTask implements Condition | |||
*/ | |||
public void setForceOverwrite( boolean forceOverwrite ) | |||
{ | |||
this.forceOverwrite = forceOverwrite; | |||
this.m_forceOverwrite = forceOverwrite; | |||
} | |||
/** | |||
@@ -127,7 +141,7 @@ public class Checksum extends MatchingTask implements Condition | |||
*/ | |||
public void setProperty( String property ) | |||
{ | |||
this.property = property; | |||
this.m_property = property; | |||
} | |||
/** | |||
@@ -136,9 +150,9 @@ public class Checksum extends MatchingTask implements Condition | |||
* | |||
* @param provider The new Provider value | |||
*/ | |||
public void setProvider( String provider ) | |||
public void setProvider( final String provider ) | |||
{ | |||
this.provider = provider; | |||
m_provider = provider; | |||
} | |||
/** | |||
@@ -147,9 +161,9 @@ public class Checksum extends MatchingTask implements Condition | |||
* | |||
* @param verifyProperty The new Verifyproperty value | |||
*/ | |||
public void setVerifyproperty( String verifyProperty ) | |||
public void setVerifyproperty( final String verifyProperty ) | |||
{ | |||
this.verifyProperty = verifyProperty; | |||
m_verifyProperty = verifyProperty; | |||
} | |||
/** | |||
@@ -157,9 +171,9 @@ public class Checksum extends MatchingTask implements Condition | |||
* | |||
* @param set The feature to be added to the Fileset attribute | |||
*/ | |||
public void addFileset( FileSet set ) | |||
public void addFileset( final FileSet set ) | |||
{ | |||
filesets.add( set ); | |||
m_filesets.add( set ); | |||
} | |||
/** | |||
@@ -167,12 +181,11 @@ public class Checksum extends MatchingTask implements Condition | |||
* | |||
* @return Returns true if the checksum verification test passed, false | |||
* otherwise. | |||
* @exception TaskException Description of Exception | |||
*/ | |||
public boolean eval() | |||
throws TaskException | |||
{ | |||
isCondition = true; | |||
m_isCondition = true; | |||
return validateAndExecute(); | |||
} | |||
@@ -184,10 +197,10 @@ public class Checksum extends MatchingTask implements Condition | |||
public void execute() | |||
throws TaskException | |||
{ | |||
boolean value = validateAndExecute(); | |||
if( verifyProperty != null ) | |||
final boolean value = validateAndExecute(); | |||
if( m_verifyProperty != null ) | |||
{ | |||
setProperty( verifyProperty, new Boolean( value ).toString() ); | |||
setProperty( m_verifyProperty, new Boolean( value ).toString() ); | |||
} | |||
} | |||
@@ -197,36 +210,37 @@ public class Checksum extends MatchingTask implements Condition | |||
* @param file The feature to be added to the ToIncludeFileMap attribute | |||
* @exception TaskException Description of Exception | |||
*/ | |||
private void addToIncludeFileMap( File file ) | |||
private void addToIncludeFileMap( final File file ) | |||
throws TaskException | |||
{ | |||
if( file != null ) | |||
{ | |||
if( file.exists() ) | |||
{ | |||
if( property == null ) | |||
if( m_property == null ) | |||
{ | |||
File dest = new File( file.getParent(), file.getName() + fileext ); | |||
if( forceOverwrite || isCondition || | |||
final File dest = new File( file.getParent(), file.getName() + m_fileext ); | |||
if( m_forceOverwrite || m_isCondition || | |||
( file.lastModified() > dest.lastModified() ) ) | |||
{ | |||
includeFileMap.put( file, dest ); | |||
m_includeFileMap.put( file, dest ); | |||
} | |||
else | |||
{ | |||
getLogger().debug( file + " omitted as " + dest + " is up to date." ); | |||
final String message = file + " omitted as " + dest + | |||
" is up to date."; | |||
getLogger().debug( message ); | |||
} | |||
} | |||
else | |||
{ | |||
includeFileMap.put( file, property ); | |||
m_includeFileMap.put( file, m_property ); | |||
} | |||
} | |||
else | |||
{ | |||
String message = "Could not find file " | |||
+ file.getAbsolutePath() | |||
+ " to generate checksum for."; | |||
final String message = "Could not find file " + file.getAbsolutePath() + | |||
" to generate checksum for."; | |||
getLogger().info( message ); | |||
throw new TaskException( message ); | |||
} | |||
@@ -235,253 +249,266 @@ public class Checksum extends MatchingTask implements Condition | |||
/** | |||
* Generate checksum(s) using the message digest created earlier. | |||
* | |||
* @return Description of the Returned Value | |||
* @exception TaskException Description of Exception | |||
*/ | |||
private boolean generateChecksums() | |||
throws TaskException | |||
{ | |||
boolean checksumMatches = true; | |||
final Enumeration includes = m_includeFileMap.keys(); | |||
while( includes.hasMoreElements() ) | |||
{ | |||
final File src = (File)includes.nextElement(); | |||
if( !m_isCondition ) | |||
{ | |||
final String message = "Calculating " + m_algorithm + " checksum for " + src; | |||
getLogger().info( message ); | |||
} | |||
checksumMatches = z( src, checksumMatches ); | |||
} | |||
return checksumMatches; | |||
} | |||
private boolean z( final File src, boolean checksumMatches ) | |||
throws TaskException | |||
{ | |||
FileInputStream fis = null; | |||
FileOutputStream fos = null; | |||
try | |||
{ | |||
for( Enumeration e = includeFileMap.keys(); e.hasMoreElements(); ) | |||
fis = new FileInputStream( src ); | |||
final byte[] fileDigest = buildDigest( fis ); | |||
IOUtil.shutdownStream( fis ); | |||
String checksum = ""; | |||
for( int i = 0; i < fileDigest.length; i++ ) | |||
{ | |||
messageDigest.reset(); | |||
File src = (File)e.nextElement(); | |||
if( !isCondition ) | |||
final String hexStr = Integer.toHexString( 0x00ff & fileDigest[ i ] ); | |||
if( hexStr.length() < 2 ) | |||
{ | |||
getLogger().info( "Calculating " + algorithm + " checksum for " + src ); | |||
checksum += "0"; | |||
} | |||
fis = new FileInputStream( src ); | |||
DigestInputStream dis = new DigestInputStream( fis, | |||
messageDigest ); | |||
while( dis.read() != -1 ) | |||
; | |||
dis.close(); | |||
fis.close(); | |||
fis = null; | |||
byte[] fileDigest = messageDigest.digest(); | |||
String checksum = ""; | |||
for( int i = 0; i < fileDigest.length; i++ ) | |||
checksum += hexStr; | |||
} | |||
//can either be a property name string or a file | |||
Object destination = m_includeFileMap.get( src ); | |||
if( destination instanceof String ) | |||
{ | |||
String prop = (String)destination; | |||
if( m_isCondition ) | |||
{ | |||
String hexStr = Integer.toHexString( 0x00ff & fileDigest[ i ] ); | |||
if( hexStr.length() < 2 ) | |||
{ | |||
checksum += "0"; | |||
} | |||
checksum += hexStr; | |||
checksumMatches = checksum.equals( m_property ); | |||
} | |||
//can either be a property name string or a file | |||
Object destination = includeFileMap.get( src ); | |||
if( destination instanceof java.lang.String ) | |||
else | |||
{ | |||
String prop = (String)destination; | |||
if( isCondition ) | |||
{ | |||
checksumMatches = checksum.equals( property ); | |||
} | |||
else | |||
{ | |||
setProperty( prop, checksum ); | |||
} | |||
setProperty( prop, checksum ); | |||
} | |||
else if( destination instanceof java.io.File ) | |||
} | |||
else if( destination instanceof File ) | |||
{ | |||
final File file = (File)destination; | |||
if( m_isCondition ) | |||
{ | |||
if( isCondition ) | |||
if( file.exists() && | |||
file.length() == checksum.length() ) | |||
{ | |||
File existingFile = (File)destination; | |||
if( existingFile.exists() && | |||
existingFile.length() == checksum.length() ) | |||
{ | |||
fis = new FileInputStream( existingFile ); | |||
InputStreamReader isr = new InputStreamReader( fis ); | |||
BufferedReader br = new BufferedReader( isr ); | |||
String suppliedChecksum = br.readLine(); | |||
fis.close(); | |||
fis = null; | |||
br.close(); | |||
isr.close(); | |||
checksumMatches = | |||
checksum.equals( suppliedChecksum ); | |||
} | |||
else | |||
{ | |||
checksumMatches = false; | |||
} | |||
fis = new FileInputStream( file ); | |||
InputStreamReader isr = new InputStreamReader( fis ); | |||
BufferedReader br = new BufferedReader( isr ); | |||
String suppliedChecksum = br.readLine(); | |||
fis.close(); | |||
fis = null; | |||
br.close(); | |||
isr.close(); | |||
checksumMatches = | |||
checksum.equals( suppliedChecksum ); | |||
} | |||
else | |||
{ | |||
File dest = (File)destination; | |||
fos = new FileOutputStream( dest ); | |||
fos.write( checksum.getBytes() ); | |||
fos.close(); | |||
fos = null; | |||
checksumMatches = false; | |||
} | |||
} | |||
else | |||
{ | |||
fos = new FileOutputStream( file ); | |||
fos.write( checksum.getBytes() ); | |||
fos.close(); | |||
fos = null; | |||
} | |||
} | |||
} | |||
catch( Exception e ) | |||
catch( final Exception e ) | |||
{ | |||
throw new TaskException( "Error", e ); | |||
throw new TaskException( e.getMessage(), e ); | |||
} | |||
finally | |||
{ | |||
if( fis != null ) | |||
{ | |||
try | |||
{ | |||
fis.close(); | |||
} | |||
catch( IOException e ) | |||
{ | |||
} | |||
} | |||
if( fos != null ) | |||
{ | |||
try | |||
{ | |||
fos.close(); | |||
} | |||
catch( IOException e ) | |||
{ | |||
} | |||
} | |||
IOUtil.shutdownStream( fis ); | |||
IOUtil.shutdownStream( fos ); | |||
} | |||
return checksumMatches; | |||
} | |||
private byte[] buildDigest( final InputStream input ) | |||
throws IOException | |||
{ | |||
m_messageDigest.reset(); | |||
final DigestInputStream digester = | |||
new DigestInputStream( input, m_messageDigest ); | |||
while( digester.read() != -1 ) | |||
{ | |||
} | |||
digester.close(); | |||
return m_messageDigest.digest(); | |||
} | |||
/** | |||
* Validate attributes and get down to business. | |||
* | |||
* @return Description of the Returned Value | |||
* @exception TaskException Description of Exception | |||
*/ | |||
private boolean validateAndExecute() | |||
throws TaskException | |||
{ | |||
if( file == null && filesets.size() == 0 ) | |||
if( null == m_file && 0 == m_filesets.size() ) | |||
{ | |||
throw new TaskException( | |||
"Specify at least one source - a file or a fileset." ); | |||
final String message = "Specify at least one source - a file or a fileset."; | |||
throw new TaskException( message ); | |||
} | |||
if( file != null && file.exists() && file.isDirectory() ) | |||
if( null != m_file && m_file.exists() && m_file.isDirectory() ) | |||
{ | |||
throw new TaskException( | |||
"Checksum cannot be generated for directories" ); | |||
final String message = "Checksum cannot be generated for directories"; | |||
throw new TaskException( message ); | |||
} | |||
if( property != null && fileext != null ) | |||
if( null != m_property && null != m_fileext ) | |||
{ | |||
throw new TaskException( | |||
"Property and FileExt cannot co-exist." ); | |||
final String message = "Property and FileExt cannot co-exist."; | |||
throw new TaskException( message ); | |||
} | |||
if( property != null ) | |||
if( m_property != null ) | |||
{ | |||
if( forceOverwrite ) | |||
if( m_forceOverwrite ) | |||
{ | |||
throw new TaskException( | |||
"ForceOverwrite cannot be used when Property is specified" ); | |||
final String message = | |||
"ForceOverwrite cannot be used when Property is specified"; | |||
throw new TaskException( message ); | |||
} | |||
if( file != null ) | |||
if( m_file != null ) | |||
{ | |||
if( filesets.size() > 0 ) | |||
if( m_filesets.size() > 0 ) | |||
{ | |||
throw new TaskException( | |||
"Multiple files cannot be used when Property is specified" ); | |||
final String message = | |||
"Multiple files cannot be used when Property is specified"; | |||
throw new TaskException( message ); | |||
} | |||
} | |||
else | |||
{ | |||
if( filesets.size() > 1 ) | |||
if( m_filesets.size() > 1 ) | |||
{ | |||
throw new TaskException( | |||
"Multiple files cannot be used when Property is specified" ); | |||
final String message = | |||
"Multiple files cannot be used when Property is specified"; | |||
throw new TaskException( message ); | |||
} | |||
} | |||
} | |||
if( verifyProperty != null ) | |||
if( m_verifyProperty != null ) | |||
{ | |||
isCondition = true; | |||
m_isCondition = true; | |||
} | |||
if( verifyProperty != null && forceOverwrite ) | |||
if( m_verifyProperty != null && m_forceOverwrite ) | |||
{ | |||
throw new TaskException( | |||
"VerifyProperty and ForceOverwrite cannot co-exist." ); | |||
final String message = "VerifyProperty and ForceOverwrite cannot co-exist."; | |||
throw new TaskException( message ); | |||
} | |||
if( isCondition && forceOverwrite ) | |||
if( m_isCondition && m_forceOverwrite ) | |||
{ | |||
throw new TaskException( | |||
"ForceOverwrite cannot be used when conditions are being used." ); | |||
final String message = "ForceOverwrite cannot be used when conditions are being used."; | |||
throw new TaskException( message ); | |||
} | |||
if( fileext == null ) | |||
if( m_fileext == null ) | |||
{ | |||
fileext = "." + algorithm; | |||
m_fileext = "." + m_algorithm; | |||
} | |||
else if( fileext.trim().length() == 0 ) | |||
else if( m_fileext.trim().length() == 0 ) | |||
{ | |||
throw new TaskException( | |||
"File extension when specified must not be an empty string" ); | |||
final String message = "File extension when specified must not be an empty string"; | |||
throw new TaskException( message ); | |||
} | |||
messageDigest = null; | |||
if( provider != null ) | |||
setupMessageDigest(); | |||
if( m_messageDigest == null ) | |||
{ | |||
final String message = "Unable to create Message Digest"; | |||
throw new TaskException( message ); | |||
} | |||
addIncludes(); | |||
return generateChecksums(); | |||
} | |||
private void setupMessageDigest() | |||
throws TaskException | |||
{ | |||
m_messageDigest = null; | |||
if( m_provider != null ) | |||
{ | |||
try | |||
{ | |||
messageDigest = MessageDigest.getInstance( algorithm, provider ); | |||
m_messageDigest = MessageDigest.getInstance( m_algorithm, m_provider ); | |||
} | |||
catch( NoSuchAlgorithmException noalgo ) | |||
catch( final NoSuchAlgorithmException nsae ) | |||
{ | |||
throw new TaskException( noalgo.toString(), noalgo ); | |||
throw new TaskException( nsae.toString(), nsae ); | |||
} | |||
catch( NoSuchProviderException noprovider ) | |||
catch( final NoSuchProviderException nspe ) | |||
{ | |||
throw new TaskException( noprovider.toString(), noprovider ); | |||
throw new TaskException( nspe.toString(), nspe ); | |||
} | |||
} | |||
else | |||
{ | |||
try | |||
{ | |||
messageDigest = MessageDigest.getInstance( algorithm ); | |||
m_messageDigest = MessageDigest.getInstance( m_algorithm ); | |||
} | |||
catch( NoSuchAlgorithmException noalgo ) | |||
catch( final NoSuchAlgorithmException nsae ) | |||
{ | |||
throw new TaskException( noalgo.toString(), noalgo ); | |||
throw new TaskException( nsae.toString(), nsae ); | |||
} | |||
} | |||
} | |||
if( messageDigest == null ) | |||
{ | |||
throw new TaskException( "Unable to create Message Digest" ); | |||
} | |||
addToIncludeFileMap( file ); | |||
private void addIncludes() | |||
throws TaskException | |||
{ | |||
addToIncludeFileMap( m_file ); | |||
int sizeofFileSet = filesets.size(); | |||
for( int i = 0; i < sizeofFileSet; i++ ) | |||
final int size = m_filesets.size(); | |||
for( int i = 0; i < size; i++ ) | |||
{ | |||
FileSet fs = (FileSet)filesets.get( i ); | |||
DirectoryScanner ds = fs.getDirectoryScanner(); | |||
String[] srcFiles = ds.getIncludedFiles(); | |||
final FileSet fileSet = (FileSet)m_filesets.get( i ); | |||
final DirectoryScanner scanner = fileSet.getDirectoryScanner(); | |||
final String[] srcFiles = scanner.getIncludedFiles(); | |||
for( int j = 0; j < srcFiles.length; j++ ) | |||
{ | |||
File src = new File( fs.getDir(), srcFiles[ j ] ); | |||
final File src = new File( fileSet.getDir(), srcFiles[ j ] ); | |||
addToIncludeFileMap( src ); | |||
} | |||
} | |||
return generateChecksums(); | |||
} | |||
} |
@@ -106,17 +106,17 @@ public class Java | |||
/** | |||
* Creates a nested arg element. | |||
*/ | |||
public Argument createArg() | |||
public void addArg( final Argument argument ) | |||
{ | |||
return m_cmdl.createArgument(); | |||
m_cmdl.addArgument( argument ); | |||
} | |||
/** | |||
* Creates a nested jvmarg element. | |||
*/ | |||
public Argument createJvmarg() | |||
public void addJvmarg( final Argument argument ) | |||
{ | |||
return m_cmdl.createVmArgument(); | |||
m_cmdl.addVmArgument( argument ); | |||
} | |||
public void execute() | |||
@@ -192,7 +192,7 @@ public class Java | |||
for( int i = 0; i < size; i++ ) | |||
{ | |||
final String arg = (String)args.get( i ); | |||
java.createArgument().setValue( arg ); | |||
java.addArgument( arg ); | |||
} | |||
run( java ); | |||
} | |||
@@ -154,35 +154,35 @@ public class Patch | |||
if( m_backups ) | |||
{ | |||
cmd.createArgument().setValue( "-b" ); | |||
cmd.addArgument( "-b" ); | |||
} | |||
if( null != m_strip ) | |||
{ | |||
cmd.createArgument().setValue( "-p" + m_strip.intValue() ); | |||
cmd.addArgument( "-p" + m_strip.intValue() ); | |||
} | |||
if( m_quiet ) | |||
{ | |||
cmd.createArgument().setValue( "-s" ); | |||
cmd.addArgument( "-s" ); | |||
} | |||
if( m_reverse ) | |||
{ | |||
cmd.createArgument().setValue( "-R" ); | |||
cmd.addArgument( "-R" ); | |||
} | |||
cmd.createArgument().setValue( "-i" ); | |||
cmd.createArgument().setFile( m_patchFile ); | |||
cmd.addArgument( "-i" ); | |||
cmd.addArgument( m_patchFile ); | |||
if( m_ignorewhitespace ) | |||
{ | |||
cmd.createArgument().setValue( "-l" ); | |||
cmd.addArgument( "-l" ); | |||
} | |||
if( null != m_originalFile ) | |||
{ | |||
cmd.createArgument().setFile( m_originalFile ); | |||
cmd.addArgument( m_originalFile ); | |||
} | |||
return cmd; | |||
} | |||
@@ -22,6 +22,7 @@ import org.apache.tools.ant.types.SourceFileScanner; | |||
import org.apache.aut.tar.TarConstants; | |||
import org.apache.aut.tar.TarEntry; | |||
import org.apache.aut.tar.TarOutputStream; | |||
import org.apache.avalon.excalibur.io.IOUtil; | |||
/** | |||
* Creates a TAR archive. | |||
@@ -128,7 +129,7 @@ public class Tar | |||
} | |||
// add the main fileset to the list of filesets to process. | |||
TarFileSet mainFileSet = new TarFileSet( /*fileset*/ ); | |||
final TarFileSet mainFileSet = new TarFileSet( /*fileset*/ ); | |||
mainFileSet.setDir( baseDir ); | |||
filesets.add( mainFileSet ); | |||
} | |||
@@ -222,212 +223,88 @@ public class Tar | |||
} | |||
} | |||
protected boolean archiveIsUpToDate( String[] files ) | |||
private boolean archiveIsUpToDate( final String[] files ) | |||
throws TaskException | |||
{ | |||
SourceFileScanner sfs = new SourceFileScanner( this ); | |||
MergingMapper mm = new MergingMapper(); | |||
mm.setTo( tarFile.getAbsolutePath() ); | |||
return sfs.restrict( files, baseDir, null, mm ).length == 0; | |||
final SourceFileScanner scanner = new SourceFileScanner( this ); | |||
final MergingMapper mapper = new MergingMapper(); | |||
mapper.setTo( tarFile.getAbsolutePath() ); | |||
return scanner.restrict( files, baseDir, null, mapper ).length == 0; | |||
} | |||
protected void tarFile( File file, TarOutputStream tOut, String vPath, | |||
TarFileSet tarFileSet ) | |||
private void tarFile( final File file, | |||
final TarOutputStream output, | |||
String path, | |||
final TarFileSet tarFileSet ) | |||
throws IOException, TaskException | |||
{ | |||
FileInputStream fIn = null; | |||
// don't add "" to the archive | |||
if( vPath.length() <= 0 ) | |||
if( path.length() <= 0 ) | |||
{ | |||
return; | |||
} | |||
if( file.isDirectory() && !vPath.endsWith( "/" ) ) | |||
if( file.isDirectory() && !path.endsWith( "/" ) ) | |||
{ | |||
vPath += "/"; | |||
path += "/"; | |||
} | |||
try | |||
if( path.length() >= TarConstants.NAMELEN ) | |||
{ | |||
if( vPath.length() >= TarConstants.NAMELEN ) | |||
if( longFileMode.isOmitMode() ) | |||
{ | |||
if( longFileMode.isOmitMode() ) | |||
{ | |||
getLogger().info( "Omitting: " + vPath ); | |||
return; | |||
} | |||
else if( longFileMode.isWarnMode() ) | |||
{ | |||
final String message = "Entry: " + vPath + " longer than " + | |||
TarConstants.NAMELEN + " characters."; | |||
getLogger().warn( message ); | |||
if( !longWarningGiven ) | |||
{ | |||
final String message2 = "Resulting tar file can only be processed successfully" | |||
+ " by GNU compatible tar commands"; | |||
getLogger().warn( message2 ); | |||
longWarningGiven = true; | |||
} | |||
} | |||
else if( longFileMode.isFailMode() ) | |||
final String message = "Omitting: " + path; | |||
getLogger().info( message ); | |||
return; | |||
} | |||
else if( longFileMode.isWarnMode() ) | |||
{ | |||
final String message = "Entry: " + path + " longer than " + | |||
TarConstants.NAMELEN + " characters."; | |||
getLogger().warn( message ); | |||
if( !longWarningGiven ) | |||
{ | |||
throw new TaskException( | |||
"Entry: " + vPath + " longer than " + | |||
TarConstants.NAMELEN + "characters." ); | |||
final String message2 = "Resulting tar file can only be processed successfully" | |||
+ " by GNU compatible tar commands"; | |||
getLogger().warn( message2 ); | |||
longWarningGiven = true; | |||
} | |||
} | |||
TarEntry te = new TarEntry( vPath ); | |||
te.setModTime( file.lastModified() ); | |||
if( !file.isDirectory() ) | |||
else if( longFileMode.isFailMode() ) | |||
{ | |||
te.setSize( file.length() ); | |||
te.setMode( tarFileSet.getMode() ); | |||
final String message = "Entry: " + path + " longer than " + | |||
TarConstants.NAMELEN + "characters."; | |||
throw new TaskException( message ); | |||
} | |||
te.setUserName( tarFileSet.getUserName() ); | |||
te.setGroupName( tarFileSet.getGroup() ); | |||
tOut.putNextEntry( te ); | |||
} | |||
FileInputStream input = null; | |||
try | |||
{ | |||
final TarEntry entry = new TarEntry( path ); | |||
entry.setModTime( file.lastModified() ); | |||
if( !file.isDirectory() ) | |||
{ | |||
fIn = new FileInputStream( file ); | |||
byte[] buffer = new byte[ 8 * 1024 ]; | |||
int count = 0; | |||
do | |||
{ | |||
tOut.write( buffer, 0, count ); | |||
count = fIn.read( buffer, 0, buffer.length ); | |||
} while( count != -1 ); | |||
entry.setSize( file.length() ); | |||
entry.setMode( tarFileSet.getMode() ); | |||
} | |||
entry.setUserName( tarFileSet.getUserName() ); | |||
entry.setGroupName( tarFileSet.getGroup() ); | |||
tOut.closeEntry(); | |||
} | |||
finally | |||
{ | |||
if( fIn != null ) | |||
fIn.close(); | |||
} | |||
} | |||
public static class TarFileSet extends FileSet | |||
{ | |||
private String[] files = null; | |||
private int mode = 0100644; | |||
private String userName = ""; | |||
private String groupName = ""; | |||
public void setGroup( String groupName ) | |||
{ | |||
this.groupName = groupName; | |||
} | |||
output.putNextEntry( entry ); | |||
public void setMode( String octalString ) | |||
{ | |||
this.mode = 0100000 | Integer.parseInt( octalString, 8 ); | |||
} | |||
public void setUserName( String userName ) | |||
{ | |||
this.userName = userName; | |||
} | |||
/** | |||
* Get a list of files and directories specified in the fileset. | |||
* | |||
* @param p Description of Parameter | |||
* @return a list of file and directory names, relative to the baseDir | |||
* for the project. | |||
*/ | |||
public String[] getFiles() | |||
throws TaskException | |||
{ | |||
if( files == null ) | |||
if( !file.isDirectory() ) | |||
{ | |||
final DirectoryScanner scanner = getDirectoryScanner(); | |||
final String[] directories = scanner.getIncludedDirectories(); | |||
final String[] filesPerSe = scanner.getIncludedFiles(); | |||
files = new String[ directories.length + filesPerSe.length ]; | |||
System.arraycopy( directories, 0, files, 0, directories.length ); | |||
System.arraycopy( filesPerSe, 0, files, directories.length, | |||
filesPerSe.length ); | |||
input = new FileInputStream( file ); | |||
IOUtil.copy( input, output ); | |||
} | |||
return files; | |||
output.closeEntry(); | |||
} | |||
public String getGroup() | |||
{ | |||
return groupName; | |||
} | |||
public int getMode() | |||
{ | |||
return mode; | |||
} | |||
public String getUserName() | |||
{ | |||
return userName; | |||
} | |||
} | |||
/** | |||
* Valid Modes for LongFile attribute to Tar Task | |||
* | |||
* @author <a href="mailto:umagesh@apache.org">Magesh Umasankar</a> | |||
*/ | |||
public static class TarLongFileMode extends EnumeratedAttribute | |||
{ | |||
// permissable values for longfile attribute | |||
public final static String WARN = "warn"; | |||
public final static String FAIL = "fail"; | |||
public final static String TRUNCATE = "truncate"; | |||
public final static String GNU = "gnu"; | |||
public final static String OMIT = "omit"; | |||
private final String[] validModes = {WARN, FAIL, TRUNCATE, GNU, OMIT}; | |||
public TarLongFileMode() | |||
throws TaskException | |||
{ | |||
super(); | |||
setValue( WARN ); | |||
} | |||
public String[] getValues() | |||
{ | |||
return validModes; | |||
} | |||
public boolean isFailMode() | |||
{ | |||
return FAIL.equalsIgnoreCase( getValue() ); | |||
} | |||
public boolean isGnuMode() | |||
{ | |||
return GNU.equalsIgnoreCase( getValue() ); | |||
} | |||
public boolean isOmitMode() | |||
{ | |||
return OMIT.equalsIgnoreCase( getValue() ); | |||
} | |||
public boolean isTruncateMode() | |||
{ | |||
return TRUNCATE.equalsIgnoreCase( getValue() ); | |||
} | |||
public boolean isWarnMode() | |||
finally | |||
{ | |||
return WARN.equalsIgnoreCase( getValue() ); | |||
if( input != null ) | |||
input.close(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,75 @@ | |||
/* | |||
* Copyright (C) The Apache Software Foundation. All rights reserved. | |||
* | |||
* This software is published under the terms of the Apache Software License | |||
* version 1.1, a copy of which has been included with this distribution in | |||
* the LICENSE.txt file. | |||
*/ | |||
package org.apache.tools.ant.taskdefs; | |||
import org.apache.tools.ant.types.FileSet; | |||
import org.apache.tools.ant.types.DirectoryScanner; | |||
import org.apache.myrmidon.api.TaskException; | |||
public class TarFileSet | |||
extends FileSet | |||
{ | |||
private String[] m_files; | |||
private int m_mode = 0100644; | |||
private String m_userName = ""; | |||
private String m_groupName = ""; | |||
public void setGroup( final String groupName ) | |||
{ | |||
m_groupName = groupName; | |||
} | |||
public void setMode( final String octalString ) | |||
{ | |||
m_mode = 0100000 | Integer.parseInt( octalString, 8 ); | |||
} | |||
public void setUserName( final String userName ) | |||
{ | |||
m_userName = userName; | |||
} | |||
/** | |||
* Get a list of files and directories specified in the fileset. | |||
* | |||
* @return a list of file and directory names, relative to the baseDir | |||
* for the project. | |||
*/ | |||
protected String[] getFiles() | |||
throws TaskException | |||
{ | |||
if( m_files == null ) | |||
{ | |||
final DirectoryScanner scanner = getDirectoryScanner(); | |||
final String[] directories = scanner.getIncludedDirectories(); | |||
final String[] filesPerSe = scanner.getIncludedFiles(); | |||
m_files = new String[ directories.length + filesPerSe.length ]; | |||
System.arraycopy( directories, 0, m_files, 0, directories.length ); | |||
System.arraycopy( filesPerSe, 0, m_files, directories.length, | |||
filesPerSe.length ); | |||
} | |||
return m_files; | |||
} | |||
protected String getGroup() | |||
{ | |||
return m_groupName; | |||
} | |||
protected int getMode() | |||
{ | |||
return m_mode; | |||
} | |||
protected String getUserName() | |||
{ | |||
return m_userName; | |||
} | |||
} |
@@ -0,0 +1,66 @@ | |||
/* | |||
* Copyright (C) The Apache Software Foundation. All rights reserved. | |||
* | |||
* This software is published under the terms of the Apache Software License | |||
* version 1.1, a copy of which has been included with this distribution in | |||
* the LICENSE.txt file. | |||
*/ | |||
package org.apache.tools.ant.taskdefs; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.types.EnumeratedAttribute; | |||
/** | |||
* Valid Modes for LongFile attribute to Tar Task | |||
* | |||
* @author <a href="mailto:umagesh@apache.org">Magesh Umasankar</a> | |||
*/ | |||
public class TarLongFileMode | |||
extends EnumeratedAttribute | |||
{ | |||
// permissable values for longfile attribute | |||
public final static String WARN = "warn"; | |||
public final static String FAIL = "fail"; | |||
public final static String TRUNCATE = "truncate"; | |||
public final static String GNU = "gnu"; | |||
public final static String OMIT = "omit"; | |||
private final String[] validModes = {WARN, FAIL, TRUNCATE, GNU, OMIT}; | |||
public TarLongFileMode() | |||
throws TaskException | |||
{ | |||
super(); | |||
setValue( WARN ); | |||
} | |||
public String[] getValues() | |||
{ | |||
return validModes; | |||
} | |||
public boolean isFailMode() | |||
{ | |||
return FAIL.equalsIgnoreCase( getValue() ); | |||
} | |||
public boolean isGnuMode() | |||
{ | |||
return GNU.equalsIgnoreCase( getValue() ); | |||
} | |||
public boolean isOmitMode() | |||
{ | |||
return OMIT.equalsIgnoreCase( getValue() ); | |||
} | |||
public boolean isTruncateMode() | |||
{ | |||
return TRUNCATE.equalsIgnoreCase( getValue() ); | |||
} | |||
public boolean isWarnMode() | |||
{ | |||
return WARN.equalsIgnoreCase( getValue() ); | |||
} | |||
} |
@@ -20,6 +20,7 @@ import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.Path; | |||
import org.apache.tools.ant.types.FileSet; | |||
import org.apache.tools.ant.util.FileUtils; | |||
/** | |||
* This is the default implementation for the CompilerAdapter interface. | |||
@@ -133,7 +134,7 @@ public abstract class DefaultCompilerAdapter | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( memoryParameterPrefix + "ms" + m_memoryInitialSize ); | |||
cmd.addArgument( memoryParameterPrefix + "ms" + m_memoryInitialSize ); | |||
} | |||
} | |||
@@ -146,54 +147,54 @@ public abstract class DefaultCompilerAdapter | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( memoryParameterPrefix + "mx" + m_memoryMaximumSize ); | |||
cmd.addArgument( memoryParameterPrefix + "mx" + m_memoryMaximumSize ); | |||
} | |||
} | |||
if( m_attributes.getNowarn() ) | |||
{ | |||
cmd.createArgument().setValue( "-nowarn" ); | |||
cmd.addArgument( "-nowarn" ); | |||
} | |||
if( m_deprecation == true ) | |||
{ | |||
cmd.createArgument().setValue( "-deprecation" ); | |||
cmd.addArgument( "-deprecation" ); | |||
} | |||
if( m_destDir != null ) | |||
{ | |||
cmd.createArgument().setValue( "-d" ); | |||
cmd.createArgument().setFile( m_destDir ); | |||
cmd.addArgument( "-d" ); | |||
cmd.addArgument( m_destDir ); | |||
} | |||
cmd.createArgument().setValue( "-classpath" ); | |||
cmd.createArgument().setPath( classpath ); | |||
cmd.addArgument( "-classpath" ); | |||
cmd.addArguments( FileUtils.translateCommandline( classpath ) ); | |||
cmd.createArgument().setValue( "-sourcepath" ); | |||
cmd.createArgument().setPath( src ); | |||
cmd.addArgument( "-sourcepath" ); | |||
cmd.addArguments( FileUtils.translateCommandline( src ) ); | |||
if( target != null ) | |||
{ | |||
cmd.createArgument().setValue( "-target" ); | |||
cmd.createArgument().setValue( target ); | |||
cmd.addArgument( "-target" ); | |||
cmd.addArgument( target ); | |||
} | |||
if( m_bootclasspath != null ) | |||
{ | |||
cmd.createArgument().setValue( "-bootclasspath" ); | |||
cmd.createArgument().setPath( m_bootclasspath ); | |||
cmd.addArgument( "-bootclasspath" ); | |||
cmd.addArguments( FileUtils.translateCommandline( m_bootclasspath ) ); | |||
} | |||
if( m_extdirs != null ) | |||
{ | |||
cmd.createArgument().setValue( "-extdirs" ); | |||
cmd.createArgument().setPath( m_extdirs ); | |||
cmd.addArgument( "-extdirs" ); | |||
cmd.addArguments( FileUtils.translateCommandline( m_extdirs ) ); | |||
} | |||
if( m_encoding != null ) | |||
{ | |||
cmd.createArgument().setValue( "-encoding" ); | |||
cmd.createArgument().setValue( m_encoding ); | |||
cmd.addArgument( "-encoding" ); | |||
cmd.addArgument( m_encoding ); | |||
} | |||
if( m_debug ) | |||
{ | |||
@@ -202,30 +203,30 @@ public abstract class DefaultCompilerAdapter | |||
String debugLevel = m_attributes.getDebugLevel(); | |||
if( debugLevel != null ) | |||
{ | |||
cmd.createArgument().setValue( "-g:" + debugLevel ); | |||
cmd.addArgument( "-g:" + debugLevel ); | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( "-g" ); | |||
cmd.addArgument( "-g" ); | |||
} | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( "-g" ); | |||
cmd.addArgument( "-g" ); | |||
} | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( "-g:none" ); | |||
cmd.addArgument( "-g:none" ); | |||
} | |||
if( m_optimize ) | |||
{ | |||
cmd.createArgument().setValue( "-O" ); | |||
cmd.addArgument( "-O" ); | |||
} | |||
if( m_verbose ) | |||
{ | |||
cmd.createArgument().setValue( "-verbose" ); | |||
cmd.addArgument( "-verbose" ); | |||
} | |||
addCurrentCompilerArgs( cmd ); | |||
@@ -262,8 +263,8 @@ public abstract class DefaultCompilerAdapter | |||
setupJavacCommandlineSwitches( cmd, true ); | |||
if( m_attributes.getSource() != null ) | |||
{ | |||
cmd.createArgument().setValue( "-source" ); | |||
cmd.createArgument().setValue( m_attributes.getSource() ); | |||
cmd.addArgument( "-source" ); | |||
cmd.addArgument( m_attributes.getSource() ); | |||
} | |||
return cmd; | |||
} | |||
@@ -410,7 +411,7 @@ public abstract class DefaultCompilerAdapter | |||
for( int i = 0; i < m_compileList.length; i++ ) | |||
{ | |||
String arg = m_compileList[ i ].getAbsolutePath(); | |||
cmd.createArgument().setValue( arg ); | |||
cmd.addArgument( arg ); | |||
niceSourceList.append( " " + arg + StringUtil.LINE_SEPARATOR ); | |||
} | |||
@@ -10,6 +10,7 @@ package org.apache.tools.ant.taskdefs.compilers; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.Path; | |||
import org.apache.tools.ant.util.FileUtils; | |||
/** | |||
* The implementation of the gcj compiler. This is primarily a cut-and-paste | |||
@@ -72,8 +73,8 @@ public class Gcj extends DefaultCompilerAdapter | |||
if( m_destDir != null ) | |||
{ | |||
cmd.createArgument().setValue( "-d" ); | |||
cmd.createArgument().setFile( m_destDir ); | |||
cmd.addArgument( "-d" ); | |||
cmd.addArgument( m_destDir ); | |||
if( m_destDir.mkdirs() ) | |||
{ | |||
@@ -82,26 +83,26 @@ public class Gcj extends DefaultCompilerAdapter | |||
; | |||
} | |||
cmd.createArgument().setValue( "-classpath" ); | |||
cmd.createArgument().setPath( classpath ); | |||
cmd.addArgument( "-classpath" ); | |||
cmd.addArguments( FileUtils.translateCommandline( classpath ) ); | |||
if( m_encoding != null ) | |||
{ | |||
cmd.createArgument().setValue( "--encoding=" + m_encoding ); | |||
cmd.addArgument( "--encoding=" + m_encoding ); | |||
} | |||
if( m_debug ) | |||
{ | |||
cmd.createArgument().setValue( "-g1" ); | |||
cmd.addArgument( "-g1" ); | |||
} | |||
if( m_optimize ) | |||
{ | |||
cmd.createArgument().setValue( "-O" ); | |||
cmd.addArgument( "-O" ); | |||
} | |||
/** | |||
* gcj should be set for generate class. | |||
*/ | |||
cmd.createArgument().setValue( "-C" ); | |||
cmd.addArgument( "-C" ); | |||
addCurrentCompilerArgs( cmd ); | |||
@@ -10,6 +10,7 @@ package org.apache.tools.ant.taskdefs.compilers; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.Path; | |||
import org.apache.tools.ant.util.FileUtils; | |||
/** | |||
* The implementation of the jikes compiler. This is primarily a cut-and-paste | |||
@@ -83,37 +84,37 @@ public class Jikes | |||
cmd.setExecutable( "jikes" ); | |||
if( m_deprecation == true ) | |||
cmd.createArgument().setValue( "-deprecation" ); | |||
cmd.addArgument( "-deprecation" ); | |||
if( m_destDir != null ) | |||
{ | |||
cmd.createArgument().setValue( "-d" ); | |||
cmd.createArgument().setFile( m_destDir ); | |||
cmd.addArgument( "-d" ); | |||
cmd.addArgument( m_destDir ); | |||
} | |||
cmd.createArgument().setValue( "-classpath" ); | |||
cmd.createArgument().setPath( classpath ); | |||
cmd.addArgument( "-classpath" ); | |||
cmd.addArguments( FileUtils.translateCommandline( classpath ) ); | |||
if( m_encoding != null ) | |||
{ | |||
cmd.createArgument().setValue( "-encoding" ); | |||
cmd.createArgument().setValue( m_encoding ); | |||
cmd.addArgument( "-encoding" ); | |||
cmd.addArgument( m_encoding ); | |||
} | |||
if( m_debug ) | |||
{ | |||
cmd.createArgument().setValue( "-g" ); | |||
cmd.addArgument( "-g" ); | |||
} | |||
if( m_optimize ) | |||
{ | |||
cmd.createArgument().setValue( "-O" ); | |||
cmd.addArgument( "-O" ); | |||
} | |||
if( m_verbose ) | |||
{ | |||
cmd.createArgument().setValue( "-verbose" ); | |||
cmd.addArgument( "-verbose" ); | |||
} | |||
if( m_depend ) | |||
{ | |||
cmd.createArgument().setValue( "-depend" ); | |||
cmd.addArgument( "-depend" ); | |||
} | |||
if( m_attributes.getNowarn() ) | |||
@@ -124,7 +125,7 @@ public class Jikes | |||
* let the magic property win over the attribute for backwards | |||
* compatibility | |||
*/ | |||
cmd.createArgument().setValue( "-nowarn" ); | |||
cmd.addArgument( "-nowarn" ); | |||
} | |||
addCurrentCompilerArgs( cmd ); | |||
@@ -10,6 +10,7 @@ package org.apache.tools.ant.taskdefs.compilers; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.Path; | |||
import org.apache.tools.ant.util.FileUtils; | |||
/** | |||
* The implementation of the jvc compiler from microsoft. This is primarily a | |||
@@ -65,32 +66,32 @@ public class Jvc extends DefaultCompilerAdapter | |||
if( m_destDir != null ) | |||
{ | |||
cmd.createArgument().setValue( "/d" ); | |||
cmd.createArgument().setFile( m_destDir ); | |||
cmd.addArgument( "/d" ); | |||
cmd.addArgument( m_destDir ); | |||
} | |||
// Add the Classpath before the "internal" one. | |||
cmd.createArgument().setValue( "/cp:p" ); | |||
cmd.createArgument().setPath( classpath ); | |||
cmd.addArgument( "/cp:p" ); | |||
cmd.addArguments( FileUtils.translateCommandline( classpath ) ); | |||
// Enable MS-Extensions and ... | |||
cmd.createArgument().setValue( "/x-" ); | |||
cmd.addArgument( "/x-" ); | |||
// ... do not display a Message about this. | |||
cmd.createArgument().setValue( "/nomessage" ); | |||
cmd.addArgument( "/nomessage" ); | |||
// Do not display Logo | |||
cmd.createArgument().setValue( "/nologo" ); | |||
cmd.addArgument( "/nologo" ); | |||
if( m_debug ) | |||
{ | |||
cmd.createArgument().setValue( "/g" ); | |||
cmd.addArgument( "/g" ); | |||
} | |||
if( m_optimize ) | |||
{ | |||
cmd.createArgument().setValue( "/O" ); | |||
cmd.addArgument( "/O" ); | |||
} | |||
if( m_verbose ) | |||
{ | |||
cmd.createArgument().setValue( "/verbose" ); | |||
cmd.addArgument( "/verbose" ); | |||
} | |||
addCurrentCompilerArgs( cmd ); | |||
@@ -11,6 +11,7 @@ import java.lang.reflect.Method; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.Path; | |||
import org.apache.tools.ant.util.FileUtils; | |||
/** | |||
* The implementation of the Java compiler for KJC. This is primarily a | |||
@@ -72,17 +73,17 @@ public class Kjc extends DefaultCompilerAdapter | |||
if( m_deprecation == true ) | |||
{ | |||
cmd.createArgument().setValue( "-deprecation" ); | |||
cmd.addArgument( "-deprecation" ); | |||
} | |||
if( m_destDir != null ) | |||
{ | |||
cmd.createArgument().setValue( "-d" ); | |||
cmd.createArgument().setFile( m_destDir ); | |||
cmd.addArgument( "-d" ); | |||
cmd.addArgument( m_destDir ); | |||
} | |||
// generate the clsspath | |||
cmd.createArgument().setValue( "-classpath" ); | |||
cmd.addArgument( "-classpath" ); | |||
Path cp = new Path(); | |||
@@ -100,29 +101,29 @@ public class Kjc extends DefaultCompilerAdapter | |||
cp.append( classpath ); | |||
cp.append( src ); | |||
cmd.createArgument().setPath( cp ); | |||
cmd.addArguments( FileUtils.translateCommandline( cp ) ); | |||
// kjc-1.5A doesn't support -encoding option now. | |||
// but it will be supported near the feature. | |||
if( m_encoding != null ) | |||
{ | |||
cmd.createArgument().setValue( "-encoding" ); | |||
cmd.createArgument().setValue( m_encoding ); | |||
cmd.addArgument( "-encoding" ); | |||
cmd.addArgument( m_encoding ); | |||
} | |||
if( m_debug ) | |||
{ | |||
cmd.createArgument().setValue( "-g" ); | |||
cmd.addArgument( "-g" ); | |||
} | |||
if( m_optimize ) | |||
{ | |||
cmd.createArgument().setValue( "-O2" ); | |||
cmd.addArgument( "-O2" ); | |||
} | |||
if( m_verbose ) | |||
{ | |||
cmd.createArgument().setValue( "-verbose" ); | |||
cmd.addArgument( "-verbose" ); | |||
} | |||
addCurrentCompilerArgs( cmd ); | |||
@@ -162,12 +162,10 @@ public class ExecTask | |||
/** | |||
* Add a nested arg element - a command line argument. | |||
* | |||
* @return Description of the Returned Value | |||
*/ | |||
public Argument createArg() | |||
public void addArg( final Argument argument ) | |||
{ | |||
return m_command.createArgument(); | |||
m_command.addArgument( argument ); | |||
} | |||
/** | |||
@@ -20,6 +20,7 @@ import org.apache.aut.nativelib.Os; | |||
import org.apache.aut.nativelib.ExecOutputHandler; | |||
import org.apache.tools.ant.types.DirectoryScanner; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.util.FileUtils; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.FileSet; | |||
@@ -89,7 +90,7 @@ public class Javadoc | |||
public void setAccess( AccessType at ) | |||
{ | |||
m_command.createArgument().setValue( "-" + at.getValue() ); | |||
m_command.addArgument( "-" + at.getValue() ); | |||
} | |||
public void setAdditionalparam( String add ) | |||
@@ -155,14 +156,14 @@ public class Javadoc | |||
public void setDestdir( File dir ) | |||
{ | |||
m_destDir = dir; | |||
m_command.createArgument().setValue( "-d" ); | |||
m_command.createArgument().setFile( m_destDir ); | |||
m_command.addArgument( "-d" ); | |||
m_command.addArgument( m_destDir ); | |||
} | |||
public void setDocencoding( String enc ) | |||
{ | |||
m_command.createArgument().setValue( "-docencoding" ); | |||
m_command.createArgument().setValue( enc ); | |||
m_command.addArgument( "-docencoding" ); | |||
m_command.addArgument( enc ); | |||
} | |||
public void setDoclet( String src ) | |||
@@ -193,8 +194,8 @@ public class Javadoc | |||
public void setEncoding( String enc ) | |||
{ | |||
m_command.createArgument().setValue( "-encoding" ); | |||
m_command.createArgument().setValue( enc ); | |||
m_command.addArgument( "-encoding" ); | |||
m_command.addArgument( enc ); | |||
} | |||
public void setExcludePackageNames( String src ) | |||
@@ -211,8 +212,8 @@ public class Javadoc | |||
public void setExtdirs( String src ) | |||
{ | |||
m_command.createArgument().setValue( "-extdirs" ); | |||
m_command.createArgument().setValue( src ); | |||
m_command.addArgument( "-extdirs" ); | |||
m_command.addArgument( src ); | |||
} | |||
public void setFooter( String src ) | |||
@@ -236,8 +237,8 @@ public class Javadoc | |||
public void setHelpfile( File f ) | |||
{ | |||
m_command.createArgument().setValue( "-helpfile" ); | |||
m_command.createArgument().setFile( f ); | |||
m_command.addArgument( "-helpfile" ); | |||
m_command.addArgument( f ); | |||
} | |||
public void setLink( String src ) | |||
@@ -268,13 +269,13 @@ public class Javadoc | |||
public void setLocale( String src ) | |||
{ | |||
m_command.createArgument().setValue( "-locale" ); | |||
m_command.createArgument().setValue( src ); | |||
m_command.addArgument( "-locale" ); | |||
m_command.addArgument( src ); | |||
} | |||
public void setMaxmemory( final String max ) | |||
{ | |||
m_command.createArgument().setValue( "-J-Xmx" + max ); | |||
m_command.addArgument( "-J-Xmx" + max ); | |||
} | |||
public void setNodeprecated( boolean b ) | |||
@@ -314,8 +315,8 @@ public class Javadoc | |||
public void setOverview( File f ) | |||
{ | |||
m_command.createArgument().setValue( "-overview" ); | |||
m_command.createArgument().setFile( f ); | |||
m_command.addArgument( "-overview" ); | |||
m_command.addArgument( f ); | |||
} | |||
public void setPackage( boolean b ) | |||
@@ -393,8 +394,8 @@ public class Javadoc | |||
public void setStylesheetfile( File f ) | |||
{ | |||
m_command.createArgument().setValue( "-stylesheetfile" ); | |||
m_command.createArgument().setFile( f ); | |||
m_command.addArgument( "-stylesheetfile" ); | |||
m_command.addArgument( f ); | |||
} | |||
public void setUse( boolean b ) | |||
@@ -536,23 +537,23 @@ public class Javadoc | |||
if( m_doctitle != null ) | |||
{ | |||
m_command.createArgument().setValue( "-doctitle" ); | |||
m_command.createArgument().setValue( m_doctitle.getText() ); | |||
m_command.addArgument( "-doctitle" ); | |||
m_command.addArgument( m_doctitle.getText() ); | |||
} | |||
if( m_header != null ) | |||
{ | |||
m_command.createArgument().setValue( "-header" ); | |||
m_command.createArgument().setValue( m_header.getText() ); | |||
m_command.addArgument( "-header" ); | |||
m_command.addArgument( m_header.getText() ); | |||
} | |||
if( m_footer != null ) | |||
{ | |||
m_command.createArgument().setValue( "-footer" ); | |||
m_command.createArgument().setValue( m_footer.getText() ); | |||
m_command.addArgument( "-footer" ); | |||
m_command.addArgument( m_footer.getText() ); | |||
} | |||
if( m_bottom != null ) | |||
{ | |||
m_command.createArgument().setValue( "-bottom" ); | |||
m_command.createArgument().setValue( m_bottom.getText() ); | |||
m_command.addArgument( "-bottom" ); | |||
m_command.addArgument( m_bottom.getText() ); | |||
} | |||
Commandline cmd = new Commandline();//(Commandline)m_command.clone(); | |||
@@ -567,13 +568,13 @@ public class Javadoc | |||
{ | |||
classpath.addPath( m_classpath ); | |||
} | |||
cmd.createArgument().setValue( "-classpath" ); | |||
cmd.createArgument().setValue( classpath.toString() ); | |||
cmd.addArgument( "-classpath" ); | |||
cmd.addArgument( classpath.toString() ); | |||
if( m_version && m_doclet == null ) | |||
cmd.createArgument().setValue( "-version" ); | |||
cmd.addArgument( "-version" ); | |||
if( m_author && m_doclet == null ) | |||
cmd.createArgument().setValue( "-author" ); | |||
cmd.addArgument( "-author" ); | |||
if( m_doclet == null ) | |||
{ | |||
@@ -596,12 +597,12 @@ public class Javadoc | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( "-doclet" ); | |||
cmd.createArgument().setValue( m_doclet.getName() ); | |||
cmd.addArgument( "-doclet" ); | |||
cmd.addArgument( m_doclet.getName() ); | |||
if( m_doclet.getPath() != null ) | |||
{ | |||
cmd.createArgument().setValue( "-docletpath" ); | |||
cmd.createArgument().setPath( m_doclet.getPath() ); | |||
cmd.addArgument( "-docletpath" ); | |||
cmd.addArguments( FileUtils.translateCommandline( m_doclet.getPath() ) ); | |||
} | |||
for( Iterator e = m_doclet.getParams(); e.hasNext(); ) | |||
{ | |||
@@ -611,18 +612,18 @@ public class Javadoc | |||
throw new TaskException( "Doclet parameters must have a name" ); | |||
} | |||
cmd.createArgument().setValue( param.getName() ); | |||
cmd.addArgument( param.getName() ); | |||
if( param.getValue() != null ) | |||
{ | |||
cmd.createArgument().setValue( param.getValue() ); | |||
cmd.addArgument( param.getValue() ); | |||
} | |||
} | |||
} | |||
if( m_bootclasspath != null ) | |||
{ | |||
cmd.createArgument().setValue( "-bootclasspath" ); | |||
cmd.createArgument().setPath( m_bootclasspath ); | |||
cmd.addArgument( "-bootclasspath" ); | |||
cmd.addArguments( FileUtils.translateCommandline( m_bootclasspath ) ); | |||
} | |||
// add the links arguments | |||
@@ -648,9 +649,9 @@ public class Javadoc | |||
File packageList = new File( packageListLocation, "package-list" ); | |||
if( packageList.exists() ) | |||
{ | |||
cmd.createArgument().setValue( "-linkoffline" ); | |||
cmd.createArgument().setValue( la.getHref() ); | |||
cmd.createArgument().setValue( packageListLocation.getAbsolutePath() ); | |||
cmd.addArgument( "-linkoffline" ); | |||
cmd.addArgument( la.getHref() ); | |||
cmd.addArgument( packageListLocation.getAbsolutePath() ); | |||
} | |||
else | |||
{ | |||
@@ -659,8 +660,8 @@ public class Javadoc | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( "-link" ); | |||
cmd.createArgument().setValue( la.getHref() ); | |||
cmd.addArgument( "-link" ); | |||
cmd.addArgument( la.getHref() ); | |||
} | |||
} | |||
} | |||
@@ -687,9 +688,9 @@ public class Javadoc | |||
{ | |||
String name = grp.substring( 0, space ); | |||
String pkgList = grp.substring( space + 1 ); | |||
cmd.createArgument().setValue( "-group" ); | |||
cmd.createArgument().setValue( name ); | |||
cmd.createArgument().setValue( pkgList ); | |||
cmd.addArgument( "-group" ); | |||
cmd.addArgument( name ); | |||
cmd.addArgument( pkgList ); | |||
} | |||
} | |||
} | |||
@@ -706,9 +707,9 @@ public class Javadoc | |||
{ | |||
throw new TaskException( "The title and packages must be specified for group elements." ); | |||
} | |||
cmd.createArgument().setValue( "-group" ); | |||
cmd.createArgument().setValue( title ); | |||
cmd.createArgument().setValue( packages ); | |||
cmd.addArgument( "-group" ); | |||
cmd.addArgument( title ); | |||
cmd.addArgument( packages ); | |||
} | |||
} | |||
@@ -729,7 +730,7 @@ public class Javadoc | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( name ); | |||
cmd.addArgument( name ); | |||
} | |||
} | |||
@@ -763,7 +764,7 @@ public class Javadoc | |||
if( m_tmpList == null ) | |||
{ | |||
m_tmpList = File.createTempFile( "javadoc", "", getBaseDirectory() ); | |||
cmd.createArgument().setValue( "@" + m_tmpList.getAbsolutePath() ); | |||
cmd.addArgument( "@" + m_tmpList.getAbsolutePath() ); | |||
} | |||
srcListWriter = new PrintWriter( new FileWriter( m_tmpList.getAbsolutePath(), | |||
true ) ); | |||
@@ -780,7 +781,7 @@ public class Javadoc | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( sourceFileName ); | |||
cmd.addArgument( sourceFileName ); | |||
} | |||
} | |||
@@ -800,7 +801,7 @@ public class Javadoc | |||
if( m_packageList != null ) | |||
{ | |||
cmd.createArgument().setValue( "@" + m_packageList ); | |||
cmd.addArgument( "@" + m_packageList ); | |||
} | |||
getLogger().debug( "Javadoc args: " + cmd ); | |||
@@ -873,8 +874,8 @@ public class Javadoc | |||
{ | |||
if( value != null && value.length() != 0 ) | |||
{ | |||
m_command.createArgument().setValue( key ); | |||
m_command.createArgument().setValue( value ); | |||
m_command.addArgument( key ); | |||
m_command.addArgument( value ); | |||
} | |||
else | |||
{ | |||
@@ -886,7 +887,7 @@ public class Javadoc | |||
{ | |||
if( b ) | |||
{ | |||
m_command.createArgument().setValue( arg ); | |||
m_command.addArgument( arg ); | |||
} | |||
} | |||
@@ -969,7 +970,7 @@ public class Javadoc | |||
if( m_useExternalFile ) | |||
{ | |||
m_tmpList = File.createTempFile( "javadoc", "", getBaseDirectory() ); | |||
toExecute.createArgument().setValue( "@" + m_tmpList.getAbsolutePath() ); | |||
toExecute.addArgument( "@" + m_tmpList.getAbsolutePath() ); | |||
packageListWriter = new PrintWriter( new FileWriter( m_tmpList ) ); | |||
} | |||
@@ -1008,7 +1009,7 @@ public class Javadoc | |||
} | |||
else | |||
{ | |||
toExecute.createArgument().setValue( pkgDir ); | |||
toExecute.addArgument( pkgDir ); | |||
} | |||
addedPackages.add( pkgDir ); | |||
} | |||
@@ -105,9 +105,9 @@ public class ANTLR extends Task | |||
* the JVM. | |||
* @see #setFork(boolean) | |||
*/ | |||
public Argument createJvmarg() | |||
public void addJvmarg( final Argument argument ) | |||
{ | |||
return commandline.createVmArgument(); | |||
commandline.addVmArgument( argument ); | |||
} | |||
public void execute() | |||
@@ -122,9 +122,9 @@ public class ANTLR extends Task | |||
//TODO: use ANTLR to parse the grammer file to do this. | |||
if( target.lastModified() > getGeneratedFile().lastModified() ) | |||
{ | |||
commandline.createArgument().setValue( "-o" ); | |||
commandline.createArgument().setValue( outputDirectory.toString() ); | |||
commandline.createArgument().setValue( target.toString() ); | |||
commandline.addArgument( "-o" ); | |||
commandline.addArgument( outputDirectory.toString() ); | |||
commandline.addArgument( target.toString() ); | |||
if( fork ) | |||
{ | |||
@@ -247,13 +247,13 @@ public class Cab | |||
{ | |||
final Commandline cmd = new Commandline(); | |||
cmd.setExecutable( "cabarc" ); | |||
cmd.createArgument().setValue( "-r" ); | |||
cmd.createArgument().setValue( "-p" ); | |||
cmd.addArgument( "-r" ); | |||
cmd.addArgument( "-p" ); | |||
if( !m_compress ) | |||
{ | |||
cmd.createArgument().setValue( "-m" ); | |||
cmd.createArgument().setValue( "none" ); | |||
cmd.addArgument( "-m" ); | |||
cmd.addArgument( "none" ); | |||
} | |||
if( m_options != null ) | |||
@@ -261,9 +261,9 @@ public class Cab | |||
cmd.createArgument().setLine( m_options ); | |||
} | |||
cmd.createArgument().setValue( "n" ); | |||
cmd.createArgument().setFile( m_cabFile ); | |||
cmd.createArgument().setValue( "@" + listFile.getAbsolutePath() ); | |||
cmd.addArgument( "n" ); | |||
cmd.addArgument( m_cabFile ); | |||
cmd.addArgument( "@" + listFile.getAbsolutePath() ); | |||
return cmd; | |||
} | |||
@@ -17,6 +17,7 @@ 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.Path; | |||
import org.apache.tools.ant.util.FileUtils; | |||
/** | |||
* Task to generate JNI header files using javah. This task can take the | |||
@@ -219,7 +220,7 @@ public class Javah | |||
while( tok.hasMoreTokens() ) | |||
{ | |||
final String aClass = tok.nextToken().trim(); | |||
cmd.createArgument().setValue( aClass ); | |||
cmd.addArgument( aClass ); | |||
niceClassList.append( " " + aClass + StringUtil.LINE_SEPARATOR ); | |||
n++; | |||
} | |||
@@ -230,7 +231,7 @@ public class Javah | |||
{ | |||
final ClassArgument arg = (ClassArgument)enum.next(); | |||
final String aClass = arg.getName(); | |||
cmd.createArgument().setValue( aClass ); | |||
cmd.addArgument( aClass ); | |||
niceClassList.append( " " + aClass + StringUtil.LINE_SEPARATOR ); | |||
n++; | |||
} | |||
@@ -256,33 +257,33 @@ public class Javah | |||
if( m_destDir != null ) | |||
{ | |||
cmd.createArgument().setValue( "-d" ); | |||
cmd.createArgument().setFile( m_destDir ); | |||
cmd.addArgument( "-d" ); | |||
cmd.addArgument( m_destDir ); | |||
} | |||
if( m_outputFile != null ) | |||
{ | |||
cmd.createArgument().setValue( "-o" ); | |||
cmd.createArgument().setFile( m_outputFile ); | |||
cmd.addArgument( "-o" ); | |||
cmd.addArgument( m_outputFile ); | |||
} | |||
if( m_classpath != null ) | |||
{ | |||
cmd.createArgument().setValue( "-classpath" ); | |||
cmd.createArgument().setPath( m_classpath ); | |||
cmd.addArgument( "-classpath" ); | |||
cmd.addArguments( FileUtils.translateCommandline( m_classpath ) ); | |||
} | |||
if( m_verbose ) | |||
{ | |||
cmd.createArgument().setValue( "-verbose" ); | |||
cmd.addArgument( "-verbose" ); | |||
} | |||
if( m_old ) | |||
{ | |||
cmd.createArgument().setValue( "-old" ); | |||
cmd.addArgument( "-old" ); | |||
} | |||
if( m_force ) | |||
{ | |||
cmd.createArgument().setValue( "-force" ); | |||
cmd.addArgument( "-force" ); | |||
} | |||
if( m_stubs ) | |||
@@ -292,12 +293,12 @@ public class Javah | |||
final String message = "stubs only available in old mode."; | |||
throw new TaskException( message ); | |||
} | |||
cmd.createArgument().setValue( "-stubs" ); | |||
cmd.addArgument( "-stubs" ); | |||
} | |||
if( m_bootclasspath != null ) | |||
{ | |||
cmd.createArgument().setValue( "-bootclasspath" ); | |||
cmd.createArgument().setPath( m_bootclasspath ); | |||
cmd.addArgument( "-bootclasspath" ); | |||
cmd.addArguments( FileUtils.translateCommandline( m_bootclasspath ) ); | |||
} | |||
logAndAddFilesToCompile( cmd ); | |||
@@ -115,7 +115,7 @@ public class CCMCheck extends Continuus | |||
// ccm co /t .. files | |||
// as specified in the CLEARTOOL.EXE help | |||
commandLine.setExecutable( getCcmCommand() ); | |||
commandLine.createArgument().setValue( getCcmAction() ); | |||
commandLine.addArgument( getCcmAction() ); | |||
checkOptions( commandLine ); | |||
@@ -136,19 +136,19 @@ public class CCMCheck extends Continuus | |||
{ | |||
if( getComment() != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_COMMENT ); | |||
cmd.createArgument().setValue( getComment() ); | |||
cmd.addArgument( FLAG_COMMENT ); | |||
cmd.addArgument( getComment() ); | |||
} | |||
if( getTask() != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_TASK ); | |||
cmd.createArgument().setValue( getTask() ); | |||
cmd.addArgument( FLAG_TASK ); | |||
cmd.addArgument( getTask() ); | |||
}// end of if () | |||
if( getFile() != null ) | |||
{ | |||
cmd.createArgument().setValue( _file.getAbsolutePath() ); | |||
cmd.addArgument( _file.getAbsolutePath() ); | |||
}// end of if () | |||
} | |||
} | |||
@@ -143,8 +143,8 @@ public class CCMCreateTask | |||
//create task ok, set this task as the default one | |||
final Commandline cmd = new Commandline(); | |||
cmd.setExecutable( getCcmCommand() ); | |||
cmd.createArgument().setValue( COMMAND_DEFAULT_TASK ); | |||
cmd.createArgument().setValue( m_task ); | |||
cmd.addArgument( COMMAND_DEFAULT_TASK ); | |||
cmd.addArgument( m_task ); | |||
getLogger().debug( commandLine.toString() ); | |||
@@ -164,7 +164,7 @@ public class CCMCreateTask | |||
// build the command line from what we got the format | |||
// as specified in the CCM.EXE help | |||
commandLine.setExecutable( getCcmCommand() ); | |||
commandLine.createArgument().setValue( getCcmAction() ); | |||
commandLine.addArgument( getCcmAction() ); | |||
checkOptions( commandLine ); | |||
@@ -184,32 +184,32 @@ public class CCMCreateTask | |||
{ | |||
if( m_comment != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_COMMENT ); | |||
cmd.createArgument().setValue( "\"" + m_comment + "\"" ); | |||
cmd.addArgument( FLAG_COMMENT ); | |||
cmd.addArgument( "\"" + m_comment + "\"" ); | |||
} | |||
if( m_platform != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_PLATFORM ); | |||
cmd.createArgument().setValue( m_platform ); | |||
cmd.addArgument( FLAG_PLATFORM ); | |||
cmd.addArgument( m_platform ); | |||
} | |||
if( m_resolver != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_RESOLVER ); | |||
cmd.createArgument().setValue( m_resolver ); | |||
cmd.addArgument( FLAG_RESOLVER ); | |||
cmd.addArgument( m_resolver ); | |||
} | |||
if( m_subSystem != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_SUBSYSTEM ); | |||
cmd.createArgument().setValue( "\"" + m_subSystem + "\"" ); | |||
cmd.addArgument( FLAG_SUBSYSTEM ); | |||
cmd.addArgument( "\"" + m_subSystem + "\"" ); | |||
} | |||
if( m_release != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_RELEASE ); | |||
cmd.createArgument().setValue( m_release ); | |||
cmd.addArgument( FLAG_RELEASE ); | |||
cmd.addArgument( m_release ); | |||
} | |||
} | |||
@@ -81,7 +81,7 @@ public class CCMReconfigure | |||
// build the command line from what we got the format | |||
// as specified in the CCM.EXE help | |||
cmd.setExecutable( getCcmCommand() ); | |||
cmd.createArgument().setValue( getCcmAction() ); | |||
cmd.addArgument( getCcmAction() ); | |||
checkOptions( cmd ); | |||
@@ -100,18 +100,18 @@ public class CCMReconfigure | |||
{ | |||
if( m_recurse == true ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_RECURSE ); | |||
cmd.addArgument( FLAG_RECURSE ); | |||
} | |||
if( m_verbose == true ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_VERBOSE ); | |||
cmd.addArgument( FLAG_VERBOSE ); | |||
} | |||
if( m_ccmProject != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_PROJECT ); | |||
cmd.createArgument().setValue( m_ccmProject ); | |||
cmd.addArgument( FLAG_PROJECT ); | |||
cmd.addArgument( m_ccmProject ); | |||
} | |||
} | |||
} | |||
@@ -335,7 +335,7 @@ public class CCCheckin extends ClearCase | |||
// cleartool checkin [options...] [viewpath ...] | |||
// as specified in the CLEARTOOL.EXE help | |||
commandLine.setExecutable( getClearToolCommand() ); | |||
commandLine.createArgument().setValue( COMMAND_CHECKIN ); | |||
commandLine.addArgument( COMMAND_CHECKIN ); | |||
checkOptions( commandLine ); | |||
@@ -362,8 +362,8 @@ public class CCCheckin extends ClearCase | |||
* Windows filename with a space and it is enclosed in double | |||
* quotes ("). This breaks clearcase. | |||
*/ | |||
cmd.createArgument().setValue( FLAG_COMMENT ); | |||
cmd.createArgument().setValue( getComment() ); | |||
cmd.addArgument( FLAG_COMMENT ); | |||
cmd.addArgument( getComment() ); | |||
} | |||
} | |||
@@ -382,8 +382,8 @@ public class CCCheckin extends ClearCase | |||
* Windows filename with a space and it is enclosed in double | |||
* quotes ("). This breaks clearcase. | |||
*/ | |||
cmd.createArgument().setValue( FLAG_COMMENTFILE ); | |||
cmd.createArgument().setValue( getCommentFile() ); | |||
cmd.addArgument( FLAG_COMMENTFILE ); | |||
cmd.addArgument( getCommentFile() ); | |||
} | |||
} | |||
@@ -408,36 +408,36 @@ public class CCCheckin extends ClearCase | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( FLAG_NOCOMMENT ); | |||
cmd.addArgument( FLAG_NOCOMMENT ); | |||
} | |||
} | |||
if( getNoWarn() ) | |||
{ | |||
// -nwarn | |||
cmd.createArgument().setValue( FLAG_NOWARN ); | |||
cmd.addArgument( FLAG_NOWARN ); | |||
} | |||
if( getPreserveTime() ) | |||
{ | |||
// -ptime | |||
cmd.createArgument().setValue( FLAG_PRESERVETIME ); | |||
cmd.addArgument( FLAG_PRESERVETIME ); | |||
} | |||
if( getKeepCopy() ) | |||
{ | |||
// -keep | |||
cmd.createArgument().setValue( FLAG_KEEPCOPY ); | |||
cmd.addArgument( FLAG_KEEPCOPY ); | |||
} | |||
if( getIdentical() ) | |||
{ | |||
// -identical | |||
cmd.createArgument().setValue( FLAG_IDENTICAL ); | |||
cmd.addArgument( FLAG_IDENTICAL ); | |||
} | |||
// viewpath | |||
cmd.createArgument().setValue( getViewPath() ); | |||
cmd.addArgument( getViewPath() ); | |||
} | |||
} | |||
@@ -423,7 +423,7 @@ public class CCCheckout extends ClearCase | |||
// cleartool checkout [options...] [viewpath ...] | |||
// as specified in the CLEARTOOL.EXE help | |||
commandLine.setExecutable( getClearToolCommand() ); | |||
commandLine.createArgument().setValue( COMMAND_CHECKOUT ); | |||
commandLine.addArgument( COMMAND_CHECKOUT ); | |||
checkOptions( commandLine ); | |||
@@ -450,8 +450,8 @@ public class CCCheckout extends ClearCase | |||
* Windows filename with a space and it is enclosed in double | |||
* quotes ("). This breaks clearcase. | |||
*/ | |||
cmd.createArgument().setValue( FLAG_BRANCH ); | |||
cmd.createArgument().setValue( getBranch() ); | |||
cmd.addArgument( FLAG_BRANCH ); | |||
cmd.addArgument( getBranch() ); | |||
} | |||
} | |||
@@ -470,8 +470,8 @@ public class CCCheckout extends ClearCase | |||
* Windows filename with a space and it is enclosed in double | |||
* quotes ("). This breaks clearcase. | |||
*/ | |||
cmd.createArgument().setValue( FLAG_COMMENT ); | |||
cmd.createArgument().setValue( getComment() ); | |||
cmd.addArgument( FLAG_COMMENT ); | |||
cmd.addArgument( getComment() ); | |||
} | |||
} | |||
@@ -490,8 +490,8 @@ public class CCCheckout extends ClearCase | |||
* Windows filename with a space and it is enclosed in double | |||
* quotes ("). This breaks clearcase. | |||
*/ | |||
cmd.createArgument().setValue( FLAG_COMMENTFILE ); | |||
cmd.createArgument().setValue( getCommentFile() ); | |||
cmd.addArgument( FLAG_COMMENTFILE ); | |||
cmd.addArgument( getCommentFile() ); | |||
} | |||
} | |||
@@ -510,8 +510,8 @@ public class CCCheckout extends ClearCase | |||
* Windows filename with a space and it is enclosed in double | |||
* quotes ("). This breaks clearcase. | |||
*/ | |||
cmd.createArgument().setValue( FLAG_OUT ); | |||
cmd.createArgument().setValue( getOut() ); | |||
cmd.addArgument( FLAG_OUT ); | |||
cmd.addArgument( getOut() ); | |||
} | |||
} | |||
@@ -526,12 +526,12 @@ public class CCCheckout extends ClearCase | |||
if( getReserved() ) | |||
{ | |||
// -reserved | |||
cmd.createArgument().setValue( FLAG_RESERVED ); | |||
cmd.addArgument( FLAG_RESERVED ); | |||
} | |||
else | |||
{ | |||
// -unreserved | |||
cmd.createArgument().setValue( FLAG_UNRESERVED ); | |||
cmd.addArgument( FLAG_UNRESERVED ); | |||
} | |||
if( getOut() != null ) | |||
@@ -544,7 +544,7 @@ public class CCCheckout extends ClearCase | |||
if( getNoData() ) | |||
{ | |||
// -ndata | |||
cmd.createArgument().setValue( FLAG_NODATA ); | |||
cmd.addArgument( FLAG_NODATA ); | |||
} | |||
} | |||
@@ -559,7 +559,7 @@ public class CCCheckout extends ClearCase | |||
if( getVersion() ) | |||
{ | |||
// -version | |||
cmd.createArgument().setValue( FLAG_VERSION ); | |||
cmd.addArgument( FLAG_VERSION ); | |||
} | |||
} | |||
@@ -567,7 +567,7 @@ public class CCCheckout extends ClearCase | |||
if( getNoWarn() ) | |||
{ | |||
// -nwarn | |||
cmd.createArgument().setValue( FLAG_NOWARN ); | |||
cmd.addArgument( FLAG_NOWARN ); | |||
} | |||
if( getComment() != null ) | |||
@@ -584,12 +584,12 @@ public class CCCheckout extends ClearCase | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( FLAG_NOCOMMENT ); | |||
cmd.addArgument( FLAG_NOCOMMENT ); | |||
} | |||
} | |||
// viewpath | |||
cmd.createArgument().setValue( getViewPath() ); | |||
cmd.addArgument( getViewPath() ); | |||
} | |||
} | |||
@@ -127,7 +127,7 @@ public class CCUnCheckout extends ClearCase | |||
// cleartool uncheckout [options...] [viewpath ...] | |||
// as specified in the CLEARTOOL.EXE help | |||
commandLine.setExecutable( getClearToolCommand() ); | |||
commandLine.createArgument().setValue( COMMAND_UNCHECKOUT ); | |||
commandLine.addArgument( COMMAND_UNCHECKOUT ); | |||
checkOptions( commandLine ); | |||
@@ -150,16 +150,16 @@ public class CCUnCheckout extends ClearCase | |||
if( getKeepCopy() ) | |||
{ | |||
// -keep | |||
cmd.createArgument().setValue( FLAG_KEEPCOPY ); | |||
cmd.addArgument( FLAG_KEEPCOPY ); | |||
} | |||
else | |||
{ | |||
// -rm | |||
cmd.createArgument().setValue( FLAG_RM ); | |||
cmd.addArgument( FLAG_RM ); | |||
} | |||
// viewpath | |||
cmd.createArgument().setValue( getViewPath() ); | |||
cmd.addArgument( getViewPath() ); | |||
} | |||
} | |||
@@ -336,7 +336,7 @@ public class CCUpdate extends ClearCase | |||
// cleartool update [options...] [viewpath ...] | |||
// as specified in the CLEARTOOL.EXE help | |||
commandLine.setExecutable( getClearToolCommand() ); | |||
commandLine.createArgument().setValue( COMMAND_UPDATE ); | |||
commandLine.addArgument( COMMAND_UPDATE ); | |||
// Check the command line options | |||
checkOptions( commandLine ); | |||
@@ -371,8 +371,8 @@ public class CCUpdate extends ClearCase | |||
* Windows filename with a space and it is enclosed in double | |||
* quotes ("). This breaks clearcase. | |||
*/ | |||
cmd.createArgument().setValue( FLAG_LOG ); | |||
cmd.createArgument().setValue( getLog() ); | |||
cmd.addArgument( FLAG_LOG ); | |||
cmd.addArgument( getLog() ); | |||
} | |||
} | |||
@@ -387,40 +387,40 @@ public class CCUpdate extends ClearCase | |||
if( getGraphical() ) | |||
{ | |||
// -graphical | |||
cmd.createArgument().setValue( FLAG_GRAPHICAL ); | |||
cmd.addArgument( FLAG_GRAPHICAL ); | |||
} | |||
else | |||
{ | |||
if( getOverwrite() ) | |||
{ | |||
// -overwrite | |||
cmd.createArgument().setValue( FLAG_OVERWRITE ); | |||
cmd.addArgument( FLAG_OVERWRITE ); | |||
} | |||
else | |||
{ | |||
if( getRename() ) | |||
{ | |||
// -rename | |||
cmd.createArgument().setValue( FLAG_RENAME ); | |||
cmd.addArgument( FLAG_RENAME ); | |||
} | |||
else | |||
{ | |||
// -noverwrite | |||
cmd.createArgument().setValue( FLAG_NOVERWRITE ); | |||
cmd.addArgument( FLAG_NOVERWRITE ); | |||
} | |||
} | |||
if( getCurrentTime() ) | |||
{ | |||
// -ctime | |||
cmd.createArgument().setValue( FLAG_CURRENTTIME ); | |||
cmd.addArgument( FLAG_CURRENTTIME ); | |||
} | |||
else | |||
{ | |||
if( getPreserveTime() ) | |||
{ | |||
// -ptime | |||
cmd.createArgument().setValue( FLAG_PRESERVETIME ); | |||
cmd.addArgument( FLAG_PRESERVETIME ); | |||
} | |||
} | |||
@@ -429,7 +429,7 @@ public class CCUpdate extends ClearCase | |||
} | |||
// viewpath | |||
cmd.createArgument().setValue( getViewPath() ); | |||
cmd.addArgument( getViewPath() ); | |||
} | |||
} | |||
@@ -125,7 +125,7 @@ public class NetCommand | |||
{ | |||
if( argument != null && argument.length() != 0 ) | |||
{ | |||
_commandLine.createArgument().setValue( argument ); | |||
_commandLine.addArgument( argument ); | |||
} | |||
} | |||
@@ -23,6 +23,7 @@ import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler; | |||
import org.apache.tools.ant.types.Argument; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.Path; | |||
import org.apache.tools.ant.util.FileUtils; | |||
/** | |||
* BorlandDeploymentTool is dedicated to the Borland Application Server 4.5 and | |||
@@ -392,24 +393,24 @@ public class BorlandDeploymentTool | |||
//debug ? | |||
if( java2iiopdebug ) | |||
{ | |||
cmd.createArgument().setValue( "-VBJdebug" ); | |||
cmd.addArgument( "-VBJdebug" ); | |||
}// end of if () | |||
//set the classpath | |||
cmd.createArgument().setValue( "-VBJclasspath" ); | |||
cmd.createArgument().setPath( getCombinedClasspath() ); | |||
cmd.addArgument( "-VBJclasspath" ); | |||
cmd.addArguments( FileUtils.translateCommandline( getCombinedClasspath() ) ); | |||
//list file | |||
cmd.createArgument().setValue( "-list_files" ); | |||
cmd.addArgument( "-list_files" ); | |||
//no TIE classes | |||
cmd.createArgument().setValue( "-no_tie" ); | |||
cmd.addArgument( "-no_tie" ); | |||
//root dir | |||
cmd.createArgument().setValue( "-root_dir" ); | |||
cmd.createArgument().setValue( getConfig().srcDir.getAbsolutePath() ); | |||
cmd.addArgument( "-root_dir" ); | |||
cmd.addArgument( getConfig().srcDir.getAbsolutePath() ); | |||
//compiling order | |||
cmd.createArgument().setValue( "-compile" ); | |||
cmd.addArgument( "-compile" ); | |||
//add the home class | |||
while( ithomes.hasNext() ) | |||
{ | |||
cmd.createArgument().setValue( ithomes.next().toString() ); | |||
cmd.addArgument( ithomes.next().toString() ); | |||
} | |||
return cmd; | |||
} | |||
@@ -178,20 +178,20 @@ public class BorlandGenerateClient extends Task | |||
{ | |||
final Commandline cmd = new Commandline(); | |||
cmd.setExecutable( "iastool" ); | |||
cmd.createArgument().setValue( "generateclient" ); | |||
cmd.addArgument( "generateclient" ); | |||
if( debug ) | |||
{ | |||
cmd.createArgument().setValue( "-trace" ); | |||
cmd.addArgument( "-trace" ); | |||
} | |||
cmd.createArgument().setValue( "-short" ); | |||
cmd.createArgument().setValue( "-jarfile" ); | |||
cmd.addArgument( "-short" ); | |||
cmd.addArgument( "-jarfile" ); | |||
// ejb jar file | |||
cmd.createArgument().setValue( ejbjarfile.getAbsolutePath() ); | |||
cmd.addArgument( ejbjarfile.getAbsolutePath() ); | |||
//client jar file | |||
cmd.createArgument().setValue( "-single" ); | |||
cmd.createArgument().setValue( "-clientjarfile" ); | |||
cmd.createArgument().setValue( clientjarfile.getAbsolutePath() ); | |||
cmd.addArgument( "-single" ); | |||
cmd.addArgument( "-clientjarfile" ); | |||
cmd.addArgument( clientjarfile.getAbsolutePath() ); | |||
return cmd; | |||
} | |||
@@ -137,7 +137,7 @@ public class JJTree extends Task | |||
{ | |||
String name = (String)iter.nextElement(); | |||
Object value = optionalAttrs.get( name ); | |||
cmdl.createArgument().setValue( "-" + name + ":" + value.toString() ); | |||
cmdl.addArgument( "-" + name + ":" + value.toString() ); | |||
} | |||
if( target == null || !target.isFile() ) | |||
@@ -156,8 +156,7 @@ public class JJTree extends Task | |||
} | |||
// convert backslashes to slashes, otherwise jjtree will put this as | |||
// comments and this seems to confuse javacc | |||
cmdl.createArgument().setValue( | |||
"-OUTPUT_DIRECTORY:" + outputDirectory.getAbsolutePath().replace( '\\', '/' ) ); | |||
cmdl.addArgument( "-OUTPUT_DIRECTORY:" + outputDirectory.getAbsolutePath().replace( '\\', '/' ) ); | |||
String targetName = target.getName(); | |||
final File javaFile = new File( outputDirectory, | |||
@@ -167,7 +166,7 @@ public class JJTree extends Task | |||
getLogger().info( "Target is already built - skipping (" + target + ")" ); | |||
return; | |||
} | |||
cmdl.createArgument().setValue( target.getAbsolutePath() ); | |||
cmdl.addArgument( target.getAbsolutePath() ); | |||
if( javaccHome == null || !javaccHome.isDirectory() ) | |||
{ | |||
@@ -177,9 +176,8 @@ public class JJTree extends Task | |||
classpath.addLocation( new File( javaccHome, "JavaCC.zip" ) ); | |||
classpath.addJavaRuntime(); | |||
final Argument arg = cmdl.createVmArgument(); | |||
arg.setValue( "-mx140M" ); | |||
arg.setValue( "-Dinstall.root=" + javaccHome.getAbsolutePath() ); | |||
cmdl.addVmArgument( "-mx140M" ); | |||
cmdl.addVmArgument( "-Dinstall.root=" + javaccHome.getAbsolutePath() ); | |||
final Execute2 exe = new Execute2(); | |||
setupLogger( exe ); | |||
@@ -193,7 +193,7 @@ public class JavaCC extends Task | |||
{ | |||
String name = (String)iter.nextElement(); | |||
Object value = optionalAttrs.get( name ); | |||
cmdl.createArgument().setValue( "-" + name + ":" + value.toString() ); | |||
cmdl.addArgument( "-" + name + ":" + value.toString() ); | |||
} | |||
// check the target is a file | |||
@@ -211,8 +211,7 @@ public class JavaCC extends Task | |||
{ | |||
throw new TaskException( "Outputdir not a directory." ); | |||
} | |||
cmdl.createArgument().setValue( | |||
"-OUTPUT_DIRECTORY:" + outputDirectory.getAbsolutePath() ); | |||
cmdl.addArgument( "-OUTPUT_DIRECTORY:" + outputDirectory.getAbsolutePath() ); | |||
// determine if the generated java file is up-to-date | |||
final File javaFile = getOutputJavaFile( outputDirectory, target ); | |||
@@ -221,7 +220,7 @@ public class JavaCC extends Task | |||
getLogger().debug( "Target is already built - skipping (" + target + ")" ); | |||
return; | |||
} | |||
cmdl.createArgument().setValue( target.getAbsolutePath() ); | |||
cmdl.addArgument( target.getAbsolutePath() ); | |||
if( javaccHome == null || !javaccHome.isDirectory() ) | |||
{ | |||
@@ -231,9 +230,8 @@ public class JavaCC extends Task | |||
classpath.addLocation( new File( javaccHome, "JavaCC.zip" ) ); | |||
classpath.addJavaRuntime(); | |||
final Argument arg = cmdl.createVmArgument(); | |||
arg.setValue( "-mx140M" ); | |||
arg.setValue( "-Dinstall.root=" + javaccHome.getAbsolutePath() ); | |||
cmdl.addVmArgument( "-mx140M" ); | |||
cmdl.addVmArgument( "-Dinstall.root=" + javaccHome.getAbsolutePath() ); | |||
runCommand( cmdl.getCommandline() ); | |||
} | |||
@@ -137,19 +137,6 @@ public class JDependTask | |||
return path; | |||
} | |||
/** | |||
* Create a new JVM argument. Ignored if no JVM is forked. | |||
* | |||
* @param commandline Description of Parameter | |||
* @return create a new JVM argument so that any argument can be passed to | |||
* the JVM. | |||
* @see #setFork(boolean) | |||
*/ | |||
public Argument createJvmarg( final CommandlineJava commandline ) | |||
{ | |||
return commandline.createVmArgument(); | |||
} | |||
/** | |||
* Maybe creates a nested classpath element. | |||
*/ | |||
@@ -226,16 +213,16 @@ public class JDependTask | |||
// hope it will be reviewed by anybody competent | |||
if( m_compileClasspath.toString().length() > 0 ) | |||
{ | |||
createJvmarg( commandline ).setValue( "-classpath" ); | |||
createJvmarg( commandline ).setValue( m_compileClasspath.toString() ); | |||
commandline.addVmArgument( "-classpath" ); | |||
commandline.addVmArgument( m_compileClasspath.toString() ); | |||
} | |||
if( m_outputFile != null ) | |||
{ | |||
// having a space between the file and its path causes commandline to add quotes " | |||
// around the argument thus making JDepend not taking it into account. Thus we split it in two | |||
commandline.createArgument().setValue( "-file" ); | |||
commandline.createArgument().setValue( m_outputFile.getPath() ); | |||
commandline.addArgument( "-file" ); | |||
commandline.addArgument( m_outputFile.getPath() ); | |||
// we have to find a cleaner way to put this output | |||
} | |||
@@ -247,7 +234,7 @@ public class JDependTask | |||
// not necessary as JDepend would fail, but why loose some time? | |||
if( !f.exists() || !f.isDirectory() ) | |||
throw new TaskException( "\"" + f.getPath() + "\" does not represent a valid directory. JDepend would fail." ); | |||
commandline.createArgument().setValue( f.getPath() ); | |||
commandline.addArgument( f.getPath() ); | |||
} | |||
final Execute2 exe = new Execute2(); | |||
@@ -66,7 +66,7 @@ public abstract class DefaultCompilerAdapter | |||
while( enum.hasNext() ) | |||
{ | |||
String arg = (String)enum.next(); | |||
cmd.createArgument().setValue( arg ); | |||
cmd.addArgument( arg ); | |||
niceSourceList.append( " " + arg + StringUtil.LINE_SEPARATOR ); | |||
} | |||
@@ -68,36 +68,36 @@ public class JasperC | |||
JspC jspc = getJspc(); | |||
if( jspc.getDestdir() != null ) | |||
{ | |||
cmd.createArgument().setValue( "-d" ); | |||
cmd.createArgument().setFile( jspc.getDestdir() ); | |||
cmd.addArgument( "-d" ); | |||
cmd.addArgument( jspc.getDestdir() ); | |||
} | |||
if( jspc.getPackage() != null ) | |||
{ | |||
cmd.createArgument().setValue( "-p" ); | |||
cmd.createArgument().setValue( jspc.getPackage() ); | |||
cmd.addArgument( "-p" ); | |||
cmd.addArgument( jspc.getPackage() ); | |||
} | |||
if( jspc.getVerbose() != 0 ) | |||
{ | |||
cmd.createArgument().setValue( "-v" + jspc.getVerbose() ); | |||
cmd.addArgument( "-v" + jspc.getVerbose() ); | |||
} | |||
if( jspc.isMapped() ) | |||
{ | |||
cmd.createArgument().setValue( "-mapped" ); | |||
cmd.addArgument( "-mapped" ); | |||
} | |||
if( jspc.getIeplugin() != null ) | |||
{ | |||
cmd.createArgument().setValue( "-ieplugin" ); | |||
cmd.createArgument().setValue( jspc.getIeplugin() ); | |||
cmd.addArgument( "-ieplugin" ); | |||
cmd.addArgument( jspc.getIeplugin() ); | |||
} | |||
if( jspc.getUriroot() != null ) | |||
{ | |||
cmd.createArgument().setValue( "-uriroot" ); | |||
cmd.createArgument().setValue( jspc.getUriroot().toString() ); | |||
cmd.addArgument( "-uriroot" ); | |||
cmd.addArgument( jspc.getUriroot().toString() ); | |||
} | |||
if( jspc.getUribase() != null ) | |||
{ | |||
cmd.createArgument().setValue( "-uribase" ); | |||
cmd.createArgument().setValue( jspc.getUribase().toString() ); | |||
cmd.addArgument( "-uribase" ); | |||
cmd.addArgument( jspc.getUribase().toString() ); | |||
} | |||
logAndAddFilesToCompile( getJspc(), getJspc().getCompileList(), cmd ); | |||
return cmd; | |||
@@ -265,7 +265,7 @@ public class JUnitTask extends Task | |||
*/ | |||
public void setMaxmemory( String max ) | |||
{ | |||
createJvmarg().setValue( "-Xmx" + max ); | |||
commandline.addVmArgument( "-Xmx" + max ); | |||
} | |||
/** | |||
@@ -361,9 +361,9 @@ public class JUnitTask extends Task | |||
* the JVM. | |||
* @see #setFork(boolean) | |||
*/ | |||
public Argument createJvmarg() | |||
public void addJvmarg( final Argument argument ) | |||
{ | |||
return commandline.createVmArgument(); | |||
commandline.addVmArgument( argument ); | |||
} | |||
/** | |||
@@ -596,14 +596,14 @@ public class JUnitTask extends Task | |||
CommandlineJava cmd = commandline;//(CommandlineJava)commandline.clone(); | |||
cmd.setClassname( "org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" ); | |||
cmd.createArgument().setValue( test.getName() ); | |||
cmd.createArgument().setValue( "filtertrace=" + test.getFiltertrace() ); | |||
cmd.createArgument().setValue( "haltOnError=" + test.getHaltonerror() ); | |||
cmd.createArgument().setValue( "haltOnFailure=" + test.getHaltonfailure() ); | |||
cmd.addArgument( test.getName() ); | |||
cmd.addArgument( "filtertrace=" + test.getFiltertrace() ); | |||
cmd.addArgument( "haltOnError=" + test.getHaltonerror() ); | |||
cmd.addArgument( "haltOnFailure=" + test.getHaltonfailure() ); | |||
if( summary ) | |||
{ | |||
getLogger().info( "Running " + test.getName() ); | |||
cmd.createArgument().setValue( "formatter=org.apache.tools.ant.taskdefs.optional.junit.SummaryJUnitResultFormatter" ); | |||
cmd.addArgument( "formatter=org.apache.tools.ant.taskdefs.optional.junit.SummaryJUnitResultFormatter" ); | |||
} | |||
StringBuffer formatterArg = new StringBuffer( 128 ); | |||
@@ -619,13 +619,13 @@ public class JUnitTask extends Task | |||
formatterArg.append( "," ); | |||
formatterArg.append( outFile ); | |||
} | |||
cmd.createArgument().setValue( formatterArg.toString() ); | |||
cmd.addArgument( formatterArg.toString() ); | |||
formatterArg.setLength( 0 ); | |||
} | |||
// Create a temporary file to pass the Ant properties to the forked test | |||
File propsFile = new File( "junit" + ( new Random( System.currentTimeMillis() ) ).nextLong() + ".properties" ); | |||
cmd.createArgument().setValue( "propsfile=" + propsFile.getAbsolutePath() ); | |||
cmd.addArgument( "propsfile=" + propsFile.getAbsolutePath() ); | |||
Hashtable p = getProject().getProperties(); | |||
Properties props = new Properties(); | |||
for( Enumeration enum = p.keys(); enum.hasMoreElements(); ) | |||
@@ -116,7 +116,7 @@ public abstract class AbstractMetamataTask | |||
*/ | |||
public void setMaxmemory( String max ) | |||
{ | |||
createJvmarg().setValue( "-Xmx" + max ); | |||
m_cmdl.addVmArgument( "-Xmx" + max ); | |||
} | |||
/** | |||
@@ -150,9 +150,9 @@ public abstract class AbstractMetamataTask | |||
/** | |||
* Creates a nested jvmarg element. | |||
*/ | |||
public Argument createJvmarg() | |||
public void addJvmarg( final Argument argument ) | |||
{ | |||
return m_cmdl.createVmArgument(); | |||
m_cmdl.addVmArgument( argument ); | |||
} | |||
/** | |||
@@ -200,8 +200,7 @@ public abstract class AbstractMetamataTask | |||
classPath.addLocation( jar ); | |||
// set the metamata.home property | |||
final Argument vmArgs = m_cmdl.createVmArgument(); | |||
vmArgs.setValue( "-Dmetamata.home=" + m_metamataHome.getAbsolutePath() ); | |||
m_cmdl.addVmArgument( "-Dmetamata.home=" + m_metamataHome.getAbsolutePath() ); | |||
// retrieve all the files we want to scan | |||
m_includedFiles = scanFileSets(); | |||
@@ -98,7 +98,7 @@ public class MParse | |||
*/ | |||
public void setMaxmemory( String max ) | |||
{ | |||
createJvmarg().setValue( "-Xmx" + max ); | |||
m_cmdl.addVmArgument( "-Xmx" + max ); | |||
} | |||
/** | |||
@@ -147,12 +147,10 @@ public class MParse | |||
/** | |||
* Creates a nested jvmarg element. | |||
* | |||
* @return Description of the Returned Value | |||
*/ | |||
public Argument createJvmarg() | |||
public void addJvmarg( final Argument argument ) | |||
{ | |||
return m_cmdl.createVmArgument(); | |||
m_cmdl.addVmArgument( argument ); | |||
} | |||
/** | |||
@@ -207,8 +205,7 @@ public class MParse | |||
} | |||
// set the metamata.home property | |||
final Argument vmArgs = m_cmdl.createVmArgument(); | |||
vmArgs.setValue( "-Dmetamata.home=" + m_metahome.getAbsolutePath() ); | |||
m_cmdl.addVmArgument( "-Dmetamata.home=" + m_metahome.getAbsolutePath() ); | |||
// write all the options to a temp file and use it ro run the process | |||
String[] options = getOptions(); | |||
@@ -140,15 +140,15 @@ public abstract class P4Base | |||
//Check API for these - it's how CVS does it... | |||
if( m_p4Port != null && m_p4Port.length() != 0 ) | |||
{ | |||
cmd.createArgument().setValue( m_p4Port ); | |||
cmd.addArgument( m_p4Port ); | |||
} | |||
if( m_p4User != null && m_p4User.length() != 0 ) | |||
{ | |||
cmd.createArgument().setValue( m_p4User ); | |||
cmd.addArgument( m_p4User ); | |||
} | |||
if( m_p4Client != null && m_p4Client.length() != 0 ) | |||
{ | |||
cmd.createArgument().setValue( m_p4Client ); | |||
cmd.addArgument( m_p4Client ); | |||
} | |||
cmd.createArgument().setLine( command ); | |||
@@ -216,28 +216,28 @@ public class Pvcs | |||
if( m_force ) | |||
{ | |||
cmd.createArgument().setValue( "-Y" ); | |||
cmd.addArgument( "-Y" ); | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( "-N" ); | |||
cmd.addArgument( "-N" ); | |||
} | |||
if( null != m_promotiongroup ) | |||
{ | |||
cmd.createArgument().setValue( "-G" + m_promotiongroup ); | |||
cmd.addArgument( "-G" + m_promotiongroup ); | |||
} | |||
else if( null != m_label ) | |||
{ | |||
cmd.createArgument().setValue( "-r" + m_label ); | |||
cmd.addArgument( "-r" + m_label ); | |||
} | |||
if( m_updateOnly ) | |||
{ | |||
cmd.createArgument().setValue( "-U" ); | |||
cmd.addArgument( "-U" ); | |||
} | |||
cmd.createArgument().setValue( "@" + filelist.getAbsolutePath() ); | |||
cmd.addArgument( "@" + filelist.getAbsolutePath() ); | |||
return cmd; | |||
} | |||
@@ -319,18 +319,18 @@ public class Pvcs | |||
final Commandline cmd = new Commandline(); | |||
cmd.setExecutable( getExecutable( PCLI_EXE ) ); | |||
cmd.createArgument().setValue( "lvf" ); | |||
cmd.createArgument().setValue( "-z" ); | |||
cmd.createArgument().setValue( "-aw" ); | |||
cmd.addArgument( "lvf" ); | |||
cmd.addArgument( "-z" ); | |||
cmd.addArgument( "-aw" ); | |||
if( m_workspace != null ) | |||
{ | |||
cmd.createArgument().setValue( "-sp" + m_workspace ); | |||
cmd.addArgument( "-sp" + m_workspace ); | |||
} | |||
cmd.createArgument().setValue( "-pr" + m_repository ); | |||
cmd.addArgument( "-pr" + m_repository ); | |||
if( m_pvcsProject != null ) | |||
{ | |||
cmd.createArgument().setValue( m_pvcsProject ); | |||
cmd.addArgument( m_pvcsProject ); | |||
} | |||
if( !m_pvcsProjects.isEmpty() ) | |||
@@ -345,7 +345,7 @@ public class Pvcs | |||
final String message = "name is a required attribute of pvcsproject"; | |||
throw new TaskException( message ); | |||
} | |||
cmd.createArgument().setValue( name ); | |||
cmd.addArgument( name ); | |||
} | |||
} | |||
return cmd; | |||
@@ -109,9 +109,9 @@ public class CovMerge extends Task | |||
cmdl.setExecutable( new File( home, "jpcovmerge" ).getAbsolutePath() ); | |||
if( verbose ) | |||
{ | |||
cmdl.createArgument().setValue( "-v" ); | |||
cmdl.addArgument( "-v" ); | |||
} | |||
cmdl.createArgument().setValue( "-jp_paramfile=" + paramfile.getAbsolutePath() ); | |||
cmdl.addArgument( "-jp_paramfile=" + paramfile.getAbsolutePath() ); | |||
final Execute2 exe = new Execute2(); | |||
setupLogger( exe ); | |||
@@ -242,7 +242,7 @@ public class CovReport extends Task | |||
String[] params = getParameters(); | |||
for( int i = 0; i < params.length; i++ ) | |||
{ | |||
cmdl.createArgument().setValue( params[ i ] ); | |||
cmdl.addArgument( params[ i ] ); | |||
} | |||
// use the custom handler for stdin issues | |||
@@ -172,12 +172,10 @@ public class Coverage | |||
/** | |||
* the command arguments | |||
* | |||
* @return Description of the Returned Value | |||
*/ | |||
public Argument createArg() | |||
public void addArg( final Argument argument ) | |||
{ | |||
return cmdlJava.createArgument(); | |||
cmdlJava.addArgument( argument ); | |||
} | |||
/** | |||
@@ -203,9 +201,9 @@ public class Coverage | |||
* | |||
* @return Description of the Returned Value | |||
*/ | |||
public Argument createJvmarg() | |||
public void addJvmarg( final Argument argument ) | |||
{ | |||
return cmdlJava.createVmArgument(); | |||
cmdlJava.addVmArgument( argument ); | |||
} | |||
public Socket createSocket() | |||
@@ -249,7 +247,7 @@ public class Coverage | |||
{ | |||
// we need to run Coverage from his directory due to dll/jar issues | |||
cmdl.setExecutable( new File( m_home, "jplauncher" ).getAbsolutePath() ); | |||
cmdl.createArgument().setValue( "-jp_input=" + paramfile.getAbsolutePath() ); | |||
cmdl.addArgument( "-jp_input=" + paramfile.getAbsolutePath() ); | |||
// use the custom handler for stdin issues | |||
final Execute2 exe = new Execute2(); | |||
@@ -187,7 +187,7 @@ public abstract class MSVSS extends Task | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( FLAG_LOGIN + m_vssLogin ); | |||
cmd.addArgument( FLAG_LOGIN + m_vssLogin ); | |||
} | |||
} | |||
@@ -99,20 +99,20 @@ public class MSVSSCHECKIN extends MSVSS | |||
if( m_AutoResponse == null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_AUTORESPONSE_DEF ); | |||
cmd.addArgument( FLAG_AUTORESPONSE_DEF ); | |||
} | |||
else if( m_AutoResponse.equalsIgnoreCase( "Y" ) ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_AUTORESPONSE_YES ); | |||
cmd.addArgument( FLAG_AUTORESPONSE_YES ); | |||
} | |||
else if( m_AutoResponse.equalsIgnoreCase( "N" ) ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_AUTORESPONSE_NO ); | |||
cmd.addArgument( FLAG_AUTORESPONSE_NO ); | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( FLAG_AUTORESPONSE_DEF ); | |||
cmd.addArgument( FLAG_AUTORESPONSE_DEF ); | |||
}// end of else | |||
} | |||
@@ -157,7 +157,7 @@ public class MSVSSCHECKIN extends MSVSS | |||
getLogger().info( "Created dir: " + dir.getAbsolutePath() ); | |||
} | |||
cmd.createArgument().setValue( FLAG_OVERRIDE_WORKING_DIR + m_LocalPath ); | |||
cmd.addArgument( FLAG_OVERRIDE_WORKING_DIR + m_LocalPath ); | |||
} | |||
} | |||
@@ -172,7 +172,7 @@ public class MSVSSCHECKIN extends MSVSS | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( FLAG_RECURSION ); | |||
cmd.addArgument( FLAG_RECURSION ); | |||
} | |||
} | |||
@@ -187,7 +187,7 @@ public class MSVSSCHECKIN extends MSVSS | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( FLAG_WRITABLE ); | |||
cmd.addArgument( FLAG_WRITABLE ); | |||
} | |||
} | |||
@@ -218,10 +218,10 @@ public class MSVSSCHECKIN extends MSVSS | |||
// ss Checkin VSS items [-H] [-C] [-I-] [-N] [-O] [-R] [-W] [-Y] [-?] | |||
// as specified in the SS.EXE help | |||
commandLine.setExecutable( getSSCommand() ); | |||
commandLine.createArgument().setValue( COMMAND_CHECKIN ); | |||
commandLine.addArgument( COMMAND_CHECKIN ); | |||
// VSS items | |||
commandLine.createArgument().setValue( getVsspath() ); | |||
commandLine.addArgument( getVsspath() ); | |||
// -GL | |||
getLocalpathCommand( commandLine ); | |||
// -I- or -I-Y or -I-N | |||
@@ -233,7 +233,7 @@ public class MSVSSCHECKIN extends MSVSS | |||
// -Y | |||
getLoginCommand( commandLine ); | |||
// -C | |||
commandLine.createArgument().setValue( "-C" + getComment() ); | |||
commandLine.addArgument( "-C" + getComment() ); | |||
result = run( commandLine ); | |||
if( result != 0 ) | |||
@@ -136,20 +136,20 @@ public class MSVSSCHECKOUT extends MSVSS | |||
if( m_AutoResponse == null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_AUTORESPONSE_DEF ); | |||
cmd.addArgument( FLAG_AUTORESPONSE_DEF ); | |||
} | |||
else if( m_AutoResponse.equalsIgnoreCase( "Y" ) ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_AUTORESPONSE_YES ); | |||
cmd.addArgument( FLAG_AUTORESPONSE_YES ); | |||
} | |||
else if( m_AutoResponse.equalsIgnoreCase( "N" ) ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_AUTORESPONSE_NO ); | |||
cmd.addArgument( FLAG_AUTORESPONSE_NO ); | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( FLAG_AUTORESPONSE_DEF ); | |||
cmd.addArgument( FLAG_AUTORESPONSE_DEF ); | |||
}// end of else | |||
} | |||
@@ -184,7 +184,7 @@ public class MSVSSCHECKOUT extends MSVSS | |||
getLogger().info( "Created dir: " + dir.getAbsolutePath() ); | |||
} | |||
cmd.createArgument().setValue( FLAG_OVERRIDE_WORKING_DIR + m_LocalPath ); | |||
cmd.addArgument( FLAG_OVERRIDE_WORKING_DIR + m_LocalPath ); | |||
} | |||
} | |||
@@ -199,7 +199,7 @@ public class MSVSSCHECKOUT extends MSVSS | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( FLAG_RECURSION ); | |||
cmd.addArgument( FLAG_RECURSION ); | |||
} | |||
} | |||
@@ -214,15 +214,15 @@ public class MSVSSCHECKOUT extends MSVSS | |||
if( m_Version != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_VERSION + m_Version ); | |||
cmd.addArgument( FLAG_VERSION + m_Version ); | |||
} | |||
else if( m_Date != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_VERSION_DATE + m_Date ); | |||
cmd.addArgument( FLAG_VERSION_DATE + m_Date ); | |||
} | |||
else if( m_Label != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_VERSION_LABEL + m_Label ); | |||
cmd.addArgument( FLAG_VERSION_LABEL + m_Label ); | |||
} | |||
} | |||
@@ -253,10 +253,10 @@ public class MSVSSCHECKOUT extends MSVSS | |||
// ss Checkout VSS items [-G] [-C] [-H] [-I-] [-N] [-O] [-R] [-V] [-Y] [-?] | |||
// as specified in the SS.EXE help | |||
commandLine.setExecutable( getSSCommand() ); | |||
commandLine.createArgument().setValue( COMMAND_CHECKOUT ); | |||
commandLine.addArgument( COMMAND_CHECKOUT ); | |||
// VSS items | |||
commandLine.createArgument().setValue( getVsspath() ); | |||
commandLine.addArgument( getVsspath() ); | |||
// -GL | |||
getLocalpathCommand( commandLine ); | |||
// -I- or -I-Y or -I-N | |||
@@ -344,20 +344,20 @@ public class MSVSSGET extends MSVSS | |||
if( m_AutoResponse == null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_AUTORESPONSE_DEF ); | |||
cmd.addArgument( FLAG_AUTORESPONSE_DEF ); | |||
} | |||
else if( m_AutoResponse.equalsIgnoreCase( "Y" ) ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_AUTORESPONSE_YES ); | |||
cmd.addArgument( FLAG_AUTORESPONSE_YES ); | |||
} | |||
else if( m_AutoResponse.equalsIgnoreCase( "N" ) ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_AUTORESPONSE_NO ); | |||
cmd.addArgument( FLAG_AUTORESPONSE_NO ); | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( FLAG_AUTORESPONSE_DEF ); | |||
cmd.addArgument( FLAG_AUTORESPONSE_DEF ); | |||
}// end of else | |||
} | |||
@@ -392,7 +392,7 @@ public class MSVSSGET extends MSVSS | |||
getLogger().info( "Created dir: " + dir.getAbsolutePath() ); | |||
} | |||
cmd.createArgument().setValue( FLAG_OVERRIDE_WORKING_DIR + m_LocalPath ); | |||
cmd.addArgument( FLAG_OVERRIDE_WORKING_DIR + m_LocalPath ); | |||
} | |||
} | |||
@@ -400,7 +400,7 @@ public class MSVSSGET extends MSVSS | |||
{ | |||
if( m_Quiet ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_QUIET ); | |||
cmd.addArgument( FLAG_QUIET ); | |||
} | |||
} | |||
@@ -415,7 +415,7 @@ public class MSVSSGET extends MSVSS | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( FLAG_RECURSION ); | |||
cmd.addArgument( FLAG_RECURSION ); | |||
} | |||
} | |||
@@ -430,15 +430,15 @@ public class MSVSSGET extends MSVSS | |||
if( m_Version != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_VERSION + m_Version ); | |||
cmd.addArgument( FLAG_VERSION + m_Version ); | |||
} | |||
else if( m_Date != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_VERSION_DATE + m_Date ); | |||
cmd.addArgument( FLAG_VERSION_DATE + m_Date ); | |||
} | |||
else if( m_Label != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_VERSION_LABEL + m_Label ); | |||
cmd.addArgument( FLAG_VERSION_LABEL + m_Label ); | |||
} | |||
} | |||
@@ -453,7 +453,7 @@ public class MSVSSGET extends MSVSS | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( FLAG_WRITABLE ); | |||
cmd.addArgument( FLAG_WRITABLE ); | |||
} | |||
} | |||
@@ -484,10 +484,10 @@ public class MSVSSGET extends MSVSS | |||
// ss Get VSS items [-G] [-H] [-I-] [-N] [-O] [-R] [-V] [-W] [-Y] [-?] | |||
// as specified in the SS.EXE help | |||
commandLine.setExecutable( getSSCommand() ); | |||
commandLine.createArgument().setValue( COMMAND_GET ); | |||
commandLine.addArgument( COMMAND_GET ); | |||
// VSS items | |||
commandLine.createArgument().setValue( getVsspath() ); | |||
commandLine.addArgument( getVsspath() ); | |||
// -GL | |||
getLocalpathCommand( commandLine ); | |||
// -I- or -I-Y or -I-N | |||
@@ -237,13 +237,13 @@ public class MSVSSHISTORY extends MSVSS | |||
// ss History elements [-H] [-L] [-N] [-O] [-V] [-Y] [-#] [-?] | |||
// as specified in the SS.EXE help | |||
commandLine.setExecutable( getSSCommand() ); | |||
commandLine.createArgument().setValue( COMMAND_HISTORY ); | |||
commandLine.addArgument( COMMAND_HISTORY ); | |||
// VSS items | |||
commandLine.createArgument().setValue( getVsspath() ); | |||
commandLine.addArgument( getVsspath() ); | |||
// -I- | |||
commandLine.createArgument().setValue( "-I-" );// ignore all errors | |||
commandLine.addArgument( "-I-" );// ignore all errors | |||
// -V | |||
// Label an existing file or project version | |||
@@ -253,13 +253,13 @@ public class MSVSSHISTORY extends MSVSS | |||
// -R | |||
if( m_Recursive ) | |||
{ | |||
commandLine.createArgument().setValue( FLAG_RECURSION ); | |||
commandLine.addArgument( FLAG_RECURSION ); | |||
} | |||
// -B / -D / -F- | |||
if( m_Style.length() > 0 ) | |||
{ | |||
commandLine.createArgument().setValue( m_Style ); | |||
commandLine.addArgument( m_Style ); | |||
} | |||
// -Y | |||
@@ -288,7 +288,7 @@ public class MSVSSHISTORY extends MSVSS | |||
{ | |||
if( m_OutputFileName != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_OUTPUT + m_OutputFileName ); | |||
cmd.addArgument( FLAG_OUTPUT + m_OutputFileName ); | |||
} | |||
} | |||
@@ -303,7 +303,7 @@ public class MSVSSHISTORY extends MSVSS | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( FLAG_RECURSION ); | |||
cmd.addArgument( FLAG_RECURSION ); | |||
} | |||
} | |||
@@ -316,7 +316,7 @@ public class MSVSSHISTORY extends MSVSS | |||
{ | |||
if( m_User != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_USER + m_User ); | |||
cmd.addArgument( FLAG_USER + m_User ); | |||
} | |||
} | |||
@@ -336,7 +336,7 @@ public class MSVSSHISTORY extends MSVSS | |||
if( m_FromDate != null && m_ToDate != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_VERSION_DATE + m_ToDate + VALUE_FROMDATE + m_FromDate ); | |||
cmd.addArgument( FLAG_VERSION_DATE + m_ToDate + VALUE_FROMDATE + m_FromDate ); | |||
} | |||
else if( m_ToDate != null && m_NumDays != Integer.MIN_VALUE ) | |||
{ | |||
@@ -350,7 +350,7 @@ public class MSVSSHISTORY extends MSVSS | |||
String msg = "Error parsing date: " + m_ToDate; | |||
throw new TaskException( msg ); | |||
} | |||
cmd.createArgument().setValue( FLAG_VERSION_DATE + m_ToDate + VALUE_FROMDATE + startDate ); | |||
cmd.addArgument( FLAG_VERSION_DATE + m_ToDate + VALUE_FROMDATE + startDate ); | |||
} | |||
else if( m_FromDate != null && m_NumDays != Integer.MIN_VALUE ) | |||
{ | |||
@@ -364,17 +364,17 @@ public class MSVSSHISTORY extends MSVSS | |||
String msg = "Error parsing date: " + m_FromDate; | |||
throw new TaskException( msg ); | |||
} | |||
cmd.createArgument().setValue( FLAG_VERSION_DATE + endDate + VALUE_FROMDATE + m_FromDate ); | |||
cmd.addArgument( FLAG_VERSION_DATE + endDate + VALUE_FROMDATE + m_FromDate ); | |||
} | |||
else | |||
{ | |||
if( m_FromDate != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_VERSION + VALUE_FROMDATE + m_FromDate ); | |||
cmd.addArgument( FLAG_VERSION + VALUE_FROMDATE + m_FromDate ); | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( FLAG_VERSION_DATE + m_ToDate ); | |||
cmd.addArgument( FLAG_VERSION_DATE + m_ToDate ); | |||
} | |||
} | |||
} | |||
@@ -395,15 +395,15 @@ public class MSVSSHISTORY extends MSVSS | |||
if( m_FromLabel != null && m_ToLabel != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_VERSION_LABEL + m_ToLabel + VALUE_FROMLABEL + m_FromLabel ); | |||
cmd.addArgument( FLAG_VERSION_LABEL + m_ToLabel + VALUE_FROMLABEL + m_FromLabel ); | |||
} | |||
else if( m_FromLabel != null ) | |||
{ | |||
cmd.createArgument().setValue( FLAG_VERSION + VALUE_FROMLABEL + m_FromLabel ); | |||
cmd.addArgument( FLAG_VERSION + VALUE_FROMLABEL + m_FromLabel ); | |||
} | |||
else | |||
{ | |||
cmd.createArgument().setValue( FLAG_VERSION_LABEL + m_ToLabel ); | |||
cmd.addArgument( FLAG_VERSION_LABEL + m_ToLabel ); | |||
} | |||
} | |||