Class DefaultModelBuilder<T>
- java.lang.Object
-
- org.gradle.tooling.internal.consumer.AbstractLongRunningOperation<DefaultModelBuilder<T>>
-
- org.gradle.tooling.internal.consumer.DefaultModelBuilder<T>
-
- All Implemented Interfaces:
ConfigurableLauncher<ModelBuilder<T>>
,LongRunningOperation
,ModelBuilder<T>
public class DefaultModelBuilder<T> extends AbstractLongRunningOperation<DefaultModelBuilder<T>> implements ModelBuilder<T>
-
-
Field Summary
-
Fields inherited from class org.gradle.tooling.internal.consumer.AbstractLongRunningOperation
connectionParameters, operationParamsBuilder
-
-
Constructor Summary
Constructors Constructor Description DefaultModelBuilder(java.lang.Class<T> modelType, AsyncConsumerActionExecutor connection, ConnectionParameters parameters)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ModelBuilder<T>
forTasks(java.lang.Iterable<java.lang.String> tasks)
Specifies the tasks to execute before building the model.DefaultModelBuilder<T>
forTasks(java.lang.String... tasks)
Specifies the tasks to execute before building the model.T
get()
Fetch the model, blocking until it is available.void
get(ResultHandler<? super T> handler)
Starts fetching the model, passing the result to the given handler when complete.protected DefaultModelBuilder<T>
getThis()
-
Methods inherited from class org.gradle.tooling.internal.consumer.AbstractLongRunningOperation
addArguments, addArguments, addJvmArguments, addJvmArguments, addProgressListener, addProgressListener, addProgressListener, addProgressListener, copyFrom, getConsumerOperationParameters, rationalizeInput, rationalizeInput, setColorOutput, setEnvironmentVariables, setJavaHome, setJvmArguments, setJvmArguments, setStandardError, setStandardInput, setStandardOutput, withArguments, withArguments, withCancellationToken, withInjectedClassPath
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.gradle.tooling.ConfigurableLauncher
addArguments, addArguments, addJvmArguments, addJvmArguments, addProgressListener, addProgressListener, addProgressListener, addProgressListener, setColorOutput, setEnvironmentVariables, setJavaHome, setJvmArguments, setJvmArguments, setStandardError, setStandardInput, setStandardOutput, withArguments, withArguments, withCancellationToken
-
-
-
-
Constructor Detail
-
DefaultModelBuilder
public DefaultModelBuilder(java.lang.Class<T> modelType, AsyncConsumerActionExecutor connection, ConnectionParameters parameters)
-
-
Method Detail
-
getThis
protected DefaultModelBuilder<T> getThis()
- Specified by:
getThis
in classAbstractLongRunningOperation<DefaultModelBuilder<T>>
-
get
public T get() throws GradleConnectionException
Description copied from interface:ModelBuilder
Fetch the model, blocking until it is available.- Specified by:
get
in interfaceModelBuilder<T>
- Returns:
- The model.
- Throws:
UnsupportedVersionException
- When the target Gradle version does not support building models.UnknownModelException
- When the target Gradle version or build does not support the requested model.UnsupportedOperationConfigurationException
- When the target Gradle version does not support some requested configuration option such asConfigurableLauncher.withArguments(String...)
.UnsupportedBuildArgumentException
- When there is a problem with build arguments provided byConfigurableLauncher.withArguments(String...)
.BuildException
- On some failure executing the Gradle build.BuildCancelledException
- When the operation was cancelled before it completed successfully.GradleConnectionException
- On some other failure using the connection.
-
get
public void get(ResultHandler<? super T> handler) throws java.lang.IllegalStateException
Description copied from interface:ModelBuilder
Starts fetching the model, passing the result to the given handler when complete. This method returns immediately, and the result is later passed to the given handler'sResultHandler.onComplete(Object)
method.If the operation fails, the handler's
ResultHandler.onFailure(GradleConnectionException)
method is called with the appropriate exception. SeeModelBuilder.get()
for a description of the various exceptions that the operation may fail with.- Specified by:
get
in interfaceModelBuilder<T>
- Parameters:
handler
- The handler to supply the result to.- Throws:
java.lang.IllegalStateException
- When the connection has been closed or is closing.
-
forTasks
public DefaultModelBuilder<T> forTasks(java.lang.String... tasks)
Description copied from interface:ModelBuilder
Specifies the tasks to execute before building the model.
If not configured, null, or an empty array is passed, then no tasks will be executed.
If the target Gradle version is >=6.8 then you can execute tasks from included builds. You can target tasks from included builds by specifying the task identity path (i.e.
':included-build-name:subproject-name:taskName'
).- Specified by:
forTasks
in interfaceModelBuilder<T>
- 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
public ModelBuilder<T> forTasks(java.lang.Iterable<java.lang.String> tasks)
Description copied from interface:ModelBuilder
Specifies the tasks to execute before building the model.
If not configured, null, or an empty array is passed, then no tasks will be executed.
If the target Gradle version is >=6.8 then you can execute tasks from included builds. You can target tasks from included builds by specifying the task identity path (i.e.
':included-build-name:subproject-name:taskName'
).- Specified by:
forTasks
in interfaceModelBuilder<T>
- 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
-
-