|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | METHOD | DETAIL: FIELD | METHOD |
org.gradle.tooling.BuildLauncher org.gradle.tooling.LongRunningOperation
public interface BuildLauncher extends LongRunningOperation
A BuildLauncher allows you to configure and execute a Gradle build.
Instances of BuildLauncher are not thread-safe. You use a BuildLauncher as follows:
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("--no-search-upward", "-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(); }
Method Summary | |
---|---|
BuildLauncher
|
addProgressListener(ProgressListener listener)
{@inheritDoc} |
BuildLauncher
|
forLaunchables(Launchable... launchables)
Sets the launchables to execute. |
BuildLauncher
|
forLaunchables(Iterable launchables)
Sets the launchables to execute. |
BuildLauncher
|
forTasks(String... tasks)
Sets the tasks to be executed. |
BuildLauncher
|
forTasks(Task... tasks)
Sets the tasks to be executed. |
BuildLauncher
|
forTasks(Iterable tasks)
Sets the tasks to be executed. |
void
|
run()
Executes the build, blocking until it is complete. |
void
|
run(ResultHandler handler)
Launches the build. |
BuildLauncher
|
setJavaHome(File javaHome)
{@inheritDoc} |
BuildLauncher
|
setJvmArguments(String... jvmArguments)
{@inheritDoc} |
BuildLauncher
|
setStandardError(OutputStream outputStream)
{@inheritDoc} |
BuildLauncher
|
setStandardInput(InputStream inputStream)
{@inheritDoc} |
BuildLauncher
|
setStandardOutput(OutputStream outputStream)
{@inheritDoc} |
BuildLauncher
|
withArguments(String... arguments)
{@inheritDoc} |
Methods inherited from interface LongRunningOperation | |
---|---|
addProgressListener, setJavaHome, setJvmArguments, setStandardError, setStandardInput, setStandardOutput, withArguments |
Method Detail |
---|
public BuildLauncher addProgressListener(ProgressListener listener)
@Incubating public BuildLauncher forLaunchables(Launchable... launchables)
launchables
- The launchables for this build.
@Incubating public BuildLauncher forLaunchables(Iterable launchables)
launchables
- The launchables for this build.
public BuildLauncher forTasks(String... tasks)
tasks
- The paths of the tasks to be executed. Relative paths are evaluated relative to the project for which this launcher was created.
public BuildLauncher forTasks(Task... tasks)
Note that the supplied tasks do not necessarily need to belong to the project which this launcher was created for.
tasks
- The tasks to be executed.
public BuildLauncher forTasks(Iterable tasks)
Note that the supplied tasks do not necessarily need to belong to the project which this launcher was created for.
tasks
- The tasks to be executed.
public void run()
public void run(ResultHandler handler)
If the operation fails, the handler's ResultHandler#onFailure(GradleConnectionException)#onFailure(GradleConnectionException) method is called with the appropriate exception. See run() for a description of the various exceptions that the operation may fail with.
handler
- The handler to supply the result to.
public BuildLauncher setJavaHome(File javaHome)
public BuildLauncher setJvmArguments(String... jvmArguments)
public BuildLauncher setStandardError(OutputStream outputStream)
public BuildLauncher setStandardInput(InputStream inputStream)
public BuildLauncher setStandardOutput(OutputStream outputStream)
public BuildLauncher withArguments(String... arguments)
Gradle API 1.12