Skip to content

Instantly share code, notes, and snippets.

@jkschneider
Created May 31, 2016 22:41
Show Gist options
  • Save jkschneider/abf06df0348f0e8ec58a4a92a0c516f1 to your computer and use it in GitHub Desktop.
Save jkschneider/abf06df0348f0e8ec58a4a92a0c516f1 to your computer and use it in GitHub Desktop.
Gradle First Level Dependency Subgraph Size
task firstLevelSubgraphSize << {
def cardinality = { ResolvedDependency d, Set<ModuleVersionIdentifier> alreadySeen ->
alreadySeen.add(d.module.id) ? d.children.sum(0) { owner.call(it, alreadySeen) } + 1 : 0
}
configurations.compile.resolvedConfiguration.firstLevelModuleDependencies.each {
println it.module.id.toString() + ' -> ' + cardinality(it, [] as Set)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment