Browse Source

Moved Commandline.Argument/Marker to top level classes.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270322 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 24 years ago
parent
commit
2bb0b8b340
42 changed files with 358 additions and 284 deletions
  1. +5
    -4
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
  2. +3
    -2
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java
  3. +2
    -1
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javac.java
  4. +2
    -1
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/ExecTask.java
  5. +2
    -1
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java
  6. +2
    -1
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java
  7. +2
    -1
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DDCreator.java
  8. +2
    -1
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java
  9. +2
    -1
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java
  10. +2
    -1
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java
  11. +2
    -1
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java
  12. +2
    -1
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java
  13. +2
    -1
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  14. +4
    -3
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java
  15. +4
    -3
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java
  16. +3
    -2
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java
  17. +72
    -0
      proposal/myrmidon/src/main/org/apache/tools/ant/types/Argument.java
  18. +11
    -114
      proposal/myrmidon/src/main/org/apache/tools/ant/types/Commandline.java
  19. +2
    -2
      proposal/myrmidon/src/main/org/apache/tools/ant/types/CommandlineJava.java
  20. +0
    -1
      proposal/myrmidon/src/main/org/apache/tools/ant/types/EnvironmentData.java
  21. +53
    -0
      proposal/myrmidon/src/main/org/apache/tools/ant/types/Marker.java
  22. +5
    -4
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ExecuteOn.java
  23. +3
    -2
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Java.java
  24. +2
    -1
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Javac.java
  25. +2
    -1
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/exec/ExecTask.java
  26. +2
    -1
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ANTLR.java
  27. +2
    -1
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java
  28. +2
    -1
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/DDCreator.java
  29. +2
    -1
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java
  30. +2
    -1
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java
  31. +2
    -1
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java
  32. +2
    -1
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java
  33. +2
    -1
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java
  34. +2
    -1
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  35. +4
    -3
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java
  36. +4
    -3
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java
  37. +3
    -2
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java
  38. +72
    -0
      proposal/myrmidon/src/todo/org/apache/tools/ant/types/Argument.java
  39. +11
    -114
      proposal/myrmidon/src/todo/org/apache/tools/ant/types/Commandline.java
  40. +2
    -2
      proposal/myrmidon/src/todo/org/apache/tools/ant/types/CommandlineJava.java
  41. +0
    -1
      proposal/myrmidon/src/todo/org/apache/tools/ant/types/EnvironmentData.java
  42. +53
    -0
      proposal/myrmidon/src/todo/org/apache/tools/ant/types/Marker.java

+ 5
- 4
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java View File

@@ -20,6 +20,7 @@ import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.EnumeratedAttribute;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.Mapper;
import org.apache.tools.ant.types.Marker;
import org.apache.tools.ant.util.FileNameMapper;
import org.apache.tools.ant.util.SourceFileScanner;

@@ -36,9 +37,9 @@ public class ExecuteOn extends ExecTask
private boolean relative = false;
private boolean parallel = false;
protected String type = "file";
protected Commandline.Marker srcFilePos = null;
protected Marker srcFilePos = null;
private boolean skipEmpty = false;
protected Commandline.Marker targetFilePos = null;
protected Marker targetFilePos = null;
protected Mapper mapperElement = null;
protected FileNameMapper mapper = null;
protected File destDir = null;
@@ -132,7 +133,7 @@ public class ExecuteOn extends ExecTask
*
* @return Description of the Returned Value
*/
public Commandline.Marker createSrcfile()
public Marker createSrcfile()
throws TaskException
{
if( srcFilePos != null )
@@ -149,7 +150,7 @@ public class ExecuteOn extends ExecTask
*
* @return Description of the Returned Value
*/
public Commandline.Marker createTargetfile()
public Marker createTargetfile()
throws TaskException
{
if( targetFilePos != null )


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

@@ -24,6 +24,7 @@ import org.apache.tools.ant.types.EnvironmentData;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Reference;
import org.apache.tools.ant.types.EnvironmentVariable;
import org.apache.tools.ant.types.Argument;

/**
* This task acts as a loader for java applications but allows to use the same
@@ -185,7 +186,7 @@ public class Java extends Task
*
* @return Description of the Returned Value
*/
public Commandline.Argument createArg()
public Argument createArg()
{
return cmdl.createArgument();
}
@@ -206,7 +207,7 @@ public class Java extends Task
*
* @return Description of the Returned Value
*/
public Commandline.Argument createJvmarg()
public Argument createJvmarg()
{
return cmdl.createVmArgument();
}


+ 2
- 1
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javac.java View File

@@ -19,6 +19,7 @@ import org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Reference;
import org.apache.tools.ant.types.Argument;
import org.apache.tools.ant.util.GlobPatternMapper;
import org.apache.tools.ant.util.SourceFileScanner;

@@ -914,7 +915,7 @@ public class Javac extends MatchingTask
* @author RT
*/
public class ImplementationSpecificArgument
extends Commandline.Argument
extends Argument
{

private String impl;


+ 2
- 1
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/ExecTask.java View File

@@ -22,6 +22,7 @@ import org.apache.tools.ant.Task;
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.types.Argument;

/**
* Executes a given command if the os platform is appropriate.
@@ -186,7 +187,7 @@ public class ExecTask extends Task
*
* @return Description of the Returned Value
*/
public Commandline.Argument createArg()
public Argument createArg()
{
return cmdl.createArgument();
}


+ 2
- 1
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java View File

@@ -21,6 +21,7 @@ import org.apache.tools.ant.taskdefs.exec.LogStreamHandler;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Argument;

/**
* ANTLR task.
@@ -104,7 +105,7 @@ public class ANTLR extends Task
* the JVM.
* @see #setFork(boolean)
*/
public Commandline.Argument createJvmarg()
public Argument createJvmarg()
{
return commandline.createVmArgument();
}


+ 2
- 1
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java View File

@@ -23,6 +23,7 @@ import org.apache.tools.ant.taskdefs.exec.Execute;
import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Argument;

/**
* BorlandDeploymentTool is dedicated to the Borland Application Server 4.5 and
@@ -491,7 +492,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec

javaTask = (Java)getTask().getProject().createTask( "java" );
javaTask.setClassname( VERIFY );
Commandline.Argument arguments = javaTask.createArg();
Argument arguments = javaTask.createArg();
arguments.setLine( args );
Path classpath = getCombinedClasspath();
if( classpath != null )


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

@@ -14,6 +14,7 @@ import org.apache.tools.ant.taskdefs.Java;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Argument;

/**
* Build a serialised deployment descriptor given a text file description of the
@@ -122,7 +123,7 @@ public class DDCreator extends MatchingTask
Java ddCreatorTask = (Java)getProject().createTask( "java" );
ddCreatorTask.setFork( true );
ddCreatorTask.setClassname( "org.apache.tools.ant.taskdefs.optional.ejb.DDCreatorHelper" );
Commandline.Argument arguments = ddCreatorTask.createArg();
Argument arguments = ddCreatorTask.createArg();
arguments.setLine( args );
ddCreatorTask.setClasspath( new Path( getProject(), execClassPath ) );
if( ddCreatorTask.executeJava() != 0 )


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

@@ -14,6 +14,7 @@ import org.apache.tools.ant.taskdefs.Java;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Argument;

/**
* Build EJB support classes using Weblogic's ejbc tool from a directory
@@ -181,7 +182,7 @@ public class Ejbc extends MatchingTask
args += " " + files[ i ];
}

Commandline.Argument arguments = helperTask.createArg();
Argument arguments = helperTask.createArg();
arguments.setLine( args );
helperTask.setClasspath( new Path( getProject(), execClassPath ) );
if( helperTask.executeJava() != 0 )


+ 2
- 1
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java View File

@@ -25,6 +25,7 @@ import org.apache.tools.ant.types.EnumeratedAttribute;
import org.apache.tools.ant.types.EnvironmentData;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.EnvironmentVariable;
import org.apache.tools.ant.types.Argument;

/**
* Websphere deployment tool that augments the ejbjar task.
@@ -982,7 +983,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool

// Set the Java class name
javaTask.setClassname( "com.ibm.etools.ejbdeploy.EJBDeploy" );
Commandline.Argument arguments = javaTask.createArg();
Argument arguments = javaTask.createArg();
arguments.setLine( args );
Path classpath = wasClasspath;
if( classpath == null )


+ 2
- 1
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java View File

@@ -19,6 +19,7 @@ import org.apache.tools.ant.taskdefs.exec.LogStreamHandler;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Argument;

/**
* Taskdef for the JJTree compiler compiler.
@@ -180,7 +181,7 @@ public class JJTree extends Task
"/JavaCC.zip" );
classpath.addJavaRuntime();

final Commandline.Argument arg = cmdl.createVmArgument();
final Argument arg = cmdl.createVmArgument();
arg.setValue( "-mx140M" );
arg.setValue( "-Dinstall.root=" + javaccHome.getAbsolutePath() );



+ 2
- 1
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java View File

@@ -17,6 +17,7 @@ import org.apache.tools.ant.taskdefs.exec.Execute;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Argument;

/**
* Taskdef for the JavaCC compiler compiler.
@@ -230,7 +231,7 @@ public class JavaCC extends Task
"/JavaCC.zip" );
classpath.addJavaRuntime();

final Commandline.Argument arg = cmdl.createVmArgument();
final Argument arg = cmdl.createVmArgument();
arg.setValue( "-mx140M" );
arg.setValue( "-Dinstall.root=" + javaccHome.getAbsolutePath() );



+ 2
- 1
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java View File

@@ -23,6 +23,7 @@ import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.EnumeratedAttribute;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Reference;
import org.apache.tools.ant.types.Argument;

/**
* Ant task to run JDepend tests. <p>
@@ -219,7 +220,7 @@ public class JDependTask extends Task
* the JVM.
* @see #setFork(boolean)
*/
public Commandline.Argument createJvmarg( CommandlineJava commandline )
public Argument createJvmarg( CommandlineJava commandline )
{
return commandline.createVmArgument();
}


+ 2
- 1
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java View File

@@ -31,6 +31,7 @@ import org.apache.tools.ant.types.EnumeratedAttribute;
import org.apache.tools.ant.types.EnvironmentData;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.EnvironmentVariable;
import org.apache.tools.ant.types.Argument;

/**
* Ant task to run JUnit tests. <p>
@@ -367,7 +368,7 @@ public class JUnitTask extends Task
* the JVM.
* @see #setFork(boolean)
*/
public Commandline.Argument createJvmarg()
public Argument createJvmarg()
{
return commandline.createVmArgument();
}


+ 4
- 3
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java View File

@@ -25,6 +25,7 @@ import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Argument;

/**
* Somewhat abstract framework to be used for other metama 2.0 tasks. This
@@ -169,7 +170,7 @@ public abstract class AbstractMetamataTask extends Task
*
* @return Description of the Returned Value
*/
public Commandline.Argument createJvmarg()
public Argument createJvmarg()
{
return cmdl.createVmArgument();
}
@@ -226,7 +227,7 @@ public abstract class AbstractMetamataTask extends Task
classPath.createPathElement().setLocation( jar );

// set the metamata.home property
final Commandline.Argument vmArgs = cmdl.createVmArgument();
final Argument vmArgs = cmdl.createVmArgument();
vmArgs.setValue( "-Dmetamata.home=" + metamataHome.getAbsolutePath() );

// retrieve all the files we want to scan
@@ -237,7 +238,7 @@ public abstract class AbstractMetamataTask extends Task
ArrayList options = getOptions();
optionsFile = createTmpFile();
generateOptionsFile( optionsFile, options );
Commandline.Argument args = cmdl.createArgument();
Argument args = cmdl.createArgument();
args.setLine( "-arguments " + optionsFile.getAbsolutePath() );
}



+ 4
- 3
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java View File

@@ -22,6 +22,7 @@ import org.apache.tools.ant.taskdefs.exec.LogStreamHandler;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Argument;

/**
* Simple Metamata MParse task based on the original written by <a
@@ -160,7 +161,7 @@ public class MParse extends Task
*
* @return Description of the Returned Value
*/
public Commandline.Argument createJvmarg()
public Argument createJvmarg()
{
return cmdl.createVmArgument();
}
@@ -218,14 +219,14 @@ public class MParse extends Task
}

// set the metamata.home property
final Commandline.Argument vmArgs = cmdl.createVmArgument();
final Argument vmArgs = cmdl.createVmArgument();
vmArgs.setValue( "-Dmetamata.home=" + metahome.getAbsolutePath() );

// write all the options to a temp file and use it ro run the process
String[] options = getOptions();
optionsFile = createTmpFile();
generateOptionsFile( optionsFile, options );
Commandline.Argument args = cmdl.createArgument();
Argument args = cmdl.createArgument();
args.setLine( "-arguments " + optionsFile.getAbsolutePath() );
}



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

@@ -25,6 +25,7 @@ import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.EnumeratedAttribute;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Argument;

/**
* Convenient task to run Sitraka JProbe Coverage from Ant. Options are pretty
@@ -217,7 +218,7 @@ public class Coverage extends Task
*
* @return Description of the Returned Value
*/
public Commandline.Argument createArg()
public Argument createArg()
{
return cmdlJava.createArgument();
}
@@ -244,7 +245,7 @@ public class Coverage extends Task
*
* @return Description of the Returned Value
*/
public Commandline.Argument createJvmarg()
public Argument createJvmarg()
{
return cmdlJava.createVmArgument();
}


+ 72
- 0
proposal/myrmidon/src/main/org/apache/tools/ant/types/Argument.java View File

@@ -0,0 +1,72 @@
/*
* 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.types;

import java.io.File;
import org.apache.myrmidon.api.TaskException;

/**
* Used for nested xml command line definitions.
*/
public class Argument
{
private String[] m_parts;

/**
* Sets a single commandline argument to the absolute filename of the
* given file.
*
* @param value a single commandline argument.
*/
public void setFile( final File value )
{
m_parts = new String[]{value.getAbsolutePath()};
}

/**
* Line to split into several commandline arguments.
*
* @param line line to split into several commandline arguments
*/
public void setLine( final String line )
throws TaskException
{
m_parts = Commandline.translateCommandline( line );
}

/**
* Sets a single commandline argument and treats it like a PATH -
* ensures the right separator for the local platform is used.
*
* @param value a single commandline argument.
*/
public void setPath( final Path value )
{
m_parts = new String[]{value.toString()};
}

/**
* Sets a single commandline argument.
*
* @param value a single commandline argument.
*/
public void setValue( final String value )
{
m_parts = new String[]{value};
}

/**
* Returns the parts this Argument consists of.
*
* @return The Parts value
*/
public String[] getParts()
{
return m_parts;
}
}

+ 11
- 114
proposal/myrmidon/src/main/org/apache/tools/ant/types/Commandline.java View File

@@ -35,13 +35,12 @@ import org.apache.myrmidon.api.TaskException;
public class Commandline
implements Cloneable
{
private ArrayList m_arguments = new ArrayList();
protected final ArrayList m_arguments = new ArrayList();
private String m_executable;

public Commandline( String to_process )
throws TaskException
{
super();
String[] tmp = translateCommandline( to_process );
if( tmp != null && tmp.length > 0 )
{
@@ -206,11 +205,11 @@ public class Commandline
*
* @param executable The new Executable value
*/
public void setExecutable( String executable )
public void setExecutable( final String executable )
{
if( executable == null || executable.length() == 0 )
return;
this.m_executable = executable.replace( '/', File.separatorChar )
m_executable = executable.replace( '/', File.separatorChar )
.replace( '\\', File.separatorChar );
}

@@ -222,11 +221,12 @@ public class Commandline
*/
public String[] getArguments()
{
ArrayList result = new ArrayList( m_arguments.size() * 2 );
for( int i = 0; i < m_arguments.size(); i++ )
final int size = m_arguments.size();
final ArrayList result = new ArrayList( size * 2 );
for( int i = 0; i < size; i++ )
{
Argument arg = (Argument)m_arguments.get( i );
String[] s = arg.getParts();
final Argument arg = (Argument)m_arguments.get( i );
final String[] s = arg.getParts();
for( int j = 0; j < s.length; j++ )
{
result.add( s[ j ] );
@@ -246,7 +246,9 @@ public class Commandline
{
final String[] args = getArguments();
if( m_executable == null )
{
return args;
}
final String[] result = new String[ args.length + 1 ];
result[ 0 ] = m_executable;
System.arraycopy( args, 0, result, 1, args.length );
@@ -315,7 +317,7 @@ public class Commandline
*/
public Marker createMarker()
{
return new Marker( m_arguments.size() );
return new Marker( this, m_arguments.size() );
}

public int size()
@@ -328,109 +330,4 @@ public class Commandline
return toString( getCommandline() );
}

/**
* Used for nested xml command line definitions.
*
* @author RT
*/
public static class Argument
{

private String[] parts;

/**
* Sets a single commandline argument to the absolute filename of the
* given file.
*
* @param value a single commandline argument.
*/
public void setFile( File value )
{
parts = new String[]{value.getAbsolutePath()};
}

/**
* Line to split into several commandline arguments.
*
* @param line line to split into several commandline arguments
*/
public void setLine( String line )
throws TaskException
{
parts = translateCommandline( line );
}

/**
* Sets a single commandline argument and treats it like a PATH -
* ensures the right separator for the local platform is used.
*
* @param value a single commandline argument.
*/
public void setPath( Path value )
{
parts = new String[]{value.toString()};
}

/**
* Sets a single commandline argument.
*
* @param value a single commandline argument.
*/
public void setValue( String value )
{
parts = new String[]{value};
}

/**
* Returns the parts this Argument consists of.
*
* @return The Parts value
*/
public String[] getParts()
{
return parts;
}
}

/**
* Class to keep track of the position of an Argument.
*
* @author RT
*/
// <p>This class is there to support the srcfile and targetfile
// elements of &lt;execon&gt; and &lt;transform&gt; - don't know
// whether there might be additional use cases.</p> --SB
public class Marker
{
private int realPos = -1;

private int position;

Marker( int position )
{
this.position = position;
}

/**
* Return the number of arguments that preceeded this marker. <p>
*
* The name of the executable - if set - is counted as the very first
* argument.</p>
*
* @return The Position value
*/
public int getPosition()
{
if( realPos == -1 )
{
realPos = ( m_executable == null ? 0 : 1 );
for( int i = 0; i < position; i++ )
{
Argument arg = (Argument)m_arguments.get( i );
realPos += arg.getParts().length;
}
}
return realPos;
}
}
}

+ 2
- 2
proposal/myrmidon/src/main/org/apache/tools/ant/types/CommandlineJava.java View File

@@ -218,7 +218,7 @@ public class CommandlineJava implements Cloneable
return c;
}

public Commandline.Argument createArgument()
public Argument createArgument()
{
return javaCommand.createArgument();
}
@@ -232,7 +232,7 @@ public class CommandlineJava implements Cloneable
return classpath;
}

public Commandline.Argument createVmArgument()
public Argument createVmArgument()
{
return vmCommand.createArgument();
}


+ 0
- 1
proposal/myrmidon/src/main/org/apache/tools/ant/types/EnvironmentData.java View File

@@ -38,5 +38,4 @@ public class EnvironmentData
{
m_variables.add( var );
}

}

+ 53
- 0
proposal/myrmidon/src/main/org/apache/tools/ant/types/Marker.java View File

@@ -0,0 +1,53 @@
/*
* 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.types;

import java.util.ArrayList;

/**
* Class to keep track of the position of an Argument.
*
* <p>This class is there to support the srcfile and targetfile
* elements of &lt;execon&gt; and &lt;transform&gt; - don't know
* whether there might be additional use cases.</p> --SB
*/
public class Marker
{
private int m_realPos = -1;
private int m_position;
private Commandline m_commandline;

Marker( Commandline commandline, int position )
{
m_commandline = commandline;
m_position = position;
}

/**
* Return the number of arguments that preceeded this marker. <p>
*
* The name of the executable - if set - is counted as the very first
* argument.</p>
*
* @return The Position value
*/
public int getPosition()
{
if( m_realPos == -1 )
{
m_realPos = ( m_commandline.getExecutable() == null ? 0 : 1 );
final ArrayList arguments = m_commandline.m_arguments;
for( int i = 0; i < m_position; i++ )
{
final Argument arg = (Argument)arguments.get( i );
m_realPos += arg.getParts().length;
}
}
return m_realPos;
}
}

+ 5
- 4
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ExecuteOn.java View File

@@ -20,6 +20,7 @@ import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.EnumeratedAttribute;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.Mapper;
import org.apache.tools.ant.types.Marker;
import org.apache.tools.ant.util.FileNameMapper;
import org.apache.tools.ant.util.SourceFileScanner;

@@ -36,9 +37,9 @@ public class ExecuteOn extends ExecTask
private boolean relative = false;
private boolean parallel = false;
protected String type = "file";
protected Commandline.Marker srcFilePos = null;
protected Marker srcFilePos = null;
private boolean skipEmpty = false;
protected Commandline.Marker targetFilePos = null;
protected Marker targetFilePos = null;
protected Mapper mapperElement = null;
protected FileNameMapper mapper = null;
protected File destDir = null;
@@ -132,7 +133,7 @@ public class ExecuteOn extends ExecTask
*
* @return Description of the Returned Value
*/
public Commandline.Marker createSrcfile()
public Marker createSrcfile()
throws TaskException
{
if( srcFilePos != null )
@@ -149,7 +150,7 @@ public class ExecuteOn extends ExecTask
*
* @return Description of the Returned Value
*/
public Commandline.Marker createTargetfile()
public Marker createTargetfile()
throws TaskException
{
if( targetFilePos != null )


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

@@ -24,6 +24,7 @@ import org.apache.tools.ant.types.EnvironmentData;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Reference;
import org.apache.tools.ant.types.EnvironmentVariable;
import org.apache.tools.ant.types.Argument;

/**
* This task acts as a loader for java applications but allows to use the same
@@ -185,7 +186,7 @@ public class Java extends Task
*
* @return Description of the Returned Value
*/
public Commandline.Argument createArg()
public Argument createArg()
{
return cmdl.createArgument();
}
@@ -206,7 +207,7 @@ public class Java extends Task
*
* @return Description of the Returned Value
*/
public Commandline.Argument createJvmarg()
public Argument createJvmarg()
{
return cmdl.createVmArgument();
}


+ 2
- 1
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Javac.java View File

@@ -19,6 +19,7 @@ import org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Reference;
import org.apache.tools.ant.types.Argument;
import org.apache.tools.ant.util.GlobPatternMapper;
import org.apache.tools.ant.util.SourceFileScanner;

@@ -914,7 +915,7 @@ public class Javac extends MatchingTask
* @author RT
*/
public class ImplementationSpecificArgument
extends Commandline.Argument
extends Argument
{

private String impl;


+ 2
- 1
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/exec/ExecTask.java View File

@@ -22,6 +22,7 @@ import org.apache.tools.ant.Task;
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.types.Argument;

/**
* Executes a given command if the os platform is appropriate.
@@ -186,7 +187,7 @@ public class ExecTask extends Task
*
* @return Description of the Returned Value
*/
public Commandline.Argument createArg()
public Argument createArg()
{
return cmdl.createArgument();
}


+ 2
- 1
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ANTLR.java View File

@@ -21,6 +21,7 @@ import org.apache.tools.ant.taskdefs.exec.LogStreamHandler;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Argument;

/**
* ANTLR task.
@@ -104,7 +105,7 @@ public class ANTLR extends Task
* the JVM.
* @see #setFork(boolean)
*/
public Commandline.Argument createJvmarg()
public Argument createJvmarg()
{
return commandline.createVmArgument();
}


+ 2
- 1
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java View File

@@ -23,6 +23,7 @@ import org.apache.tools.ant.taskdefs.exec.Execute;
import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Argument;

/**
* BorlandDeploymentTool is dedicated to the Borland Application Server 4.5 and
@@ -491,7 +492,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec

javaTask = (Java)getTask().getProject().createTask( "java" );
javaTask.setClassname( VERIFY );
Commandline.Argument arguments = javaTask.createArg();
Argument arguments = javaTask.createArg();
arguments.setLine( args );
Path classpath = getCombinedClasspath();
if( classpath != null )


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

@@ -14,6 +14,7 @@ import org.apache.tools.ant.taskdefs.Java;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Argument;

/**
* Build a serialised deployment descriptor given a text file description of the
@@ -122,7 +123,7 @@ public class DDCreator extends MatchingTask
Java ddCreatorTask = (Java)getProject().createTask( "java" );
ddCreatorTask.setFork( true );
ddCreatorTask.setClassname( "org.apache.tools.ant.taskdefs.optional.ejb.DDCreatorHelper" );
Commandline.Argument arguments = ddCreatorTask.createArg();
Argument arguments = ddCreatorTask.createArg();
arguments.setLine( args );
ddCreatorTask.setClasspath( new Path( getProject(), execClassPath ) );
if( ddCreatorTask.executeJava() != 0 )


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

@@ -14,6 +14,7 @@ import org.apache.tools.ant.taskdefs.Java;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Argument;

/**
* Build EJB support classes using Weblogic's ejbc tool from a directory
@@ -181,7 +182,7 @@ public class Ejbc extends MatchingTask
args += " " + files[ i ];
}

Commandline.Argument arguments = helperTask.createArg();
Argument arguments = helperTask.createArg();
arguments.setLine( args );
helperTask.setClasspath( new Path( getProject(), execClassPath ) );
if( helperTask.executeJava() != 0 )


+ 2
- 1
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java View File

@@ -25,6 +25,7 @@ import org.apache.tools.ant.types.EnumeratedAttribute;
import org.apache.tools.ant.types.EnvironmentData;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.EnvironmentVariable;
import org.apache.tools.ant.types.Argument;

/**
* Websphere deployment tool that augments the ejbjar task.
@@ -982,7 +983,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool

// Set the Java class name
javaTask.setClassname( "com.ibm.etools.ejbdeploy.EJBDeploy" );
Commandline.Argument arguments = javaTask.createArg();
Argument arguments = javaTask.createArg();
arguments.setLine( args );
Path classpath = wasClasspath;
if( classpath == null )


+ 2
- 1
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java View File

@@ -19,6 +19,7 @@ import org.apache.tools.ant.taskdefs.exec.LogStreamHandler;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Argument;

/**
* Taskdef for the JJTree compiler compiler.
@@ -180,7 +181,7 @@ public class JJTree extends Task
"/JavaCC.zip" );
classpath.addJavaRuntime();

final Commandline.Argument arg = cmdl.createVmArgument();
final Argument arg = cmdl.createVmArgument();
arg.setValue( "-mx140M" );
arg.setValue( "-Dinstall.root=" + javaccHome.getAbsolutePath() );



+ 2
- 1
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java View File

@@ -17,6 +17,7 @@ import org.apache.tools.ant.taskdefs.exec.Execute;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Argument;

/**
* Taskdef for the JavaCC compiler compiler.
@@ -230,7 +231,7 @@ public class JavaCC extends Task
"/JavaCC.zip" );
classpath.addJavaRuntime();

final Commandline.Argument arg = cmdl.createVmArgument();
final Argument arg = cmdl.createVmArgument();
arg.setValue( "-mx140M" );
arg.setValue( "-Dinstall.root=" + javaccHome.getAbsolutePath() );



+ 2
- 1
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java View File

@@ -23,6 +23,7 @@ import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.EnumeratedAttribute;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Reference;
import org.apache.tools.ant.types.Argument;

/**
* Ant task to run JDepend tests. <p>
@@ -219,7 +220,7 @@ public class JDependTask extends Task
* the JVM.
* @see #setFork(boolean)
*/
public Commandline.Argument createJvmarg( CommandlineJava commandline )
public Argument createJvmarg( CommandlineJava commandline )
{
return commandline.createVmArgument();
}


+ 2
- 1
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java View File

@@ -31,6 +31,7 @@ import org.apache.tools.ant.types.EnumeratedAttribute;
import org.apache.tools.ant.types.EnvironmentData;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.EnvironmentVariable;
import org.apache.tools.ant.types.Argument;

/**
* Ant task to run JUnit tests. <p>
@@ -367,7 +368,7 @@ public class JUnitTask extends Task
* the JVM.
* @see #setFork(boolean)
*/
public Commandline.Argument createJvmarg()
public Argument createJvmarg()
{
return commandline.createVmArgument();
}


+ 4
- 3
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java View File

@@ -25,6 +25,7 @@ import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Argument;

/**
* Somewhat abstract framework to be used for other metama 2.0 tasks. This
@@ -169,7 +170,7 @@ public abstract class AbstractMetamataTask extends Task
*
* @return Description of the Returned Value
*/
public Commandline.Argument createJvmarg()
public Argument createJvmarg()
{
return cmdl.createVmArgument();
}
@@ -226,7 +227,7 @@ public abstract class AbstractMetamataTask extends Task
classPath.createPathElement().setLocation( jar );

// set the metamata.home property
final Commandline.Argument vmArgs = cmdl.createVmArgument();
final Argument vmArgs = cmdl.createVmArgument();
vmArgs.setValue( "-Dmetamata.home=" + metamataHome.getAbsolutePath() );

// retrieve all the files we want to scan
@@ -237,7 +238,7 @@ public abstract class AbstractMetamataTask extends Task
ArrayList options = getOptions();
optionsFile = createTmpFile();
generateOptionsFile( optionsFile, options );
Commandline.Argument args = cmdl.createArgument();
Argument args = cmdl.createArgument();
args.setLine( "-arguments " + optionsFile.getAbsolutePath() );
}



+ 4
- 3
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java View File

@@ -22,6 +22,7 @@ import org.apache.tools.ant.taskdefs.exec.LogStreamHandler;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Argument;

/**
* Simple Metamata MParse task based on the original written by <a
@@ -160,7 +161,7 @@ public class MParse extends Task
*
* @return Description of the Returned Value
*/
public Commandline.Argument createJvmarg()
public Argument createJvmarg()
{
return cmdl.createVmArgument();
}
@@ -218,14 +219,14 @@ public class MParse extends Task
}

// set the metamata.home property
final Commandline.Argument vmArgs = cmdl.createVmArgument();
final Argument vmArgs = cmdl.createVmArgument();
vmArgs.setValue( "-Dmetamata.home=" + metahome.getAbsolutePath() );

// write all the options to a temp file and use it ro run the process
String[] options = getOptions();
optionsFile = createTmpFile();
generateOptionsFile( optionsFile, options );
Commandline.Argument args = cmdl.createArgument();
Argument args = cmdl.createArgument();
args.setLine( "-arguments " + optionsFile.getAbsolutePath() );
}



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

@@ -25,6 +25,7 @@ import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.EnumeratedAttribute;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Argument;

/**
* Convenient task to run Sitraka JProbe Coverage from Ant. Options are pretty
@@ -217,7 +218,7 @@ public class Coverage extends Task
*
* @return Description of the Returned Value
*/
public Commandline.Argument createArg()
public Argument createArg()
{
return cmdlJava.createArgument();
}
@@ -244,7 +245,7 @@ public class Coverage extends Task
*
* @return Description of the Returned Value
*/
public Commandline.Argument createJvmarg()
public Argument createJvmarg()
{
return cmdlJava.createVmArgument();
}


+ 72
- 0
proposal/myrmidon/src/todo/org/apache/tools/ant/types/Argument.java View File

@@ -0,0 +1,72 @@
/*
* 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.types;

import java.io.File;
import org.apache.myrmidon.api.TaskException;

/**
* Used for nested xml command line definitions.
*/
public class Argument
{
private String[] m_parts;

/**
* Sets a single commandline argument to the absolute filename of the
* given file.
*
* @param value a single commandline argument.
*/
public void setFile( final File value )
{
m_parts = new String[]{value.getAbsolutePath()};
}

/**
* Line to split into several commandline arguments.
*
* @param line line to split into several commandline arguments
*/
public void setLine( final String line )
throws TaskException
{
m_parts = Commandline.translateCommandline( line );
}

/**
* Sets a single commandline argument and treats it like a PATH -
* ensures the right separator for the local platform is used.
*
* @param value a single commandline argument.
*/
public void setPath( final Path value )
{
m_parts = new String[]{value.toString()};
}

/**
* Sets a single commandline argument.
*
* @param value a single commandline argument.
*/
public void setValue( final String value )
{
m_parts = new String[]{value};
}

/**
* Returns the parts this Argument consists of.
*
* @return The Parts value
*/
public String[] getParts()
{
return m_parts;
}
}

+ 11
- 114
proposal/myrmidon/src/todo/org/apache/tools/ant/types/Commandline.java View File

@@ -35,13 +35,12 @@ import org.apache.myrmidon.api.TaskException;
public class Commandline
implements Cloneable
{
private ArrayList m_arguments = new ArrayList();
protected final ArrayList m_arguments = new ArrayList();
private String m_executable;

public Commandline( String to_process )
throws TaskException
{
super();
String[] tmp = translateCommandline( to_process );
if( tmp != null && tmp.length > 0 )
{
@@ -206,11 +205,11 @@ public class Commandline
*
* @param executable The new Executable value
*/
public void setExecutable( String executable )
public void setExecutable( final String executable )
{
if( executable == null || executable.length() == 0 )
return;
this.m_executable = executable.replace( '/', File.separatorChar )
m_executable = executable.replace( '/', File.separatorChar )
.replace( '\\', File.separatorChar );
}

@@ -222,11 +221,12 @@ public class Commandline
*/
public String[] getArguments()
{
ArrayList result = new ArrayList( m_arguments.size() * 2 );
for( int i = 0; i < m_arguments.size(); i++ )
final int size = m_arguments.size();
final ArrayList result = new ArrayList( size * 2 );
for( int i = 0; i < size; i++ )
{
Argument arg = (Argument)m_arguments.get( i );
String[] s = arg.getParts();
final Argument arg = (Argument)m_arguments.get( i );
final String[] s = arg.getParts();
for( int j = 0; j < s.length; j++ )
{
result.add( s[ j ] );
@@ -246,7 +246,9 @@ public class Commandline
{
final String[] args = getArguments();
if( m_executable == null )
{
return args;
}
final String[] result = new String[ args.length + 1 ];
result[ 0 ] = m_executable;
System.arraycopy( args, 0, result, 1, args.length );
@@ -315,7 +317,7 @@ public class Commandline
*/
public Marker createMarker()
{
return new Marker( m_arguments.size() );
return new Marker( this, m_arguments.size() );
}

public int size()
@@ -328,109 +330,4 @@ public class Commandline
return toString( getCommandline() );
}

/**
* Used for nested xml command line definitions.
*
* @author RT
*/
public static class Argument
{

private String[] parts;

/**
* Sets a single commandline argument to the absolute filename of the
* given file.
*
* @param value a single commandline argument.
*/
public void setFile( File value )
{
parts = new String[]{value.getAbsolutePath()};
}

/**
* Line to split into several commandline arguments.
*
* @param line line to split into several commandline arguments
*/
public void setLine( String line )
throws TaskException
{
parts = translateCommandline( line );
}

/**
* Sets a single commandline argument and treats it like a PATH -
* ensures the right separator for the local platform is used.
*
* @param value a single commandline argument.
*/
public void setPath( Path value )
{
parts = new String[]{value.toString()};
}

/**
* Sets a single commandline argument.
*
* @param value a single commandline argument.
*/
public void setValue( String value )
{
parts = new String[]{value};
}

/**
* Returns the parts this Argument consists of.
*
* @return The Parts value
*/
public String[] getParts()
{
return parts;
}
}

/**
* Class to keep track of the position of an Argument.
*
* @author RT
*/
// <p>This class is there to support the srcfile and targetfile
// elements of &lt;execon&gt; and &lt;transform&gt; - don't know
// whether there might be additional use cases.</p> --SB
public class Marker
{
private int realPos = -1;

private int position;

Marker( int position )
{
this.position = position;
}

/**
* Return the number of arguments that preceeded this marker. <p>
*
* The name of the executable - if set - is counted as the very first
* argument.</p>
*
* @return The Position value
*/
public int getPosition()
{
if( realPos == -1 )
{
realPos = ( m_executable == null ? 0 : 1 );
for( int i = 0; i < position; i++ )
{
Argument arg = (Argument)m_arguments.get( i );
realPos += arg.getParts().length;
}
}
return realPos;
}
}
}

+ 2
- 2
proposal/myrmidon/src/todo/org/apache/tools/ant/types/CommandlineJava.java View File

@@ -218,7 +218,7 @@ public class CommandlineJava implements Cloneable
return c;
}

public Commandline.Argument createArgument()
public Argument createArgument()
{
return javaCommand.createArgument();
}
@@ -232,7 +232,7 @@ public class CommandlineJava implements Cloneable
return classpath;
}

public Commandline.Argument createVmArgument()
public Argument createVmArgument()
{
return vmCommand.createArgument();
}


+ 0
- 1
proposal/myrmidon/src/todo/org/apache/tools/ant/types/EnvironmentData.java View File

@@ -38,5 +38,4 @@ public class EnvironmentData
{
m_variables.add( var );
}

}

+ 53
- 0
proposal/myrmidon/src/todo/org/apache/tools/ant/types/Marker.java View File

@@ -0,0 +1,53 @@
/*
* 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.types;

import java.util.ArrayList;

/**
* Class to keep track of the position of an Argument.
*
* <p>This class is there to support the srcfile and targetfile
* elements of &lt;execon&gt; and &lt;transform&gt; - don't know
* whether there might be additional use cases.</p> --SB
*/
public class Marker
{
private int m_realPos = -1;
private int m_position;
private Commandline m_commandline;

Marker( Commandline commandline, int position )
{
m_commandline = commandline;
m_position = position;
}

/**
* Return the number of arguments that preceeded this marker. <p>
*
* The name of the executable - if set - is counted as the very first
* argument.</p>
*
* @return The Position value
*/
public int getPosition()
{
if( m_realPos == -1 )
{
m_realPos = ( m_commandline.getExecutable() == null ? 0 : 1 );
final ArrayList arguments = m_commandline.m_arguments;
for( int i = 0; i < m_position; i++ )
{
final Argument arg = (Argument)arguments.get( i );
m_realPos += arg.getParts().length;
}
}
return m_realPos;
}
}

Loading…
Cancel
Save