Package org.gradle.api.tasks
Class AbstractExecTask<T extends AbstractExecTask>
java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
org.gradle.api.internal.ConventionTask
org.gradle.api.tasks.AbstractExecTask<T>
- Type Parameters:
- T- The concrete type of the class.
- All Implemented Interfaces:
- Comparable<Task>,- org.gradle.api.internal.DynamicObjectAware,- org.gradle.api.internal.IConventionAware,- org.gradle.api.internal.TaskInternal,- Named,- ExtensionAware,- Task,- BaseExecSpec,- ExecSpec,- ProcessForkOptions,- Configurable<Task>
- Direct Known Subclasses:
- Exec,- RunTestExecutable
@DisableCachingByDefault(because="Abstract super-class, not to be instantiated directly")
public abstract class AbstractExecTask<T extends AbstractExecTask>
extends org.gradle.api.internal.ConventionTask
implements ExecSpec
AbstractExecTask is the base class for all exec tasks.- 
Nested Class SummaryNested classes/interfaces inherited from interface org.gradle.api.TaskTask.Namer
- 
Field SummaryFields inherited from interface org.gradle.api.TaskTASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionAdds arguments for the command to be executed.Adds arguments for the command to be executed.commandLine(Iterable<?> args) Sets the full command line, including the executable to be executed plus its arguments.commandLine(Object... arguments) Sets the full command line, including the executable to be executed plus its arguments.copyTo(ProcessForkOptions target) Copies these options to the given target options.environment(String name, Object value) Adds an environment variable to the environment for this process.environment(Map<String, ?> environmentVariables) Adds some environment variables to the environment for this process.protected voidexec()executable(Object executable) Sets the name of the executable to use.getArgs()Returns the arguments for the command to be executed.Argument providers for the application.Returns the full command line, including the executable plus its arguments.The environment variables to use for the process.Returns the output stream to consume standard error from the process executing the command.protected org.gradle.process.internal.ExecActionFactoryReturns the name of the executable to use.Returns the result for the command run by this task.protected ObjectFactoryReturns the standard input stream for the process executing the command.Returns the output stream to consume standard output from the process executing the command.Returns the working directory for the process.booleanTells whether a non-zero exit value is ignored, or an exception thrown.Sets the arguments for the command to be executed.Sets the arguments for the command to be executed.voidsetCommandLine(Iterable<?> args) Sets the full command line, including the executable to be executed plus its arguments.voidsetCommandLine(Object... args) Sets the full command line, including the executable to be executed plus its arguments.voidsetCommandLine(List<String> args) Sets the full command line, including the executable to be executed plus its arguments.voidsetEnvironment(Map<String, ?> environmentVariables) Sets the environment variable to use for the process.setErrorOutput(OutputStream outputStream) Sets the output stream to consume standard error from the process executing the command.voidsetExecutable(Object executable) Sets the name of the executable to use.voidsetExecutable(String executable) Sets the name of the executable to use.setIgnoreExitValue(boolean ignoreExitValue) Sets whether a non-zero exit value is ignored, or an exception thrown.setStandardInput(InputStream inputStream) Sets the standard input stream for the process executing the command.setStandardOutput(OutputStream outputStream) Sets the output stream to consume standard output from the process executing the command.voidsetWorkingDir(File dir) Sets the working directory for the process.voidsetWorkingDir(Object dir) Sets the working directory for the process.workingDir(Object dir) Sets the working directory for the process.Methods inherited from class org.gradle.api.internal.ConventionTaskconventionMapping, conventionMapping, getConventionMappingMethods inherited from class org.gradle.api.DefaultTaskcompareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesServiceMethods inherited from class org.gradle.api.internal.AbstractTaskacceptServiceReferences, appendParallelSafeAction, doNotTrackState, getAsDynamicObject, getConvention, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, setImpliesSubProjectsMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gradle.api.TaskdoNotTrackState, getConvention, notCompatibleWithConfigurationCache
- 
Constructor Details- 
AbstractExecTask
 
- 
- 
Method Details- 
getObjectFactory
- 
getExecActionFactory@Inject protected org.gradle.process.internal.ExecActionFactory getExecActionFactory()
- 
execprotected void exec()
- 
commandLineSets the full command line, including the executable to be executed plus its arguments.- Specified by:
- commandLinein interface- ExecSpec
- Parameters:
- arguments- the command plus the args to be executed
- Returns:
- this
 
- 
commandLineSets the full command line, including the executable to be executed plus its arguments.- Specified by:
- commandLinein interface- ExecSpec
- Parameters:
- args- the command plus the args to be executed
- Returns:
- this
 
- 
argsAdds arguments for the command to be executed.
- 
argsAdds arguments for the command to be executed.
- 
setArgsSets the arguments for the command to be executed.
- 
setArgsSets the arguments for the command to be executed.
- 
getArgsReturns the arguments for the command to be executed. Defaults to an empty list.
- 
getArgumentProvidersArgument providers for the application.- Specified by:
- getArgumentProvidersin interface- ExecSpec
 
- 
getCommandLineReturns the full command line, including the executable plus its arguments.- Specified by:
- getCommandLinein interface- BaseExecSpec
- Returns:
- The full command line, including the executable plus its arguments
 
- 
setCommandLineSets the full command line, including the executable to be executed plus its arguments.- Specified by:
- setCommandLinein interface- ExecSpec
- Parameters:
- args- the command plus the args to be executed
 
- 
setCommandLineSets the full command line, including the executable to be executed plus its arguments.- Specified by:
- setCommandLinein interface- ExecSpec
- Parameters:
- args- the command plus the args to be executed
 
- 
setCommandLineSets the full command line, including the executable to be executed plus its arguments.- Specified by:
- setCommandLinein interface- ExecSpec
- Parameters:
- args- the command plus the args to be executed
 
- 
getExecutableReturns the name of the executable to use.- Specified by:
- getExecutablein interface- ProcessForkOptions
- Returns:
- The executable.
 
- 
setExecutableSets the name of the executable to use.- Specified by:
- setExecutablein interface- ProcessForkOptions
- Parameters:
- executable- The executable. Must not be null.
 
- 
setExecutableSets the name of the executable to use.- Specified by:
- setExecutablein interface- ProcessForkOptions
- Parameters:
- executable- The executable. Must not be null.
 
- 
executableSets the name of the executable to use.- Specified by:
- executablein interface- ProcessForkOptions
- Parameters:
- executable- The executable. Must not be null.
- Returns:
- this
 
- 
getWorkingDirReturns the working directory for the process. Defaults to the project directory.- Specified by:
- getWorkingDirin interface- ProcessForkOptions
- Returns:
- The working directory. Never returns null.
 
- 
setWorkingDirSets the working directory for the process.- Specified by:
- setWorkingDirin interface- ProcessForkOptions
- Parameters:
- dir- The working directory. Must not be null.
 
- 
setWorkingDirSets the working directory for the process. The supplied argument is evaluated as perProject.file(Object).- Specified by:
- setWorkingDirin interface- ProcessForkOptions
- Parameters:
- dir- The working directory. Must not be null.
 
- 
workingDirSets the working directory for the process. The supplied argument is evaluated as perProject.file(Object).- Specified by:
- workingDirin interface- ProcessForkOptions
- Parameters:
- dir- The working directory. Must not be null.
- Returns:
- this
 
- 
getEnvironmentThe environment variables to use for the process. Defaults to the environment of this process.- Specified by:
- getEnvironmentin interface- ProcessForkOptions
- Returns:
- The environment. Returns an empty map when there are no environment variables.
 
- 
setEnvironmentSets the environment variable to use for the process.- Specified by:
- setEnvironmentin interface- ProcessForkOptions
- Parameters:
- environmentVariables- The environment variables. Must not be null.
 
- 
environmentAdds an environment variable to the environment for this process.- Specified by:
- environmentin interface- ProcessForkOptions
- Parameters:
- name- The name of the variable.
- value- The value for the variable. Must not be null.
- Returns:
- this
 
- 
environmentAdds some environment variables to the environment for this process.- Specified by:
- environmentin interface- ProcessForkOptions
- Parameters:
- environmentVariables- The environment variables. Must not be null.
- Returns:
- this
 
- 
copyToCopies these options to the given target options.- Specified by:
- copyToin interface- ProcessForkOptions
- Parameters:
- target- The target options
- Returns:
- this
 
- 
setStandardInputSets the standard input stream for the process executing the command. The stream is closed after the process completes.- Specified by:
- setStandardInputin interface- BaseExecSpec
- Parameters:
- inputStream- The standard input stream for the process. Must not be null.
- Returns:
- this
 
- 
getStandardInputReturns the standard input stream for the process executing the command. The stream is closed after the process completes. Defaults to an empty stream.- Specified by:
- getStandardInputin interface- BaseExecSpec
- Returns:
- The standard input stream.
 
- 
setStandardOutputSets the output stream to consume standard output from the process executing the command. The stream is closed after the process completes.- Specified by:
- setStandardOutputin interface- BaseExecSpec
- Parameters:
- outputStream- The standard output stream for the process. Must not be null.
- Returns:
- this
 
- 
getStandardOutputReturns the output stream to consume standard output from the process executing the command. Defaults toSystem.out.- Specified by:
- getStandardOutputin interface- BaseExecSpec
- Returns:
- The output stream
 
- 
setErrorOutputSets the output stream to consume standard error from the process executing the command. The stream is closed after the process completes.- Specified by:
- setErrorOutputin interface- BaseExecSpec
- Parameters:
- outputStream- The standard output error stream for the process. Must not be null.
- Returns:
- this
 
- 
getErrorOutputReturns the output stream to consume standard error from the process executing the command. Default toSystem.err.- Specified by:
- getErrorOutputin interface- BaseExecSpec
- Returns:
- The error output stream.
 
- 
setIgnoreExitValueSets whether a non-zero exit value is ignored, or an exception thrown.- Specified by:
- setIgnoreExitValuein interface- BaseExecSpec
- Parameters:
- ignoreExitValue- whether a non-zero exit value is ignored, or an exception thrown
- Returns:
- this
 
- 
isIgnoreExitValueTells whether a non-zero exit value is ignored, or an exception thrown. Defaults tofalse.- Specified by:
- isIgnoreExitValuein interface- BaseExecSpec
- Returns:
- whether a non-zero exit value is ignored, or an exception thrown
 
- 
getExecutionResultReturns the result for the command run by this task. The provider has no value if this task has not been executed yet.- Returns:
- A provider of the result.
- Since:
- 6.1
 
 
-