|
Groovy Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | METHOD | DETAIL: FIELD | METHOD | |||||||
public interface ProjectConnection
Represents a long-lived connection to a Gradle project. You obtain an instance of a ProjectConnection by using GradleConnector.connect.
ProjectConnection connection = GradleConnector.newConnector()
.forProjectDirectory(new File("someFolder"))
.connect();
try {
//obtain some information from the build
BuildEnvironment environment = connection.model(BuildEnvironment.class)
.get();
//run some tasks
connection.newBuild()
.forTasks("tasks")
.setStandardOutput(System.out)
.run();
} finally {
connection.close();
}
All implementations of ProjectConnection are thread-safe, and may be shared by any number of threads.
All notifications from a given ProjectConnection instance are delivered by a single thread at a time. Note, however, that the delivery thread may change over time.
| Method Summary | |
|---|---|
void
|
close()
Closes this connection. |
Object
|
getModel(Class viewType)
Fetches a snapshot of the model of the given type for this project. |
void
|
getModel(Class viewType, ResultHandler handler)
Fetches a snapshot of the model for this project asynchronously. |
ModelBuilder
|
model(Class modelType)
Creates a builder which can be used to build the model of the given type. |
BuildLauncher
|
newBuild()
Creates a launcher which can be used to execute a build. |
| Method Detail |
|---|
public void close()
public Object getModel(Class viewType)
This method blocks until the model is available.
viewType - The model type. - The model type.
public void getModel(Class viewType, ResultHandler handler)
viewType - The model type.handler - The handler to pass the result to. - The model type.
public ModelBuilder model(Class modelType)
modelType - The model type - The model type.
public BuildLauncher newBuild()
Gradle API 1.5