# LongRunningOperation

interface LongRunningOperation

Offers ways to communicate both ways with a Gradle operation, be it building a model or running tasks.

Enables tracking progress via listeners that will receive events from the Gradle operation.

Allows providing standard output streams that will receive output if the Gradle operation writes to standard streams.

Allows providing standard input that can be consumed by the gradle operation (useful for interactive builds).

Enables configuring the build run / model request with options like the Java home or JVM arguments. Those settings might not be supported by the target Gradle version. Refer to Javadoc for those methods to understand what kind of exception throw and when is it thrown.

#### Since

1.0-milestone-7

#### Inheritors

ConfigurableLauncher

## Functions

addArguments
Link copied to clipboard
abstract fun addArguments(arguments: Iterable<String>): LongRunningOperation
abstract fun addArguments(arguments: Array<String>): LongRunningOperation
Appends new command line arguments to the existing list.
addJvmArguments
Link copied to clipboard
abstract fun addJvmArguments(jvmArguments: Iterable<String>): LongRunningOperation
abstract fun addJvmArguments(jvmArguments: Array<String>): LongRunningOperation
Appends Java VM arguments to the existing list.
addProgressListener
Link copied to clipboard
abstract fun addProgressListener(listener: ProgressListener): LongRunningOperation
Adds a progress listener which will receive progress events as the operation runs.
abstract fun addProgressListener(listener: ProgressListener): LongRunningOperation
Adds a progress listener which will receive progress events of all types as the operation runs.
abstract fun addProgressListener(listener: ProgressListener, operationTypes: Set<OperationType>): LongRunningOperation
abstract fun addProgressListener(listener: ProgressListener, operationTypes: Array<OperationType>): LongRunningOperation
Adds a progress listener which will receive progress events as the operations of the requested type run.
setColorOutput
Link copied to clipboard
abstract fun setColorOutput(colorOutput: Boolean): LongRunningOperation
Specifies whether to generate colored (ANSI encoded) output for logging.
setEnvironmentVariables
Link copied to clipboard
abstract fun setEnvironmentVariables(@Nullable envVariables: Map<String, String>): LongRunningOperation
Specifies the environment variables to use for this operation.
setJavaHome
Link copied to clipboard
abstract fun setJavaHome(@Nullable javaHome: File): LongRunningOperation
Specifies the Java home directory to use for this operation.
setJvmArguments
Link copied to clipboard
abstract fun setJvmArguments(@Nullable jvmArguments: Iterable<String>): LongRunningOperation
abstract fun setJvmArguments(@Nullable jvmArguments: Array<String>): LongRunningOperation
Specifies the Java VM arguments to use for this operation.
setStandardError
Link copied to clipboard
abstract fun setStandardError(outputStream: OutputStream): LongRunningOperation
Sets the OutputStream which should receive standard error logging generated while running the operation.
setStandardInput
Link copied to clipboard
abstract fun setStandardInput(inputStream: InputStream): LongRunningOperation
Sets the java.io.InputStream that will be used as standard input for this operation.
setStandardOutput
Link copied to clipboard
abstract fun setStandardOutput(outputStream: OutputStream): LongRunningOperation
Sets the java.io.OutputStream which should receive standard output logging generated while running the operation.
withArguments
Link copied to clipboard
abstract fun withArguments(@Nullable arguments: Iterable<String>): LongRunningOperation
abstract fun withArguments(@Nullable arguments: Array<String>): LongRunningOperation
Specify the command line build arguments.
withCancellationToken
Link copied to clipboard
abstract fun withCancellationToken(cancellationToken: CancellationToken): LongRunningOperation
Sets the cancellation token to use to cancel the operation if required.
withDetailedFailure
Link copied to clipboard
@Incubating
abstract fun withDetailedFailure(): LongRunningOperation
Adds more detailed information about the build failure to the GradleConnectionException that provides insights into the reasons for the failure, making it easier to diagnose and fix issues.
withSystemProperties
Link copied to clipboard
@Incubating
abstract fun withSystemProperties(systemProperties: Map<String, String>): LongRunningOperation
Sets system properties to pass to the build.