org.gradle.tooling
Interface BuildLauncher


public interface BuildLauncher

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 build executes.
 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 that should receive standard error logging from this build.
 BuildLauncher setStandardOutput(OutputStream outputStream)
          Sets the OutputStream that should receive standard output logging from this build.
 

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 that should receive standard output logging from this build. The default is to discard the output.

Parameters:
outputStream - The output stream.
Returns:
this

setStandardError

BuildLauncher setStandardError(OutputStream outputStream)
Sets the OutputStream that should receive standard error logging from this build. The default is to discard the output.

Parameters:
outputStream - The output stream.
Returns:
this

addProgressListener

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

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.