org.gradle.tooling
Interface BuildLauncher

All Superinterfaces:
LongRunningOperation

public interface BuildLauncher
extends LongRunningOperation

A BuildLauncher allows you to configure and execute a Gradle build.

You use a BuildLauncher as follows:

Instances of BuildLauncher are not thread-safe.


Method Summary
 BuildLauncher addProgressListener(ProgressListener listener)
          Adds a progress listener which will receive progress events as the operation runs.
 BuildLauncher forTasks(Iterable<? extends Task> tasks)
          Sets the tasks to be executed.
 BuildLauncher forTasks(String... tasks)
          Sets the tasks to be executed.
 BuildLauncher forTasks(Task... tasks)
          Sets the tasks to be executed.
 void run()
          Execute the build, blocking until it is complete.
 void run(ResultHandler<? super Void> handler)
          Launchers the build.
 BuildLauncher setStandardError(OutputStream outputStream)
          Sets the OutputStream which should receive standard error logging generated while running the operation.
 BuildLauncher setStandardInput(InputStream inputStream)
          Sets the standard InputStream that will be used by builds.
 BuildLauncher setStandardOutput(OutputStream outputStream)
          Sets the OutputStream which should receive standard output logging generated while running the operation.
 

Method Detail

forTasks

BuildLauncher forTasks(String... tasks)
Sets the tasks to be executed.

Parameters:
tasks - The paths of the tasks to be executed. Relative paths are evaluated relative to the project for which this launcher was created.
Returns:
this

forTasks

BuildLauncher forTasks(Task... tasks)
Sets the tasks to be executed. Note that the supplied tasks do not necessarily belong to the project which this launcher was created for.

Parameters:
tasks - The tasks to be executed.
Returns:
this

forTasks

BuildLauncher forTasks(Iterable<? extends Task> tasks)
Sets the tasks to be executed. Note that the supplied tasks do not necessarily belong to the project which this launcher was created for.

Parameters:
tasks - The tasks to be executed.
Returns:
this

setStandardOutput

BuildLauncher 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.
Returns:
this

setStandardError

BuildLauncher 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.
Returns:
this

setStandardInput

BuildLauncher setStandardInput(InputStream inputStream)
Sets the standard InputStream that will be used by builds. Useful when the tooling api drives interactive builds.

Specified by:
setStandardInput in interface LongRunningOperation
Parameters:
inputStream - The input stream
Returns:
this

addProgressListener

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

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

run

void run()
         throws GradleConnectionException
Execute the build, blocking until it is complete.

Throws:
UnsupportedVersionException - When the target Gradle version does not support the features required for this build.
BuildException - On some failure executing the Gradle build.
GradleConnectionException - On some other failure using the connection.
IllegalStateException - When the connection has been closed or is closing.

run

void run(ResultHandler<? super Void> handler)
         throws IllegalStateException
Launchers the build. This method returns immediately, and the result is later passed to the given handler.

Parameters:
handler - The handler to supply the result to.
Throws:
IllegalStateException - When the connection has been closed or is closing.