• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

vanniktech/gradle-dependency-graph-generator-plugin: Gradle plugin that generate ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

vanniktech/gradle-dependency-graph-generator-plugin

开源软件地址(OpenSource Url):

https://github.com/vanniktech/gradle-dependency-graph-generator-plugin

开源编程语言(OpenSource Language):

Kotlin 98.4%

开源软件介绍(OpenSource Introduction):

gradle-dependency-graph-generator-plugin

Gradle plugin that lets you visualize your dependencies in a graph.

Set up

Gradle 3.3 or higher is required.

buildscript {
  repositories {
    mavenCentral()
  }
  dependencies {
    classpath "com.vanniktech:gradle-dependency-graph-generator-plugin:0.7.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

buildscript {
  repositories {
    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
  }
  dependencies {
    classpath "com.vanniktech:gradle-dependency-graph-generator-plugin:0.8.0-SNAPSHOT"
  }
}

apply plugin: "com.vanniktech.dependency.graph.generator"

Usage

By default, this plugin provides two reporting tasks:

generateDependencyGraph generateProjectDependencyGraph
Dependency Graph Project Dependency Graph
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

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 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.

import com.vanniktech.dependency.graph.generator.DependencyGraphGeneratorPlugin
import guru.nidi.graphviz.attribute.Color
import guru.nidi.graphviz.attribute.Style

plugins.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
import com.vanniktech.dependency.graph.generator.DependencyGraphGeneratorPlugin
import guru.nidi.graphviz.attribute.Color
import guru.nidi.graphviz.attribute.Style

rootProject.plugins.apply(DependencyGraphGeneratorPlugin::class.java)

rootProject.configure<DependencyGraphGeneratorExtension> {
  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

License

Copyright (C) 2018 Vanniktech - Niklas Baudy

Licensed under the Apache License, Version 2.0




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
michel-kraemer/gradle-download-task: 发布时间:2022-06-11
下一篇:
gradle/oreilly-gradle-book-examples发布时间:2022-06-11
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap