The 1.0 milestone 3 release brought a new API called the tooling API, which you can use for embedding Gradle into your own custom software. This API allows you to execute and monitor builds, and to query Gradle about the details of a build. The main audience for this API will be IDEs, CI servers, other UI authors, or integration testing of your Gradle plugins. However, it is open for anyone who needs to embed Gradle in their application.
A fundamental characteristic of the tooling API is that it operates in a version independent way. This means that you can use the same API to work with different target versions of Gradle. The tooling API is Gradle wrapper aware and, by default, uses the same target Gradle version as that used by the wrapper-powered project.
Some features that the tooling API provides today:
In the future we may support other interesting features:
Please take a look at Chapter 19, The Gradle Daemon. The Tooling API uses the daemon all the time. In fact, you cannot officially use the Tooling API without the daemon. This means that subsequent calls to the Tooling API, be it model building requests or task executing requests can be executed in the same long-living process. Chapter 19, The Gradle Daemon contains more details about the daemon, specifically information on situations when new daemons are forked.
As the tooling API is an interface for developers, the Javadoc is the main documentation for it.
This is exactly our intention - we don't expect this chapter to grow very much.
Instead we will add more code samples and improve the Javadoc documentation.
The main entry point to the tooling API is the
GradleConnector
.
You can navigate from there to find code samples and other instructions.
Another very important set of resources are the samples that live
in “$gradleHome/samples/toolingApi
”. These samples also specify all of the
required dependencies for the Tooling API, along with the suggested repositories to obtain the jars from.