net.sf.antcontrib.platform

Class ShellScriptTask

public class ShellScriptTask extends 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

Method Summary
voidaddText(String s)
Adds s to the lines of script code.
voidexecute()
execute the task
voidsetCommand(Commandline notUsed)
Disallow the command attribute of parent class ExecTask. ant.attribute ignore="true"
voidsetExecutable(String shell)
Sets the shell used to run the script.
voidsetInputString(String s)
Sets script code to s.
voidsetShell(String shell)
Sets the shell used to run the script.
voidsetTmpSuffix(String tmpSuffix)
Sets the suffix for the tmp file used to contain the script.
protected voidwriteScript()
Writes the script lines to a temp file.

Method Detail

addText

public void addText(String s)
Adds s to the lines of script code.

execute

public void execute()
execute the task

setCommand

public void setCommand(Commandline notUsed)
Disallow the command attribute of parent class ExecTask. ant.attribute ignore="true"

Parameters: notUsed not used

Throws: BuildException if called

setExecutable

public void setExecutable(String shell)
Sets the shell used to run the script.

Parameters: shell the shell to use (bash is default)

setInputString

public void setInputString(String s)
Sets script code to s.

setShell

public void setShell(String shell)
Sets the shell used to run the script.

Parameters: shell the shell to use (bash is default)

setTmpSuffix

public void setTmpSuffix(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

writeScript

protected void writeScript()
Writes the script lines to a temp file.