Package org.gradle.tooling

# Interface ConfigurableLauncher<T extends ConfigurableLauncher>

Type Parameters:
  `T` - the ConfigurableLauncher implementation to return as part of the fluent API.

All Superinterfaces:
  `LongRunningOperation`

All Known Subinterfaces:
  `BuildActionExecuter<T>`, `BuildLauncher`, `ModelBuilder<T>`, `TestLauncher`

public interface ConfigurableLauncher<T extends ConfigurableLauncher> extends LongRunningOperation
A `ConfigurableLauncher` allows you to configure a long running operation.

Since:
  2.6

## Method Summary

Modifier and Type
Method
Description
`T`
`addProgressListener(ProgressListener listener)`
Adds a progress listener which will receive progress events of all types as the operation runs.
`T`
`addProgressListener(ProgressListener listener, Set<OperationType> eventTypes)`
Adds a progress listener which will receive progress events as the operations of the requested type run.
`T`
`addProgressListener(ProgressListener listener, OperationType... operationTypes)`
Adds a progress listener which will receive progress events as the operations of the requested type run.
`T`
`addProgressListener(ProgressListener listener)`
Adds a progress listener which will receive progress events as the operation runs.
`T`
`setColorOutput(boolean colorOutput)`
Specifies whether to generate colored (ANSI encoded) output for logging.
`T`
`setEnvironmentVariables(Map<String,String> envVariables)`
Specifies the environment variables to use for this operation.
`T`
`setJavaHome(File javaHome)`
Specifies the Java home directory to use for this operation.
`T`
`setJvmArguments(Iterable<String> jvmArguments)`
Specifies the Java VM arguments to use for this operation.
`T`
`setJvmArguments(String... jvmArguments)`
Specifies the Java VM arguments to use for this operation.
`T`
`setStandardError(OutputStream outputStream)`
Sets the `OutputStream` which should receive standard error logging generated while running the operation.
`T`
`setStandardInput(InputStream inputStream)`
Sets the `InputStream` that will be used as standard input for this operation.
`T`
`setStandardOutput(OutputStream outputStream)`
Sets the `OutputStream` which should receive standard output logging generated while running the operation.
`T`
`withArguments(Iterable<String> arguments)`
Specify the command line build arguments.
`T`
`withArguments(String... arguments)`
Specify the command line build arguments.
`T`
`withCancellationToken(CancellationToken cancellationToken)`
Sets the cancellation token to use to cancel the operation if required.

## Method Details

### withArguments

T withArguments(String... arguments)
Specify the command line build arguments. Useful mostly for running tasks via `BuildLauncher`.

Be aware that not all of the Gradle command line options are supported! Only the build arguments that configure the build execution are supported. They are modelled in the Gradle API via `StartParameter`. Examples of supported build arguments: '--info', '-u', '-p'. The command line instructions that are actually separate commands (like '-?' and '-v') are not supported. Some other instructions like '--daemon' are also not supported - the tooling API always runs with the daemon.

If an unknown or unsupported command line option is specified, `UnsupportedBuildArgumentException` will be thrown at the time the operation is executed via `BuildLauncher.run()` or `ModelBuilder.get()`.

For the list of all Gradle command line options please refer to the user guide or take a look at the output of the 'gradle -?' command. Majority of arguments modeled by `StartParameter` are supported.

The arguments can potentially override some other settings you have configured. For example, the project directory or Gradle user home directory that are configured in the `GradleConnector`. Also, the task names configured by `BuildLauncher.forTasks(String...)` can be overridden if you happen to specify other tasks via the build arguments.

See the example in the docs for `BuildLauncher` If not configured, null, or an empty array is passed, then the reasonable default will be used.

Requires Gradle 1.0 or later.

Specified by:
  `withArguments` in interface `LongRunningOperation`
Parameters:
  `arguments` - Gradle command line arguments
Returns:
  this
Since:
  1.0

### withArguments

T withArguments(Iterable<String> arguments)
Specify the command line build arguments. Useful mostly for running tasks via `BuildLauncher`.

If not configured, null, or an empty list is passed, then the reasonable default will be used.

Requires Gradle 1.0 or later.

Specified by:
  `withArguments` in interface `LongRunningOperation`
Parameters:
  `arguments` - Gradle command line arguments
Returns:
  this
Since:
  2.6

### setStandardOutput

T setStandardOutput(OutputStream outputStream)
Sets the `OutputStream` which should receive standard output logging generated while running the operation. The default is to discard the output.

Specified by:
  `setStandardOutput` in interface `LongRunningOperation`
Parameters:
  `outputStream` - The output stream. The system default character encoding will be used to encode characters written to this stream.
Returns:
  this
Since:
  1.0-milestone-3

### setStandardError

T setStandardError(OutputStream outputStream)
Sets the `OutputStream` which should receive standard error logging generated while running the operation. The default is to discard the output.

Specified by:
  `setStandardError` in interface `LongRunningOperation`
Parameters:
  `outputStream` - The output stream. The system default character encoding will be used to encode characters written to this stream.
Returns:
  this
Since:
  1.0-milestone-3

### setColorOutput

@Incubating T setColorOutput(boolean colorOutput)
Specifies whether to generate colored (ANSI encoded) output for logging. The default is to not generate color output.

Supported by Gradle 2.3 or later. Ignored for older versions.

Specified by:
  `setColorOutput` in interface `LongRunningOperation`
Parameters:
  `colorOutput` - `true` to request color output (using ANSI encoding).
Returns:
  this
Since:
  2.3

### setStandardInput

T setStandardInput(InputStream inputStream)
Sets the `InputStream` that will be used as standard input for this operation. Defaults to an empty input stream.

Specified by:
  `setStandardInput` in interface `LongRunningOperation`
Parameters:
  `inputStream` - The input stream
Returns:
  this
Since:
  1.0-milestone-7

### setJavaHome

T setJavaHome(File javaHome)
Specifies the Java home directory to use for this operation.

`BuildEnvironment` model contains information such as Java or Gradle environment. If you want to get hold of this information you can ask tooling API to build this model.

If not configured or null is passed, then the sensible default will be used.

Specified by:
  `setJavaHome` in interface `LongRunningOperation`
Parameters:
  `javaHome` - to use for the Gradle process
Returns:
  this
Since:
  1.0-milestone-8

### setJvmArguments

T setJvmArguments(String... jvmArguments)
Specifies the Java VM arguments to use for this operation.

`BuildEnvironment` model contains information such as Java or Gradle environment. If you want to get hold of this information you can ask tooling API to build this model.

If not configured, null, or an empty array is passed, then the reasonable default will be used.

Specified by:
  `setJvmArguments` in interface `LongRunningOperation`
Parameters:
  `jvmArguments` - to use for the Gradle process
Returns:
  this
Since:
  1.0-milestone-9

### setJvmArguments

T setJvmArguments(Iterable<String> jvmArguments)
Specifies the Java VM arguments to use for this operation.

`BuildEnvironment` model contains information such as Java or Gradle environment. If you want to get hold of this information you can ask tooling API to build this model.

If not configured, null, or an empty list is passed, then the reasonable default will be used.

Specified by:
  `setJvmArguments` in interface `LongRunningOperation`
Parameters:
  `jvmArguments` - to use for the Gradle process
Returns:
  this
Since:
  2.6

### setEnvironmentVariables

@Incubating T setEnvironmentVariables(Map<String,String> envVariables)
Specifies the environment variables to use for this operation.

`BuildEnvironment` model contains information such as Java or Gradle environment. If you want to get hold of this information you can ask tooling API to build this model.

If not configured or null is passed, then the reasonable default will be used.

Specified by:
  `setEnvironmentVariables` in interface `LongRunningOperation`
Parameters:
  `envVariables` - environment variables
Returns:
  this
Since:
  3.5

### addProgressListener

T addProgressListener(ProgressListener listener)
Adds a progress listener which will receive progress events as the operation runs.

This method is intended to be replaced by `LongRunningOperation.addProgressListener(org.gradle.tooling.events.ProgressListener)`. The new progress listener type provides much richer information and much better handling of parallel operations that run during the build, such as tasks that run in parallel. You should prefer using the new listener interface where possible. Note, however, that the new interface is supported only for Gradle 2.5 and later and is currently `Incubating`. It may change in later Gradle releases.

Specified by:
  `addProgressListener` in interface `LongRunningOperation`
Parameters:
  `listener` - The listener
Returns:
  this
Since:
  1.0-milestone-3

### addProgressListener

@Incubating T addProgressListener(ProgressListener listener)
Adds a progress listener which will receive progress events of all types as the operation runs.

This method is intended to replace `LongRunningOperation.addProgressListener(ProgressListener)`. You should prefer using the new progress listener method where possible, as the new interface provides much richer information and much better handling of parallel operations that run during the build.

Supported by Gradle 2.5 or later. Gradle 2.4 supports `OperationType.TEST` operations only. Ignored for older versions.

Specified by:
  `addProgressListener` in interface `LongRunningOperation`
Parameters:
  `listener` - The listener
Returns:
  this
Since:
  2.5

### addProgressListener

@Incubating T addProgressListener(ProgressListener listener, Set<OperationType> eventTypes)
Adds a progress listener which will receive progress events as the operations of the requested type run.

This method is intended to replace `LongRunningOperation.addProgressListener(ProgressListener)`. You should prefer using the new progress listener method where possible, as the new interface provides much richer information and much better handling of parallel operations that run during the build.

Supported by Gradle 2.5 or later. Gradle 2.4 supports `OperationType.TEST` operations only. Ignored for older versions.

Specified by:
  `addProgressListener` in interface `LongRunningOperation`
Parameters:
  `listener` - The listener
  `eventTypes` - The types of operations to receive progress events for.
Returns:
  this
Since:
  2.5

### addProgressListener

@Incubating T addProgressListener(ProgressListener listener, OperationType... operationTypes)
Adds a progress listener which will receive progress events as the operations of the requested type run.

This method is intended to replace `LongRunningOperation.addProgressListener(ProgressListener)`. You should prefer using the new progress listener method where possible, as the new interface provides much richer information and much better handling of parallel operations that run during the build.

Supported by Gradle 2.5 or later. Gradle 2.4 supports `OperationType.TEST` operations only. Ignored for older versions.

Specified by:
  `addProgressListener` in interface `LongRunningOperation`
Parameters:
  `listener` - The listener
  `operationTypes` - The types of operations to receive progress events for.
Returns:
  this
Since:
  2.6

### withCancellationToken

@Incubating T withCancellationToken(CancellationToken cancellationToken)
Sets the cancellation token to use to cancel the operation if required.

Supported by Gradle 2.1 or later. Ignored for older versions.

Specified by:
  `withCancellationToken` in interface `LongRunningOperation`
Since:
  2.3