|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | METHOD | DETAIL: FIELD | METHOD |
public interface LongRunningOperation
Offers ways to communicate both ways with a Gradle operation, be it building a model or running tasks.
Enables tracking progress via listeners that will receive events from the Gradle operation.
Allows providing standard output streams that will receive output if the Gradle operation writes to standard streams.
Allows providing standard input that can be consumed by the gradle operation (useful for interactive builds).
Enables configuring the build run / model request with options like the Java home or JVM arguments. Those settings might not be supported by the target Gradle version. Refer to Javadoc for those methods to understand what kind of exception throw and when is it thrown.
Method Summary | |
---|---|
LongRunningOperation
|
addProgressListener(ProgressListener listener)
Adds a progress listener which will receive progress events as the operation runs. |
LongRunningOperation
|
setJavaHome(File javaHome)
Specifies the Java home directory to use for this operation. |
LongRunningOperation
|
setJvmArguments(String... jvmArguments)
Specifies the Java VM arguments to use for this operation. |
LongRunningOperation
|
setStandardError(OutputStream outputStream)
Sets the OutputStream which should receive standard error logging generated while running the operation. |
LongRunningOperation
|
setStandardInput(InputStream inputStream)
Sets the InputStream that will be used as standard input for this operation. |
LongRunningOperation
|
setStandardOutput(OutputStream outputStream)
Sets the OutputStream which should receive standard output logging generated while running the operation. |
LongRunningOperation
|
withArguments(String... arguments)
Specify the command line build arguments. |
Method Detail |
---|
public LongRunningOperation addProgressListener(ProgressListener listener)
listener
- The listener
public LongRunningOperation setJavaHome(File javaHome)
If the target Gradle version does not support it the long running operation will fail eagerly with UnsupportedOperationConfigurationException when the operation is started.
BuildEnvironment model contains information such as Java or Gradle environment. If you want to get hold of this information you can ask tooling API to build this model.
If not configured or null passed the sensible default will be used.
javaHome
- to use for the Gradle process
public LongRunningOperation setJvmArguments(String... jvmArguments)
If the target Gradle version does not support it the long running operation will fail eagerly with UnsupportedOperationConfigurationException when the operation is started.
BuildEnvironment model contains information such as Java or Gradle environment. If you want to get hold of this information you can ask tooling API to build this model.
If not configured, null an empty array passed then the reasonable default will be used.
jvmArguments
- to use for the Gradle process
public LongRunningOperation setStandardError(OutputStream outputStream)
outputStream
- The output stream. The system default character encoding will be used to encode characters written to this stream.
public LongRunningOperation setStandardInput(InputStream inputStream)
If the target Gradle version does not support it the long running operation will fail with UnsupportedOperationConfigurationException when the operation is started.
inputStream
- The input stream
public LongRunningOperation setStandardOutput(OutputStream outputStream)
outputStream
- The output stream. The system default character encoding will be used to encode characters written to this stream.
public LongRunningOperation withArguments(String... arguments)
Be aware that not all of the Gradle command line options are supported! Only the build arguments that configure the build execution are supported. They are modelled in the Gradle API via StartParameter. Examples of supported build arguments: '--info', '-u', '-p'. The command line instructions that are actually separate commands (like '-?' and '-v') are not supported. Some other instructions like '--daemon' are also not supported - the tooling API always runs with the daemon.
If an unknown or unsupported command line option is specified, UnsupportedBuildArgumentException will be thrown at the time the operation is executed via BuildLauncher#run()#run() or ModelBuilder#get()#get().
For the list of all Gradle command line options please refer to the user guide or take a look at the output of the 'gradle -?' command. Majority of arguments modeled by StartParameter are supported.
The arguments can potentially override some other settings you have configured. For example, the project directory or Gradle user home directory that are configured in the GradleConnector. Also, the task names configured by BuildLauncher.forTasks can be overridden if you happen to specify other tasks via the build arguments.
See the example in the docs for BuildLauncher
arguments
- Gradle command line arguments
Gradle API 1.12