Skip to content

Commit 8377986

Browse files
committed
Render PlantUML diagrams for Dokka
1 parent 34a510b commit 8377986

File tree

6 files changed

+56
-1
lines changed

6 files changed

+56
-1
lines changed

Common/dokka.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Module hexdebug-common

Core/Common/dokka.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Module hexdebug-core-common
2+
3+
## Debug API sequence diagrams
4+
5+
<img src="../images/plantuml/debug_api/initialization.png" alt="PlantUML sequence diagram for initialization." />
6+
<img src="../images/plantuml/debug_api/nested.png" alt="PlantUML sequence diagram for nested debugging." />
7+
<img src="../images/plantuml/debug_api/stepping.png" alt="PlantUML sequence diagram for stepping." />
8+
<img src="../images/plantuml/debug_api/stopping.png" alt="PlantUML sequence diagram for stopping." />
9+
<img src="../images/plantuml/debug_api/terminating.png" alt="PlantUML sequence diagram for terminating." />

build.gradle.kts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import kotlin.script.experimental.jvm.util.classpathFromClass
2+
13
plugins {
24
id("hexdebug.conventions.kotlin")
35
id("hexdebug.conventions.dokka")
@@ -38,3 +40,36 @@ tasks {
3840
dependsOn(":Fabric:runDatagen")
3941
}
4042
}
43+
44+
val copyPlantUml by tasks.registering(Sync::class) {
45+
group = "plantuml"
46+
47+
from("plantuml")
48+
into("build/plantuml")
49+
}
50+
51+
val renderPlantUml by tasks.registering(JavaExec::class) {
52+
group = "plantuml"
53+
54+
val outputDir = copyPlantUml.get().destinationDir
55+
56+
inputs.files(copyPlantUml)
57+
outputs.dir(outputDir)
58+
59+
classpath = files(classpathFromClass<net.sourceforge.plantuml.Run>())
60+
args(
61+
"${outputDir}/**/*.puml",
62+
"--format", "png",
63+
"--define", "PLANTUML_LIMIT_SIZE=8192",
64+
"--skinparam", "dpi=300",
65+
"--exclude", "**/_*",
66+
"--exclude", "${outputDir}/utils/**",
67+
"--exclude", "${outputDir}/continuations.puml", // broken?
68+
)
69+
}
70+
71+
dokka {
72+
pluginsConfiguration.html {
73+
customAssets.from(renderPlantUml)
74+
}
75+
}

gradle/libs.versions.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ lsp4j = "0.23.0"
5959
ktor = "2.3.10"
6060

6161
dokka = "2.1.0"
62+
plantuml = "1.2025.10"
6263

6364
[bundles]
6465
asm = ["asm", "asm-analysis", "asm-commons", "asm-tree", "asm-util"]
@@ -154,6 +155,8 @@ dokka-core = { module="org.jetbrains.dokka:dokka-core", version.ref="dokka" }
154155

155156
dokka-kotlinAsJava = { module="org.jetbrains.dokka:kotlin-as-java-plugin", version.ref="dokka" }
156157

158+
plantuml = { module="net.sourceforge.plantuml:plantuml", version.ref="plantuml" }
159+
157160
[plugins]
158161
kotlin-jvm = { id="org.jetbrains.kotlin.jvm", version.ref="kotlin" }
159162

plugins/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ dependencies {
2727

2828
// libraries used by script plugins
2929
implementation(libs.pkpcpbp)
30+
implementation(libs.plantuml)
3031

3132
// https://stackoverflow.com/a/70878181
3233
// https://github.com/gradle/gradle/issues/15383

plugins/src/main/kotlin/hexdebug/conventions/dokka.gradle.kts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ dokka {
2020
}
2121
dokkaSourceSets {
2222
configureEach {
23-
documentedVisibilities.set(setOf(VisibilityModifier.Public, VisibilityModifier.Protected))
23+
file("dokka.md")
24+
.takeIf { it.exists() }
25+
?.let { includes.from(it) }
26+
documentedVisibilities.addAll(
27+
VisibilityModifier.Public,
28+
VisibilityModifier.Protected,
29+
)
2430
perPackageOption {
2531
suppress = true
2632
}

0 commit comments

Comments
 (0)