T
- The concrete type of the class.BaseExecSpec
, ExecSpec
, ProcessForkOptions
Exec
, RunTestExecutable
public abstract class AbstractExecTask<T extends AbstractExecTask> extends org.gradle.api.internal.ConventionTask implements ExecSpec
AbstractExecTask
is the base class for all exec tasks.Task.Namer
TASK_ACTION, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE
Constructor | Description |
---|---|
AbstractExecTask(java.lang.Class<T> taskType) |
Modifier and Type | Method | Description |
---|---|---|
T |
args(java.lang.Iterable<?> args) |
Adds arguments for the command to be executed.
|
T |
args(java.lang.Object... args) |
Adds arguments for the command to be executed.
|
T |
commandLine(java.lang.Iterable<?> args) |
Sets the full command line, including the executable to be executed plus its arguments.
|
T |
commandLine(java.lang.Object... arguments) |
Sets the full command line, including the executable to be executed plus its arguments.
|
T |
copyTo(ProcessForkOptions target) |
Copies these options to the given target options.
|
T |
environment(java.lang.String name,
java.lang.Object value) |
Adds an environment variable to the environment for this process.
|
T |
environment(java.util.Map<java.lang.String,?> environmentVariables) |
Adds some environment variables to the environment for this process.
|
protected void |
exec() |
|
T |
executable(java.lang.Object executable) |
Sets the name of the executable to use.
|
java.util.List<java.lang.String> |
getArgs() |
Returns the arguments for the command to be executed.
|
java.util.List<java.lang.String> |
getCommandLine() |
Returns the full command line, including the executable plus its arguments.
|
java.util.Map<java.lang.String,java.lang.Object> |
getEnvironment() |
The environment variables to use for the process.
|
java.io.OutputStream |
getErrorOutput() |
Returns the output stream to consume standard error from the process executing the command.
|
protected org.gradle.process.internal.ExecActionFactory |
getExecActionFactory() |
|
ExecResult |
getExecResult() |
Returns the result for the command run by this task.
|
java.lang.String |
getExecutable() |
Returns the name of the executable to use.
|
java.io.InputStream |
getStandardInput() |
Returns the standard input stream for the process executing the command.
|
java.io.OutputStream |
getStandardOutput() |
Returns the output stream to consume standard output from the process executing the command.
|
java.io.File |
getWorkingDir() |
Returns the working directory for the process.
|
boolean |
isIgnoreExitValue() |
Tells whether a non-zero exit value is ignored, or an exception thrown.
|
T |
setArgs(java.lang.Iterable<?> arguments) |
Sets the arguments for the command to be executed.
|
void |
setCommandLine(java.lang.Iterable<?> args) |
Sets the full command line, including the executable to be executed plus its arguments.
|
void |
setCommandLine(java.lang.Object... args) |
Sets the full command line, including the executable to be executed plus its arguments.
|
void |
setEnvironment(java.util.Map<java.lang.String,?> environmentVariables) |
Sets the environment variable to use for the process.
|
T |
setErrorOutput(java.io.OutputStream outputStream) |
Sets the output stream to consume standard error from the process executing the command.
|
void |
setExecutable(java.lang.Object executable) |
Sets the name of the executable to use.
|
T |
setIgnoreExitValue(boolean ignoreExitValue) |
Sets whether a non-zero exit value is ignored, or an exception thrown.
|
T |
setStandardInput(java.io.InputStream inputStream) |
Sets the standard input stream for the process executing the command.
|
T |
setStandardOutput(java.io.OutputStream outputStream) |
Sets the output stream to consume standard output from the process executing the command.
|
void |
setWorkingDir(java.lang.Object dir) |
Sets the working directory for the process.
|
T |
workingDir(java.lang.Object dir) |
Sets the working directory for the process.
|
addValidator, appendParallelSafeAction, compareTo, configure, deleteAllActions, dependsOn, dependsOnTaskDidWork, doFirst, doFirst, doLast, doLast, execute, finalizedBy, getActionClassLoaders, getActions, getAnt, getAsDynamicObject, getConvention, getDependsOn, getDescription, getDidWork, getEnabled, getExecuter, getExtensions, getFinalizedBy, getGroup, getIdentityPath, getImpliesSubProjects, getInputs, getLogger, getLogging, getMustRunAfter, getName, getOnlyIf, getOutputs, getPath, getProject, getServices, getShouldRunAfter, getStandardOutputCapture, getState, getTaskActions, getTaskDependencies, getTemporaryDir, getTemporaryDirFactory, getValidators, hasProperty, injectIntoNewInstance, isEnabled, isHasCustomActions, leftShift, mustRunAfter, onlyIf, onlyIf, prependParallelSafeAction, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setExecuter, setFinalizedBy, setGroup, setImpliesSubProjects, setMustRunAfter, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, toString
public AbstractExecTask(java.lang.Class<T> taskType)
@Inject protected org.gradle.process.internal.ExecActionFactory getExecActionFactory()
protected void exec()
public T commandLine(java.lang.Object... arguments)
commandLine
in interface ExecSpec
arguments
- the command plus the args to be executedpublic T commandLine(java.lang.Iterable<?> args)
commandLine
in interface ExecSpec
args
- the command plus the args to be executedpublic T args(java.lang.Object... args)
public T args(java.lang.Iterable<?> args)
public T setArgs(java.lang.Iterable<?> arguments)
@Optional @Input public java.util.List<java.lang.String> getArgs()
@Internal public java.util.List<java.lang.String> getCommandLine()
getCommandLine
in interface BaseExecSpec
public void setCommandLine(java.lang.Iterable<?> args)
setCommandLine
in interface ExecSpec
args
- the command plus the args to be executedpublic void setCommandLine(java.lang.Object... args)
setCommandLine
in interface ExecSpec
args
- the command plus the args to be executed@Optional @Input public java.lang.String getExecutable()
getExecutable
in interface ProcessForkOptions
public void setExecutable(java.lang.Object executable)
setExecutable
in interface ProcessForkOptions
executable
- The executable. Must not be null.public T executable(java.lang.Object executable)
executable
in interface ProcessForkOptions
executable
- The executable. Must not be null.@Internal public java.io.File getWorkingDir()
getWorkingDir
in interface ProcessForkOptions
public void setWorkingDir(java.lang.Object dir)
Project.file(Object)
.setWorkingDir
in interface ProcessForkOptions
dir
- The working directory. Must not be null.public T workingDir(java.lang.Object dir)
Project.file(Object)
.workingDir
in interface ProcessForkOptions
dir
- The working directory. Must not be null.@Internal public java.util.Map<java.lang.String,java.lang.Object> getEnvironment()
getEnvironment
in interface ProcessForkOptions
public void setEnvironment(java.util.Map<java.lang.String,?> environmentVariables)
setEnvironment
in interface ProcessForkOptions
environmentVariables
- The environment variables. Must not be null.public T environment(java.lang.String name, java.lang.Object value)
environment
in interface ProcessForkOptions
name
- The name of the variable.value
- The value for the variable. Must not be null.public T environment(java.util.Map<java.lang.String,?> environmentVariables)
environment
in interface ProcessForkOptions
environmentVariables
- The environment variables. Must not be null.public T copyTo(ProcessForkOptions target)
copyTo
in interface ProcessForkOptions
target
- The target optionspublic T setStandardInput(java.io.InputStream inputStream)
setStandardInput
in interface BaseExecSpec
inputStream
- The standard input stream for the process. Must not be null.@Internal public java.io.InputStream getStandardInput()
getStandardInput
in interface BaseExecSpec
public T setStandardOutput(java.io.OutputStream outputStream)
setStandardOutput
in interface BaseExecSpec
outputStream
- The standard output stream for the process. Must not be null.@Internal public java.io.OutputStream getStandardOutput()
System.out
.getStandardOutput
in interface BaseExecSpec
public T setErrorOutput(java.io.OutputStream outputStream)
setErrorOutput
in interface BaseExecSpec
outputStream
- The standard output error stream for the process. Must not be null.@Internal public java.io.OutputStream getErrorOutput()
System.err
.getErrorOutput
in interface BaseExecSpec
public T setIgnoreExitValue(boolean ignoreExitValue)
setIgnoreExitValue
in interface BaseExecSpec
ignoreExitValue
- whether a non-zero exit value is ignored, or an exception thrown@Input public boolean isIgnoreExitValue()
false
.isIgnoreExitValue
in interface BaseExecSpec
@Internal public ExecResult getExecResult()
null
if this task has not been executed yet.null
if this task has not been executed yet.