Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force the dpi value to 100 #159

Merged
merged 1 commit into from
Jun 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.vanniktech.dependency.graph.generator

import com.vanniktech.dependency.graph.generator.DependencyGraphGeneratorExtension.Generator
import guru.nidi.graphviz.attribute.GraphAttr
import guru.nidi.graphviz.attribute.Label
import guru.nidi.graphviz.attribute.Rank
import guru.nidi.graphviz.attribute.Rank.RankType
Expand All @@ -25,8 +26,7 @@ internal class DependencyGraphGenerator(
private val nodes = mutableMapOf<String, MutableNode>()

@Suppress("Detekt.SpreadOperator") fun generateGraph(): MutableGraph {
val graph = mutGraph("G").setDirected(true)

val graph = mutGraph("G").setDirected(true).graphAttrs().add(GraphAttr.dpi(100))
generator.label?.let {
graph.graphAttrs().add(it)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.vanniktech.dependency.graph.generator

import guru.nidi.graphviz.attribute.Color
import guru.nidi.graphviz.attribute.Font
import guru.nidi.graphviz.attribute.GraphAttr
import guru.nidi.graphviz.attribute.Label
import guru.nidi.graphviz.attribute.Rank
import guru.nidi.graphviz.attribute.Rank.RankType
Expand Down Expand Up @@ -39,7 +40,7 @@ internal class ProjectDependencyGraphGenerator(
}
project.allprojects.filter { it.isDependingOnOtherProject() }.forEach { addProject(it) }

val graph = mutGraph().setDirected(true)
val graph = mutGraph().setDirected(true).graphAttrs().add(GraphAttr.dpi(100))
graph.graphAttrs().add(Label.of(project.name).locate(Label.Location.TOP), Font.size(DEFAULT_FONT_SIZE))
graph.nodeAttrs().add(Style.FILLED)
projects.forEach { addNode(it, dependencies, graph) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class DependencyGraphGeneratorPluginTest {
"""
digraph "G" {
edge ["dir"="forward"]
graph ["dpi"="100"]
"${testProjectDir.root.name}" ["label"="${testProjectDir.root.name}","shape"="rectangle"]
"orgjetbrainskotlinkotlinstdlib" ["label"="kotlin-stdlib","shape"="rectangle"]
"orgjetbrainsannotations" ["label"="jetbrains-annotations","shape"="rectangle"]
Expand Down Expand Up @@ -143,7 +144,7 @@ class DependencyGraphGeneratorPluginTest {
"""
digraph {
edge ["dir"="forward"]
graph ["label"="${testProjectDir.root.name}","labelloc"="t","fontsize"="35"]
graph ["dpi"="100","label"="${testProjectDir.root.name}","labelloc"="t","fontsize"="35"]
node ["style"="filled"]
{
edge ["dir"="none"]
Expand Down Expand Up @@ -284,6 +285,7 @@ class DependencyGraphGeneratorPluginTest {
"""
digraph "G" {
edge ["dir"="forward"]
graph ["dpi"="100"]
"$app" ["label"="app","shape"="rectangle"]
"$lib1" ["label"="lib1","shape"="rectangle"]
"$lib" ["label"="lib","shape"="rectangle"]
Expand Down Expand Up @@ -318,7 +320,7 @@ class DependencyGraphGeneratorPluginTest {
fun projectDependencyGraph(label: String) = """
digraph {
edge ["dir"="forward"]
graph ["label"="$label","labelloc"="t","fontsize"="35"]
graph ["dpi"="100","label"="$label","labelloc"="t","fontsize"="35"]
node ["style"="filled"]
":app" ["shape"="rectangle","fillcolor"="#ff8a65"]
":lib1" ["fillcolor"="#ff8a65"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class DependencyGraphGeneratorTest {
"""
digraph "G" {
edge ["dir"="forward"]
graph ["dpi"="100"]
"singleempty" ["label"="singleempty","shape"="rectangle"]
{
edge ["dir"="none"]
Expand All @@ -96,6 +97,7 @@ class DependencyGraphGeneratorTest {
assertEquals(
"""
digraph "G" {
graph ["dpi"="100"]
}
""".trimIndent(),
DependencyGraphGenerator(singleEmpty, ALL.copy(includeProject = { false })).generateGraph().toString()
Expand All @@ -107,6 +109,7 @@ class DependencyGraphGeneratorTest {
"""
digraph "G" {
edge ["dir"="forward"]
graph ["dpi"="100"]
"singleempty" ["label"="singleempty","shape"="rectangle"]
{
edge ["dir"="none"]
Expand All @@ -123,6 +126,7 @@ class DependencyGraphGeneratorTest {
assertEquals(
"""
graph "G" {
graph ["dpi"="100"]
"singleempty" ["label"="singleempty","shape"="rectangle"]
{
graph ["rank"="same"]
Expand All @@ -139,7 +143,7 @@ class DependencyGraphGeneratorTest {
"""
digraph "G" {
edge ["dir"="forward"]
graph ["label"="my custom header","labeljust"="l","labelloc"="t"]
graph ["dpi"="100","label"="my custom header","labeljust"="l","labelloc"="t"]
"singleempty" ["label"="singleempty","shape"="rectangle"]
{
edge ["dir"="none"]
Expand All @@ -157,6 +161,7 @@ class DependencyGraphGeneratorTest {
"""
digraph "G" {
edge ["dir"="forward"]
graph ["dpi"="100"]
"singleempty" ["label"="singleempty","shape"="egg","style"="dotted","color"="#ff0099"]
{
edge ["dir"="none"]
Expand All @@ -174,6 +179,7 @@ class DependencyGraphGeneratorTest {
"""
digraph "G" {
edge ["dir"="forward"]
graph ["dpi"="100"]
"single" ["label"="single","shape"="rectangle"]
"orgjetbrainskotlinkotlinstdlib" ["label"="kotlin-stdlib","shape"="rectangle"]
"orgjetbrainsannotations" ["label"="jetbrains-annotations","shape"="rectangle"]
Expand Down Expand Up @@ -207,6 +213,7 @@ class DependencyGraphGeneratorTest {
"""
digraph "G" {
edge ["dir"="forward"]
graph ["dpi"="100"]
"single" ["label"="single","shape"="rectangle"]
"orgjetbrainskotlinkotlinstdlib" ["label"="kotlin-stdlib","shape"="rectangle","style"="filled","color"="0.833904937402929 0.4047932090555708 0.5440948801677342"]
"orgjetbrainsannotations" ["label"="jetbrains-annotations","shape"="rectangle","style"="filled","color"="0.44658757938141413 0.25639393293458856 0.2315484830185478"]
Expand All @@ -232,6 +239,7 @@ class DependencyGraphGeneratorTest {
"""
digraph "G" {
edge ["dir"="forward"]
graph ["dpi"="100"]
"single" ["label"="single","shape"="rectangle"]
"orgjetbrainskotlinkotlinstdlib" ["label"="kotlin-stdlib","shape"="rectangle"]
"ioreactivexrxjava2rxjava" ["label"="rxjava","shape"="rectangle"]
Expand All @@ -253,6 +261,7 @@ class DependencyGraphGeneratorTest {
"""
digraph "G" {
edge ["dir"="forward"]
graph ["dpi"="100"]
"single" ["label"="single","shape"="rectangle"]
"orgjetbrainskotlinkotlinstdlib" ["label"="kotlin-stdlib","shape"="rectangle"]
"orgjetbrainsannotations" ["label"="jetbrains-annotations","shape"="rectangle"]
Expand All @@ -276,6 +285,7 @@ class DependencyGraphGeneratorTest {
"""
digraph "G" {
edge ["dir"="forward"]
graph ["dpi"="100"]
"singleempty" ["label"="singleempty","shape"="rectangle"]
"orgapachexmlgraphicsbatikgvt" ["label"="batik-gvt","shape"="rectangle"]
"orgapachexmlgraphicsbatikbridge" ["label"="batik-bridge","shape"="rectangle"]
Expand Down Expand Up @@ -374,6 +384,7 @@ class DependencyGraphGeneratorTest {
"""
digraph "G" {
edge ["dir"="forward"]
graph ["dpi"="100"]
"single" ["label"="single","shape"="rectangle"]
"orgjetbrainskotlinkotlinstdlib" ["label"="kotlin-stdlib","shape"="rectangle"]
"orgjetbrainsannotations" ["label"="jetbrains-annotations","shape"="rectangle"]
Expand Down Expand Up @@ -402,6 +413,7 @@ class DependencyGraphGeneratorTest {
"""
digraph "G" {
edge ["dir"="forward"]
graph ["dpi"="100"]
"multimulti1" ["label"="multi1","shape"="rectangle"]
"orgjetbrainskotlinkotlinstdlib" ["label"="kotlin-stdlib","shape"="rectangle"]
"orgjetbrainsannotations" ["label"="jetbrains-annotations","shape"="rectangle"]
Expand Down Expand Up @@ -437,6 +449,7 @@ class DependencyGraphGeneratorTest {
"""
digraph "G" {
edge ["dir"="forward"]
graph ["dpi"="100"]
"android" ["label"="android","shape"="rectangle"]
"androidarchpersistenceroomruntime" ["label"="persistence-room-runtime","shape"="rectangle"]
"androidarchpersistenceroomcommon" ["label"="persistence-room-common","shape"="rectangle"]
Expand Down Expand Up @@ -483,6 +496,7 @@ class DependencyGraphGeneratorTest {
"""
digraph "G" {
edge ["dir"="forward"]
graph ["dpi"="100"]
"android" ["label"="android","shape"="rectangle"]
"comsquareupsqldelightruntime" ["label"="sqldelight-runtime","shape"="rectangle"]
"comandroidsupportsupportannotations" ["label"="support-annotations","shape"="rectangle"]
Expand Down Expand Up @@ -516,6 +530,7 @@ class DependencyGraphGeneratorTest {
"""
digraph "G" {
edge ["dir"="forward"]
graph ["dpi"="100"]
"android" ["label"="android","shape"="rectangle"]
"ioreactivexrxjava2rxandroid" ["label"="rxandroid","shape"="rectangle"]
"ioreactivexrxjava2rxjava" ["label"="rxjava","shape"="rectangle"]
Expand Down Expand Up @@ -554,6 +569,7 @@ class DependencyGraphGeneratorTest {
"""
digraph "G" {
edge ["dir"="forward"]
graph ["dpi"="100"]
"android" ["label"="android","shape"="rectangle"]
"ioreactivexrxjava2rxjava" ["label"="rxjava","shape"="rectangle"]
"orgreactivestreamsreactivestreams" ["label"="reactive-streams","shape"="rectangle"]
Expand Down Expand Up @@ -592,6 +608,7 @@ class DependencyGraphGeneratorTest {
"""
digraph "G" {
edge ["dir"="forward"]
graph ["dpi"="100"]
"android" ["label"="android","shape"="rectangle"]
"orgjetbrainskotlinkotlinstdlib" ["label"="kotlin-stdlib","shape"="rectangle"]
"orgjetbrainsannotations" ["label"="jetbrains-annotations","shape"="rectangle"]
Expand All @@ -617,6 +634,7 @@ class DependencyGraphGeneratorTest {
"""
digraph "G" {
edge ["dir"="forward"]
graph ["dpi"="100"]
"android" ["label"="android","shape"="rectangle"]
{
edge ["dir"="none"]
Expand All @@ -638,6 +656,7 @@ class DependencyGraphGeneratorTest {
"""
digraph "G" {
edge ["dir"="forward"]
graph ["dpi"="100"]
"android" ["label"="android","shape"="rectangle"]
{
edge ["dir"="none"]
Expand All @@ -655,6 +674,7 @@ class DependencyGraphGeneratorTest {
"""
digraph "G" {
edge ["dir"="forward"]
graph ["dpi"="100"]
"rxjava" ["label"="rxjava","shape"="rectangle"]
"ioreactivexrxjava2rxjava" ["label"="rxjava","shape"="rectangle"]
"orgreactivestreamsreactivestreams" ["label"="reactive-streams","shape"="rectangle"]
Expand Down