Graphfity creates a dependency nodes diagram graph about your internal modules dependencies, specially useful if you are developing a multi-module application
View Demo
Β·
Report Bug
Β·
Request Feature
As a software engineer, you should know how difficult is to maintain a project without a previous initial good architecture. The project scales, new libraries, new features, new dependencies between the internal modules are added...
The purpose of this plugin is help to visualize all the project dependencies between the internal modules, as the projects grows, having of this way a main screenshot of all the features, libraries, core modules, components, or whatever kind of module you want to analise in your project.
- Graphviz Graph visualization software
- Kotlin-DSL An alternative to the traditional Groovy DSL using a modern language as Kotlin
- Kotlin The natural Java evolution, a modern, concise and save programming language
Graphviz setup full guide: https://graphviz.org/download/
sudo port install graphviz
brew install graphviz
winget install graphviz
choco install graphviz
sudo apt install graphviz
sudo yum install graphviz
sudo apt install graphviz
Groovy DSL
root build.gradle
// Using the plugins DSL
plugins {
id "com.github.ivancarras.graphfity" version "1.1.0"
}
// Using legacy plugin application
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.github.ivancarras:graphfity-plugin:1.1.0"
}
}
apply plugin: com.github.ivancarras.graphfity.plugin.main.GraphfityPlugin
Kotlin DSL
root build.gradle.kts
// Using the plugins DSL
plugins {
id("com.github.ivancarras.graphfity") version "1.1.0"
}
// Using legacy plugin application
buildscript {
repositories {
maven {
url = uri("https://plugins.gradle.org/m2/")
}
}
dependencies {
classpath("com.github.ivancarras:graphfity-plugin:1.1.0")
}
}
apply(plugin = "com.github.ivancarras.graphfity")
The plugin admits 3 configuration properties:
- nodeTypesPath (mandatory): this is the path for your json node types configuration file (explanation below)
- projectRootName (optional): start point from the task draws the dependencies, the default value is the ":app" module
- graphImagePath (optional): path where your graph image will be placed
This is the file used to establish the different nodeTypes of your project a perfect example could be a project divided into:
- App
- Features
- Components
- Libraries
- Core
nodeTypes.json
[
{
"name": "App",
"regex": "^:app$",
"isEnabled": true,
"shape": "box3d",
"fillColor": "#BAFFC9"
},
{
"name": "Feature",
"regex": "^.*feature.*$",
"isEnabled": true,
"shape": "tab",
"fillColor": "#E6F98A"
},
{
"name": "Component",
"regex": "^.*component.*$",
"isEnabled": true ,
"shape": "component",
"fillColor": "#8AD8F9"
},
{
"name": "Libraries",
"regex": "^.*libraries.*$",
"isEnabled": true,
"shape": "cylinder",
"fillColor": "#FFACFA"
},
{
"name": "Core",
"regex": "^.*core.*$",
"isEnabled": true,
"shape": "hexagon",
"fillColor": "#D5625A"
}
]
Node explanation
{
"name": "App", //Node name
"regex": "^:app$", //This regex corresponds to the modules which will be draw as this node type
"isEnabled": true, //Enable o disable the visualization of this node
"shape": "box3d", // Graphviz node shape you can choose another one using: https://graphviz.org/doc/info/shapes.html
"fillColor": "#BAFFC9"//Hexadecimal color for these nodes
}
Copy this initial configuration file in an accessible path in your project. (the root path is perfect)
Now is time to configure the plugin:
Groovy DSL
root build.gradle.kts
graphfityExtension {
nodeTypesPath = "<nodesTypes.json>" //(mandatory) Examples: graphfityConfig/nodesTypes.json establish the route to your nodeTypes.json
projectRootName = "<projectNameToAnalise>" //(optional) Examples: ":app", ":feature:wishlist"... is up to you
graphImagePath = "<graphsFolder>" //(optional)the folder where will be placed your graph.png image
}
Kotlin DSL
root build.gradle.kts
configure<GraphfityPluginExtension> {
nodeTypesPath.set("<nodesTypes.json>") //(mandatory) Examples: graphfityConfig/nodesTypes.json establish the route to your nodeTypes.json
projectRootName.set("<projectNameToAnalise>") //(optional) Examples: ":app", ":feature:wishlist"... is up to you
graphImagePath.set("<graphsFolder>") //(optional)the folder where will be placed your graph.png image
}
When your configuration is done now you can execute:
./gradlew graphfity
gradle graphfity
The graph is going to be generated in the respective graphImagePath defined in the configuration
See the open issues for a list of proposed features (and known issues)
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the Apache License. See LICENSE
for more information.