api / org.gradle.tooling / ConfigurableLauncher

ConfigurableLauncher

interface ConfigurableLauncher<T : ConfigurableLauncher<ConfigurableLauncher<*>>> : LongRunningOperation

A ConfigurableLauncher allows you to configure a long running operation.

Parameters

- the ConfigurableLauncher implementation to return as part of the fluent API.

Since
2.6

Functions

addProgressListener

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}

setColorOutput

abstract fun setColorOutput(colorOutput: Boolean): T

{@inheritDoc}

setEnvironmentVariables

abstract fun setEnvironmentVariables(envVariables: MutableMap<String, String>): T

{@inheritDoc}

setJavaHome

abstract fun setJavaHome(javaHome: File): T

{@inheritDoc}

setJvmArguments

abstract fun setJvmArguments(vararg jvmArguments: String): T
abstract fun setJvmArguments(jvmArguments: MutableIterable<String>): T

{@inheritDoc}

setStandardError

abstract fun setStandardError(outputStream: OutputStream): T

{@inheritDoc}

setStandardInput

abstract fun setStandardInput(inputStream: InputStream): T

{@inheritDoc}

setStandardOutput

abstract fun setStandardOutput(outputStream: OutputStream): T

{@inheritDoc}

withArguments

abstract fun withArguments(vararg arguments: String): T
abstract fun withArguments(arguments: MutableIterable<String>): T

{@inheritDoc}

withCancellationToken

abstract fun withCancellationToken(cancellationToken: CancellationToken): T

{@inheritDoc}

Inheritors

BuildActionExecuter

interface BuildActionExecuter<T : Any> : ConfigurableLauncher<BuildActionExecuter<T>>

Used to execute a BuildAction in the build process.

BuildLauncher

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:

Example:
 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(); } 

ModelBuilder

interface ModelBuilder<T : Any> : ConfigurableLauncher<ModelBuilder<T>>

A ModelBuilder allows you to fetch a snapshot of some model for a project or a build. Instances of ModelBuilder are not thread-safe.

You use a ModelBuilder as follows:

Example:
 ProjectConnection connection = GradleConnector.newConnector() .forProjectDirectory(new File("someFolder")) .connect(); try { ModelBuilder<GradleProject> builder = connection.model(GradleProject.class); //if you use a different than usual build file name: builder.withArguments("--build-file", "theBuild.gradle"); //configure the standard input in case your build is interactive: builder.setStandardInput(new ByteArrayInputStream("consume this!".getBytes())); //if you want to listen to the progress events: ProgressListener listener = null; // use your implementation builder.addProgressListener(listener); //get the model: GradleProject project = builder.get(); //query the model for information: System.out.println("Available tasks: " + project.getTasks()); } finally { connection.close(); } 

TestLauncher

interface TestLauncher : ConfigurableLauncher<TestLauncher>

A TestLauncher allows you to execute tests in a Gradle build.