How can I use the tooling api to get internal and external dependencies?

The tooling documentation says that it should be possible to get internal and external dependencies, but I can’t figure out to do that without invoking a task and parsing the output…

“You can query Gradle for the details of a build, including the project hierarchy and the project dependencies, external dependencies (including source and javadoc jars), source directories and tasks of each project.”

At the moment there are several models available that expose various types of information -

Some of them are general and give you a model based on Gradle concepts and others are more tailored to IDEs like IntelliJ or Eclipse. If this is not sufficient for you you can create your own model build and expose the data from Gradle through tooling API with it. There is a sample in Gradle distribution showing how to start such a project.

Oh, that was an amazingly quick reply! Thanks!

So if I want to extract dependencies between projects in the same build I have to dig into either the Eclipse or Idea models? It’s fine if that is the case, it just confused me that this information was not available via GradeProject.

Have a nice summer!

Yes, either one of these models or write your own. You can look at the sources of these two models in the repository. Although not everything is public API what is used to build these models.