Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Gradle: multi-project dependency graph (supports depth > 2)
// Inspired by
// Task creates a .dot file with all inter-module dependencies
// Supports any depth of nested modules
task moduleDependencyReport {
doLast {
def file = new File("")
file << "digraph {\n"
file << "splines=ortho\n"
printDeps(file, rootProject)
file << "}\n"
// recursively print dependencies to file and move on to child projects
def printDeps(file, project) {
.matching { it in ProjectDependency }
.each { to -> file << ("\"${}\" -> \"${}\"\n")}
project.childProjects.each { child -> printDeps(file, child.value) }
Copy link

nikialeksey commented Jun 28, 2018

Thanks, but it is not working with new Android projects on gradle 4.4. If you need new android projects support try this one:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment