Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vanniktech/gradle-dependency-graph-generator-plugin
Gradle plugin that generates dependency graphs from your project.
https://github.com/vanniktech/gradle-dependency-graph-generator-plugin
Last synced: 43 minutes ago
JSON representation
Gradle plugin that generates dependency graphs from your project.
- Host: GitHub
- URL: https://github.com/vanniktech/gradle-dependency-graph-generator-plugin
- Owner: vanniktech
- License: apache-2.0
- Created: 2018-03-02T23:26:09.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-10-13T13:10:55.000Z (about 2 months ago)
- Last Synced: 2024-10-29T15:34:32.774Z (about 1 month ago)
- Language: Kotlin
- Homepage: http://vanniktech.com
- Size: 1.05 MB
- Stars: 1,543
- Watchers: 28
- Forks: 99
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/funding.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-kotlin - gradle-dependency-graph-generator-plugin - Gradle plugin that generates dependency graphs from your project. (Libraries)
README
# gradle-dependency-graph-generator-plugin
Gradle plugin that lets you visualize your dependencies in a graph.
# Set up
[Gradle 3.3](https://docs.gradle.org/3.3/release-notes.html) or higher is required.
```gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "com.vanniktech:gradle-dependency-graph-generator-plugin:0.8.0"
}
}apply plugin: "com.vanniktech.dependency.graph.generator"
```Note that this plugin can be applied at the root of the project or at a specific project. Both cases will just work.
### Snapshot
```gradle
buildscript {
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
dependencies {
classpath "com.vanniktech:gradle-dependency-graph-generator-plugin:0.9.0-SNAPSHOT"
}
}apply plugin: "com.vanniktech.dependency.graph.generator"
```## Usage
By default, this plugin provides two reporting tasks:
| `generateDependencyGraph` | `generateProjectDependencyGraph` |
|:--------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------|
| ![Dependency Graph](art/dependency-graph.svg) | ![Project Dependency Graph](art/project-dependency-graph.svg) |
| Generates a **complete** dependency graph in `build/reports/dependency-graph/` | Generates a dependency graph of the **project modules** in `build/reports/project-dependency-graph/` |_Source project: [vanniktech/Emoji](https://github.com/vanniktech/Emoji)_
The graphs are generated in `.png`, `.svg` & `.dot` format.
There are extension points to be able to generate graphs which only include some dependencies and their transitive ones. The trick is to hook a [Generator](./src/main/kotlin/com/vanniktech/dependency/graph/generator/DependencyGraphGeneratorExtension.kt) in over the `dependencyGraphGenerator` extension. Note that this is extremely experimental and will likely change between releases. It's still fun though.
### Generator Example
We only want to show which Jetbrains libraries we're using.
```groovy
import com.vanniktech.dependency.graph.generator.DependencyGraphGeneratorPlugin
import guru.nidi.graphviz.attribute.Color
import guru.nidi.graphviz.attribute.Styleplugins.apply(DependencyGraphGeneratorPlugin)
dependencyGraphGenerator {
generators {
jetbrainsLibraries {
include = { dependency -> dependency.getModuleGroup().startsWith("org.jetbrains") } // Only want Jetbrains.
children = { true } // Include transitive dependencies.
dependencyNode = { node, dependency -> node.add(Style.FILLED, Color.rgb("#AF1DF5")) } // Give them some color.
}
}
}
```The same can be done using Kotlin
```kotlin
import com.vanniktech.dependency.graph.generator.DependencyGraphGeneratorExtension
import com.vanniktech.dependency.graph.generator.DependencyGraphGeneratorPlugin
import guru.nidi.graphviz.attribute.Color
import guru.nidi.graphviz.attribute.Styleplugins.apply(DependencyGraphGeneratorPlugin::class.java)
configure {
generators.create("jetbrainsLibraries") {
include = { dependency -> dependency.moduleGroup.startsWith("org.jetbrains") } // Only want Jetbrains.
children = { true } // Include transitive dependencies.
dependencyNode = { node, dependency -> node.add(Style.FILLED, Color.rgb("#AF1DF5")) } // Give them some color.
}
}
```This will generate a new task `generateDependencyGraphJetbrainsLibraries` which when run will yield this graph:
![Example Jetbrains graph](art/dependency-graph-jetbrains-libraries.svg)
# License
Copyright (C) 2018 Vanniktech - Niklas Baudy
Licensed under the Apache License, Version 2.0