Skip to content

Commit 3b341b6

Browse files
RBusarowkodiakhq[bot]
authored andcommitted
use graphviz-java for dot graph generation
1 parent 248b8db commit 3b341b6

File tree

13 files changed

+3037
-394
lines changed

13 files changed

+3037
-394
lines changed

gradle/libs.versions.toml

+5
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ google-dagger = "2.42"
3333
google-material = "1.4.0"
3434

3535
gradleDoctor = "0.8.1"
36+
graphviz = "0.18.1"
3637
groovy = "3.0.10"
3738
jUnit = "5.8.2"
3839
javaParser = "3.24.2"
@@ -112,6 +113,10 @@ google-dagger-compiler = { module = "com.google.dagger:dagger-compiler", version
112113

113114
google-ksp = { module = "com.google.devtools.ksp:symbol-processing-gradle-plugin", version.ref = "google-ksp" }
114115

116+
graphviz-java = { module = "guru.nidi:graphviz-java", version.ref = "graphviz" }
117+
graphviz-java-min = { module = "guru.nidi:graphviz-java-min-deps", version.ref = "graphviz" }
118+
graphviz-kotlin = { module = "guru.nidi:graphviz-kotlin", version.ref = "graphviz" }
119+
115120
groovy = { module = "org.codehaus.groovy:groovy", version.ref = "groovy" }
116121
groovyXml = { module = "org.codehaus.groovy:groovy-xml", version.ref = "groovy" }
117122

modulecheck-core/src/test/kotlin/modulecheck/core/DepthOutputTest.kt

+22-19
Original file line numberDiff line numberDiff line change
@@ -281,25 +281,28 @@ internal class DepthOutputTest : RunnerTest() {
281281

282282
if (graphsReport) {
283283
testProjectDir.child("graphs", "app", "main.dot") shouldHaveText """
284-
strict digraph DependencyGraph {
285-
ratio = 0.5625;
286-
node [style = "rounded,filled" shape = box];
287-
288-
labelloc = "t"
289-
label = ":app -- main";
290-
291-
":app" [fillcolor = "#F89820"];
292-
":lib1" [fillcolor = "#F89820"];
293-
":lib2" [fillcolor = "#F89820"];
294-
295-
":app" -> ":lib1" [style = bold; color = "#007744"];
296-
":app" -> ":lib2" [style = bold; color = "#007744"];
297-
298-
":lib2" -> ":lib1" [style = bold; color = "#007744"];
299-
300-
{ rank = same; ":lib1"; }
301-
{ rank = same; ":lib2"; }
302-
{ rank = same; ":app"; }
284+
strict digraph {
285+
edge ["dir"="forward"]
286+
graph ["ratio"="0.5625","rankdir"="TB","label"=<<b>:app -- main</b>>,"labelloc"="t"]
287+
node ["style"="rounded,filled","shape"="box"]
288+
{
289+
edge ["dir"="none"]
290+
graph ["rank"="same"]
291+
":lib1" ["fillcolor"="#F89820"]
292+
}
293+
{
294+
edge ["dir"="none"]
295+
graph ["rank"="same"]
296+
":lib2" ["fillcolor"="#F89820"]
297+
}
298+
{
299+
edge ["dir"="none"]
300+
graph ["rank"="same"]
301+
":app" ["fillcolor"="#F89820"]
302+
}
303+
":app" -> ":lib2" ["arrowhead"="normal","style"="bold","color"="#FF6347"]
304+
":app" -> ":lib1" ["arrowhead"="normal","style"="bold","color"="#FF6347"]
305+
":lib2" -> ":lib1" ["arrowhead"="normal","style"="bold","color"="#FF6347"]
303306
}
304307
"""
305308
} else {

modulecheck-gradle/plugin/dependencies/runtimeClasspath.txt

+5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ com.rickbusarow.dispatch:dispatch-core:1.0.0-beta10
1313
com.squareup.anvil:annotations:2.4.0
1414
com.squareup.moshi:moshi:1.13.0
1515
com.squareup.okio:okio:2.10.0
16+
guru.nidi:graphviz-java-min-deps:0.18.1
17+
guru.nidi:graphviz-java:0.18.1
1618
javax.inject:javax.inject:1
1719
net.java.dev.jna:jna:5.6.0
1820
net.swiftzer.semver:semver:1.2.0
@@ -40,4 +42,7 @@ org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.2
4042
org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.2
4143
org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.6.2
4244
org.jetbrains:annotations:13.0
45+
org.slf4j:jcl-over-slf4j:1.7.30
46+
org.slf4j:jul-to-slf4j:1.7.30
47+
org.slf4j:slf4j-api:1.7.30
4348
org.unbescape:unbescape:1.1.6.RELEASE

modulecheck-gradle/plugin/src/test/kotlin/modulecheck/gradle/GraphReportTaskTest.kt

+22-19
Original file line numberDiff line numberDiff line change
@@ -65,25 +65,28 @@ internal class GraphReportTaskTest : BaseGradleTest() {
6565
app.projectDir.child(
6666
"build", "reports", "modulecheck", "graphs", "main.dot"
6767
) shouldHaveText """
68-
strict digraph DependencyGraph {
69-
ratio = 0.5625;
70-
node [style = "rounded,filled" shape = box];
71-
72-
labelloc = "t"
73-
label = ":app -- main";
74-
75-
":app" [fillcolor = "#F89820"];
76-
":lib1" [fillcolor = "#F89820"];
77-
":lib2" [fillcolor = "#F89820"];
78-
79-
":app" -> ":lib1" [style = bold; color = "#007744"];
80-
":app" -> ":lib2" [style = bold; color = "#007744"];
81-
82-
":lib2" -> ":lib1" [style = bold; color = "#007744"];
83-
84-
{ rank = same; ":lib1"; }
85-
{ rank = same; ":lib2"; }
86-
{ rank = same; ":app"; }
68+
strict digraph {
69+
edge ["dir"="forward"]
70+
graph ["ratio"="0.5625","rankdir"="TB","label"=<<b>:app -- main</b>>,"labelloc"="t"]
71+
node ["style"="rounded,filled","shape"="box"]
72+
{
73+
edge ["dir"="none"]
74+
graph ["rank"="same"]
75+
":lib1" ["fillcolor"="#F89820"]
76+
}
77+
{
78+
edge ["dir"="none"]
79+
graph ["rank"="same"]
80+
":lib2" ["fillcolor"="#F89820"]
81+
}
82+
{
83+
edge ["dir"="none"]
84+
graph ["rank"="same"]
85+
":app" ["fillcolor"="#F89820"]
86+
}
87+
":app" -> ":lib2" ["arrowhead"="normal","style"="bold","color"="#FF6347"]
88+
":app" -> ":lib1" ["arrowhead"="normal","style"="bold","color"="#FF6347"]
89+
":lib2" -> ":lib1" ["arrowhead"="normal","style"="bold","color"="#FF6347"]
8790
}
8891
"""
8992
}

modulecheck-reporting/graphviz/build.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ dependencies {
2828
api(project(path = ":modulecheck-config:api"))
2929
api(project(path = ":modulecheck-parsing:gradle:model:api"))
3030

31+
implementation(libs.graphviz.java.min)
3132
implementation(libs.rickBusarow.dispatch.core)
3233

3334
implementation(project(path = ":modulecheck-project:api"))

modulecheck-reporting/graphviz/dependencies/runtimeClasspath.txt

+6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
com.github.ben-manes.caffeine:caffeine:3.1.1
2+
com.google.code.findbugs:jsr305:3.0.2
23
com.google.errorprone:error_prone_annotations:2.14.0
34
com.rickbusarow.dispatch:dispatch-core:1.0.0-beta10
45
com.squareup.anvil:annotations:2.4.0
6+
guru.nidi:graphviz-java-min-deps:0.18.1
7+
guru.nidi:graphviz-java:0.18.1
58
javax.inject:javax.inject:1
69
net.java.dev.jna:jna:5.6.0
710
net.swiftzer.semver:semver:1.2.0
@@ -22,3 +25,6 @@ org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.2
2225
org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.2
2326
org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.6.2
2427
org.jetbrains:annotations:13.0
28+
org.slf4j:jcl-over-slf4j:1.7.30
29+
org.slf4j:jul-to-slf4j:1.7.30
30+
org.slf4j:slf4j-api:1.7.30

0 commit comments

Comments
 (0)