This project demonstrates the use of a custom model for querying project details with the tooling API.
This project consists of three components:
- A multi-project build that provides the custom model via a plugin. The project defines two subprojects:
modelandplugin.modelrepresents the custom model representation.pluginimplements a Gradle plugin that registers the custom model with the tooling API model registry and populates it. - The subdirectory
invocationprovides a build script that uses the tooling API to query information from a project. - A sample
build.gradlefile in the subdirectoryinvocation/samplethat is used to query the information.
From the root project you can build and publish the plugin by running the command ./gradlew build publish. The command will build all subprojects, assemble their artifacts and publish them to a Maven-based repository in the directory repo.
As the next step we can execute the build that uses the custom model registered by the plugin with the tooling API.
Navigate to the subdirectory invocation and execute the command ../gradlew run.
Executing the command will run a build for the build.gradle file in the directory named sample on the root level of the repository.
If successfully executed, you'll see JAVA PLUGIN IS FOUND print out in console.