This is a really interesting idea.
In a mixed codebase we might want to extend this concept to other languages e.g. Java, or perhaps even other languages that don't use Gradle.
Consider separating the pieces of this so that
- A common output format is specified (maybe such a thing already exists?) so that language-level tooling can be used to generate it
- Separating the tooling that converts the common output format into a separate library/module so that it can be called from contexts other than Gradle