Package 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
-
- All Implemented Interfaces:
java.lang.Cloneable
public class ShellScriptTask extends org.apache.tools.ant.taskdefs.ExecTaskA 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
-
-
Constructor Summary
Constructors Constructor Description ShellScriptTask()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddText(java.lang.String s)Adds s to the lines of script code.voidexecute()execute the taskvoidsetCommand(org.apache.tools.ant.types.Commandline notUsed)Disallow the command attribute of parent class ExecTask.voidsetExecutable(java.lang.String shell)Sets the shell used to run the script.voidsetInputString(java.lang.String s)Sets script code to s.voidsetShell(java.lang.String shell)Sets the shell used to run the script.voidsetTmpSuffix(java.lang.String tmpSuffix)Sets the suffix for the tmp file used to contain the script.protected voidwriteScript()Writes the script lines to a temp file.-
Methods inherited from class org.apache.tools.ant.taskdefs.ExecTask
addConfiguredRedirector, addEnv, checkConfiguration, createArg, createHandler, createWatchdog, getOs, getOsFamily, getResolveExecutable, isValidOs, logFlush, maybeSetResultPropertyValue, prepareExec, resolveExecutable, runExec, runExecute, setAppend, setDir, setDiscardError, setDiscardOutput, setError, setErrorProperty, setFailIfExecutionFails, setFailonerror, setInput, setLogError, setNewenvironment, setOs, setOsFamily, setOutput, setOutputproperty, setResolveExecutable, setResultProperty, setSearchPath, setSpawn, setTimeout, setTimeout, setupRedirector, setVMLauncher
-
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
-
-
-
-
Method Detail
-
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.- Overrides:
setInputStringin classorg.apache.tools.ant.taskdefs.ExecTask
-
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:
setExecutablein classorg.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:
setCommandin classorg.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.BuildExceptionexecute the task- Overrides:
executein classorg.apache.tools.ant.taskdefs.ExecTask- Throws:
org.apache.tools.ant.BuildException
-
writeScript
protected void writeScript() throws org.apache.tools.ant.BuildExceptionWrites the script lines to a temp file.- Throws:
org.apache.tools.ant.BuildException
-
-