Here is a snippet for going through each Configuration
and getting the ProjectDependency
types from them. It uses Gradle.projectsEvaluated(org.gradle.api.Action)
which executes after all the projects are evaluated. It doesn't do anything to figure out transitives or keep a notion of who depends on who, but this can hopefully give you a starting point for how you might achieve what you are looking for.
gradle.projectsEvaluated {
println('Projects loaded')
println('*' * 15)
allprojects.forEach { proj ->
final List<ProjectDependency> projectDependencies = proj.configurations.collectMany { Configuration configuration ->
configuration.allDependencies
}.findAll { Dependency dependency ->
dependency instanceof ProjectDependency
}.collect {
it as ProjectDependency
}.unique().collect()
println("Project ${proj.name}")
println(projectDependencies.collect { " ${it.name} -> ${it.dependencyProject.path}" }.join(System.lineSeparator()))
println()
}
}
I tried it out on the junit-team/junit5 repository and got the following output:
Projects loaded
***************
Project junit5
Project documentation
junit-jupiter-api -> :junit-jupiter-api
junit-jupiter-params -> :junit-jupiter-params
junit-platform-runner -> :junit-platform-runner
junit-platform-launcher -> :junit-platform-launcher
junit-platform-console -> :junit-platform-console
junit-vintage-engine -> :junit-vintage-engine
junit-jupiter-engine -> :junit-jupiter-engine
Project junit-jupiter-api
junit-platform-commons -> :junit-platform-commons
Project junit-jupiter-engine
junit-platform-engine -> :junit-platform-engine
junit-jupiter-api -> :junit-jupiter-api
junit-platform-launcher -> :junit-platform-launcher
junit-platform-runner -> :junit-platform-runner
junit-platform-engine -> :junit-platform-engine
junit-platform-console -> :junit-platform-console
Project junit-jupiter-migrationsupport
junit-jupiter-api -> :junit-jupiter-api
junit-jupiter-engine -> :junit-jupiter-engine
junit-platform-launcher -> :junit-platform-launcher
junit-platform-runner -> :junit-platform-runner
junit-platform-engine -> :junit-platform-engine
junit-platform-console -> :junit-platform-console
Project junit-jupiter-params
junit-jupiter-api -> :junit-jupiter-api
junit-platform-engine -> :junit-platform-engine
junit-jupiter-engine -> :junit-jupiter-engine
junit-platform-launcher -> :junit-platform-launcher
junit-platform-runner -> :junit-platform-runner
junit-platform-console -> :junit-platform-console
Project junit-platform-commons
Project junit-platform-console
junit-platform-launcher -> :junit-platform-launcher
Project junit-platform-console-standalone
junit-platform-console -> :junit-platform-console
junit-jupiter-engine -> :junit-jupiter-engine
junit-jupiter-params -> :junit-jupiter-params
junit-vintage-engine -> :junit-vintage-engine
junit-jupiter-api -> :junit-jupiter-api
junit-jupiter-params -> :junit-jupiter-params
Project junit-platform-engine
junit-platform-commons -> :junit-platform-commons
Project junit-platform-gradle-plugin
junit-platform-console -> :junit-platform-console
junit-platform-launcher -> :junit-platform-launcher
junit-jupiter-api -> :junit-jupiter-api
junit-platform-console -> :junit-platform-console
junit-jupiter-engine -> :junit-jupiter-engine
Project junit-platform-launcher
junit-platform-engine -> :junit-platform-engine
Project junit-platform-runner
junit-platform-launcher -> :junit-platform-launcher
junit-platform-suite-api -> :junit-platform-suite-api
Project junit-platform-suite-api
junit-platform-commons -> :junit-platform-commons
Project junit-platform-surefire-provider
junit-platform-launcher -> :junit-platform-launcher
junit-jupiter-api -> :junit-jupiter-api
junit-platform-runner -> :junit-platform-runner
junit-jupiter-engine -> :junit-jupiter-engine
junit-platform-console -> :junit-platform-console
Project junit-vintage-engine
junit-platform-engine -> :junit-platform-engine
junit-platform-launcher -> :junit-platform-launcher
junit-jupiter-api -> :junit-jupiter-api
junit-platform-runner -> :junit-platform-runner
junit-platform-engine -> :junit-platform-engine
junit-platform-console -> :junit-platform-console
junit-jupiter-engine -> :junit-jupiter-engine
Project platform-tests
junit-platform-commons -> :junit-platform-commons
junit-platform-console -> :junit-platform-console
junit-platform-engine -> :junit-platform-engine
junit-platform-launcher -> :junit-platform-launcher
junit-jupiter-api -> :junit-jupiter-api
junit-jupiter-params -> :junit-jupiter-params
junit-platform-runner -> :junit-platform-runner
junit-platform-engine -> :junit-platform-engine
junit-jupiter-engine -> :junit-jupiter-engine
junit-vintage-engine -> :junit-vintage-engine
junit-jupiter-migrationsupport -> :junit-jupiter-migrationsupport
junit-platform-gradle-plugin -> :junit-platform-gradle-plugin
junit-platform-surefire-provider -> :junit-platform-surefire-provider
A
andB
and projects in multi-module project or multi-module projects themselves? – Ephrayim*.gradle
files? Simple ASCII tree will be sufficient. – Ephrayimsettings.gradle
file? – Ephrayim