Skip to content

Gradle Plugin to list dependents of your project in multi-projects

License

Notifications You must be signed in to change notification settings

bjoernmayer/gradle-project-dependents

Repository files navigation

Gradle Project Dependents Plugin

Gradle Plugin Portal

Gradle Plugin to list project dependents of a project in multi-projects.

Usage

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")

Tasks

dependents

Displays a tree of dependent projects on the project, where the task was executed in.

Example:

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)

Configuration

excludedConfigurations

Configurations can be excluded from the printed graph by adding them to excludedConfigurations:

// build.gradle.kts

projectDependents {
    excludedConfigurations.add("testImplementation")
}

generateStdOutGraph

Default is set to true.

Setting this to false disables the usual graph of dependents.

// build.gradle.kts

projectDependents {
    generateStdOutGraph = false
}

generateYamlGraph

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
}

Developing

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")

About

Gradle Plugin to list dependents of your project in multi-projects

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages