Giter Site home page Giter Site logo

ivancarras / graphfity Goto Github PK

View Code? Open in Web Editor NEW
35.0 2.0 2.0 161 KB

Graphfity is a Gradle Plugin which creates a dependency node diagram graph about your internal modules dependencies, specially useful if you are developing a multi-module application

License: Apache License 2.0

Kotlin 100.00%
android kotlin kotlindsl groovy gradle-plugin androidstudio graph graphviz architecture multimodule-android-app

graphfity's Introduction


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



Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact

About The Project

product-image

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.

Built With

  • 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

Getting Started

Prerequisites

Graphviz setup full guide: https://graphviz.org/download/

Mac ๐Ÿ

Option #1
sudo port install graphviz
Option #2
brew install graphviz

Windows

Option #1
winget install graphviz
Option #2
choco install graphviz

Linux ๐Ÿง

Option #1
sudo apt install graphviz
Option #2
sudo yum install graphviz
Option #3
sudo apt install graphviz

Installation

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

Plugin configuration

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

NodeTypes.json

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
}

Usage

When your configuration is done now you can execute:

Mac ๐Ÿ & Linux ๐Ÿง

./gradlew graphfity

Windows ๐ŸชŸ

gradle graphfity

The graph is going to be generated in the respective graphImagePath defined in the configuration

Roadmap

See the open issues for a list of proposed features (and known issues)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the Apache License. See LICENSE for more information.

Contact

LinkedIn

[email protected]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.