Gradle Plugin to list project dependents of a project in multi-projects.
Using the https://docs.gradle.org/current/userguide/plugins.html#sec:plugins_block:
plugins {
id("io.github.bjoernmayer.gradle-project-dependents") version "<version>"
}
Using legacy plugin application:
buildscript {
repositories {
maven {
url = uri("https://plugins.gradle.org/m2/")
}
}
dependencies {
classpath("io.github.bjoernmayer:plugin:<version>")
}
}
apply(plugin = "io.github.bjoernmayer.gradle-project-dependents")
Displays a tree of dependent projects on the project, where the task was executed in.
Imagine a multi-project with Project A, Project B, Project C
Project B build.gradle.kts
:
dependencies {
implementation(project(":projectA"))
}
Project C build.gradle.kts
:
dependencies {
implementation(project(":projectA"))
implementation(project(":projectC"))
}
Executing the task:
./gradlew :projectA:dependents
Expected output:
+--- project root-project-name:projectA
| +--- project root-project-name:projectB (implementation)
| | \--- project root-project-name:projectC (implementation)
| \--- project root-project-name:projectC (implementation)
Configurations can be excluded from the printed graph by adding them to excludedConfigurations
:
// build.gradle.kts
projectDependents {
excludedConfigurations.add("testImplementation")
}
Default is set to true
.
Setting this to false
disables the usual graph of dependents.
// build.gradle.kts
projectDependents {
generateStdOutGraph = false
}
Default is set to false
.
Setting this will generate a graph.yaml
in build/projectDependents/
.
It is a yaml representation of the graph.
// build.gradle.kts
projectDependents {
generateYamlGraph = true
}
Checkout this repository next to some project, where you want to use it.
Then in the settings.gradle.kts
of said project, add this:
// settings.gradle.kts
pluginManagement {
includeBuild("../gradle-project-dependents")
}
Then, you can just apply the plugin like usual:
// build.gradle.kts
id("io.github.bjoernmayer.gradle-project-dependents")