net.sf.antcontrib.platform
Class ShellScriptTask
java.lang.Object
|
+--org.apache.tools.ant.ProjectComponent
|
+--org.apache.tools.ant.Task
|
+--org.apache.tools.ant.taskdefs.ExecTask
|
+--net.sf.antcontrib.platform.ShellScriptTask
- public class ShellScriptTask
- extends org.apache.tools.ant.taskdefs.ExecTask
A generic front-end for passing "shell lines" to any application which can
accept a filename containing script input (bash, perl, csh, tcsh, etc.).
see antcontrib doc for useage
- Author:
- stephan beal, peter reilly
Fields inherited from class org.apache.tools.ant.taskdefs.ExecTask |
cmdl, failOnError, newEnvironment |
Fields inherited from class org.apache.tools.ant.Task |
description, location, target, taskName, taskType, wrapper |
Fields inherited from class org.apache.tools.ant.ProjectComponent |
project |
Method Summary |
void |
addText(java.lang.String s)
Adds s to the lines of script code. |
void |
execute()
execute the task |
void |
setCommand(org.apache.tools.ant.types.Commandline notUsed)
Disallow the command attribute of parent class ExecTask. |
void |
setExecutable(java.lang.String shell)
Sets the shell used to run the script. |
void |
setInputString(java.lang.String s)
Sets script code to s. |
void |
setShell(java.lang.String shell)
Sets the shell used to run the script. |
void |
setTmpSuffix(java.lang.String tmpSuffix)
Sets the suffix for the tmp file used to
contain the script. |
protected void |
writeScript()
Writes the script lines to a temp file. |
Methods inherited from class org.apache.tools.ant.taskdefs.ExecTask |
addEnv, checkConfiguration, createArg, createHandler, createWatchdog, isValidOs, logFlush, maybeSetResultPropertyValue, prepareExec, runExec, runExecute, setAppend, setDir, setFailIfExecutionFails, setFailonerror, setNewenvironment, setOs, setOutput, setOutputproperty, setResultProperty, setTimeout, setTimeout, setVMLauncher |
Methods inherited from class org.apache.tools.ant.Task |
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorFlush, handleErrorOutput, handleFlush, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName |
Methods inherited from class org.apache.tools.ant.ProjectComponent |
getProject, setProject |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ShellScriptTask
public ShellScriptTask()
addText
public void addText(java.lang.String s)
- Adds s to the lines of script code.
setInputString
public void setInputString(java.lang.String s)
- Sets script code to s.
setShell
public void setShell(java.lang.String shell)
- Sets the shell used to run the script.
- Parameters:
shell
- the shell to use (bash is default)
setExecutable
public void setExecutable(java.lang.String shell)
- Sets the shell used to run the script.
- Overrides:
setExecutable
in class org.apache.tools.ant.taskdefs.ExecTask
- Parameters:
shell
- the shell to use (bash is default)
setCommand
public void setCommand(org.apache.tools.ant.types.Commandline notUsed)
- Disallow the command attribute of parent class ExecTask.
ant.attribute ignore="true"
- Overrides:
setCommand
in class org.apache.tools.ant.taskdefs.ExecTask
- Parameters:
notUsed
- not used- Throws:
org.apache.tools.ant.BuildException
- if called
setTmpSuffix
public void setTmpSuffix(java.lang.String tmpSuffix)
- Sets the suffix for the tmp file used to
contain the script.
This is useful for cmd.exe as one can
use cmd /c call x.bat
- Parameters:
tmpSuffix
- the suffix to use
execute
public void execute()
throws org.apache.tools.ant.BuildException
- execute the task
- Overrides:
execute
in class org.apache.tools.ant.taskdefs.ExecTask
writeScript
protected void writeScript()
throws org.apache.tools.ant.BuildException
- Writes the script lines to a temp file.