interface BuildLauncher : ConfigurableLauncher<BuildLauncher>
A BuildLauncher
allows you to configure and execute a Gradle build.
Instances of BuildLauncher
are not thread-safe. You use a BuildLauncher
as follows:
BuildLauncher
by calling org.gradle.tooling.ProjectConnection#newBuild()
. #run()
or #run(ResultHandler)
to execute the build. ProjectConnection connection = GradleConnector.newConnector() .forProjectDirectory(new File("someFolder")) .connect(); try { BuildLauncher build = connection.newBuild(); //select tasks to run: build.forTasks("clean", "test"); //include some build arguments: build.withArguments("-i", "--project-dir", "someProjectDir"); //configure the standard input: build.setStandardInput(new ByteArrayInputStream("consume this!".getBytes())); //in case you want the build to use java different than default: build.setJavaHome(new File("/path/to/java")); //if your build needs crazy amounts of memory: build.setJvmArguments("-Xmx2048m", "-XX:MaxPermSize=512m"); //if you want to listen to the progress events: ProgressListener listener = null; // use your implementation build.addProgressListener(listener); //kick the build off: build.run(); } finally { connection.close(); }
Since
1.0-milestone-3
abstract fun forLaunchables(vararg launchables: Launchable): BuildLauncher abstract fun forLaunchables(launchables: MutableIterable<Launchable>): BuildLauncher
Sets the launchables to execute. If no entries are specified, the project's default tasks are executed. |
|
abstract fun forTasks(vararg tasks: String): BuildLauncher
Sets the tasks to be executed. If no tasks are specified, the project's default tasks are executed. abstract fun forTasks(vararg tasks: Task): BuildLauncher abstract fun forTasks(tasks: MutableIterable<Task>): BuildLauncher
Sets the tasks to be executed. If no tasks are specified, the project's default tasks are executed. Note that the supplied tasks do not necessarily need to belong to the project which this launcher was created for. |
|
abstract fun run(): Unit
Executes the build, blocking until it is complete. abstract fun run(handler: ResultHandler<in Void>): Unit
Launches the build. This method returns immediately, and the result is later passed to the given handler. If the operation fails, the handler's |
abstract fun addProgressListener(listener: ProgressListener): T abstract fun addProgressListener(listener: ProgressListener): T abstract fun addProgressListener(listener: ProgressListener, eventTypes: MutableSet<OperationType>): T abstract fun addProgressListener(listener: ProgressListener, vararg operationTypes: OperationType): T
{@inheritDoc} |
|
abstract fun setColorOutput(colorOutput: Boolean): T
{@inheritDoc} |
|
abstract fun setEnvironmentVariables(envVariables: MutableMap<String, String>): T
{@inheritDoc} |
|
abstract fun setJavaHome(javaHome: File): T
{@inheritDoc} |
|
abstract fun setJvmArguments(vararg jvmArguments: String): T abstract fun setJvmArguments(jvmArguments: MutableIterable<String>): T
{@inheritDoc} |
|
abstract fun setStandardError(outputStream: OutputStream): T
{@inheritDoc} |
|
abstract fun setStandardInput(inputStream: InputStream): T
{@inheritDoc} |
|
abstract fun setStandardOutput(outputStream: OutputStream): T
{@inheritDoc} |
|
abstract fun withArguments(vararg arguments: String): T abstract fun withArguments(arguments: MutableIterable<String>): T
{@inheritDoc} |
|
abstract fun withCancellationToken(cancellationToken: CancellationToken): T
{@inheritDoc} |