Skip to content

Commit 4239279

Browse files
committed
Configure Dokka for the new separated repo
1 parent 605f7f6 commit 4239279

File tree

7 files changed

+93
-3
lines changed

7 files changed

+93
-3
lines changed

build.gradle.kts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import org.jetbrains.dokka.gradle.DokkaMultiModuleTask
12
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
23

34
plugins {
45
id("com.google.devtools.ksp") version "1.7.0-1.0.6" apply false
56
id("org.jetbrains.compose") version "1.2.0-alpha01-dev725" apply false
7+
id("org.jetbrains.dokka")
68
}
79

810
allprojects {
@@ -39,3 +41,9 @@ allprojects {
3941
}
4042

4143
extra["kotlin.code.style"] = "official"
44+
45+
tasks {
46+
withType<DokkaMultiModuleTask> {
47+
includes.from("dokka/includes/main.md")
48+
}
49+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
val githubRepo = "SilkMC/silk-compose"
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import org.jetbrains.dokka.gradle.DokkaTaskPartial
2+
import java.net.URL
3+
4+
plugins {
5+
id("org.jetbrains.dokka")
6+
}
7+
8+
tasks {
9+
val processDokkaMarkdown = register<Copy>("processDokkaMarkdown") {
10+
from(layout.projectDirectory.dir("docs"))
11+
into(layout.buildDirectory.dir("docs-markdown"))
12+
13+
val properties = linkedMapOf(
14+
"dependencyNotice" to """
15+
### Dependency
16+
```kt
17+
modImplementation("net.silkmc:${project.name}:${rootProject.version}")
18+
```
19+
""".trimIndent()
20+
)
21+
22+
inputs.properties(properties)
23+
expand(properties)
24+
}
25+
26+
withType<DokkaTaskPartial> {
27+
dependsOn(processDokkaMarkdown)
28+
29+
dokkaSourceSets {
30+
configureEach {
31+
includes.from(
32+
buildDir.resolve("docs-markdown").listFiles()!!
33+
.sortedBy { if (it.name == "Module.md") "0" else it.name }
34+
.map { "build/docs-markdown/${it.name}" }
35+
.toTypedArray()
36+
)
37+
38+
sourceLink {
39+
localDirectory.set(file("src/main/kotlin"))
40+
remoteUrl.set(URL("https://github.com/$githubRepo/tree/main/src/main/kotlin"))
41+
remoteLineSuffix.set("#L")
42+
}
43+
44+
listOf("internal", "mixin").forEach {
45+
perPackageOption {
46+
matchingRegex.set(""".*\.$it.*""")
47+
suppress.set(true)
48+
}
49+
}
50+
}
51+
}
52+
}
53+
}

buildSrc/src/main/kotlin/project-publish-script.gradle.kts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
plugins {
22
`maven-publish`
33
signing
4+
kotlin("jvm")
45
}
56

6-
val githubRepo = "SilkMC/silk-compose"
7+
java {
8+
withSourcesJar()
9+
withJavadocJar()
10+
}
711

812
publishing {
913
repositories {

dokka/includes/main.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## silk-compose
2+
3+
Silk Compose is a module for [SilkMC](https://github.com/SilkMC/silk) which makes it possible to use Compose
4+
Multiplatform inside Minecraft, both on the server- and the client-side (the latter only planned).
5+
6+
### Demo
7+
8+
<video controls width="550">
9+
<source src="https://user-images.githubusercontent.com/52456572/175792435-1a7f0e30-76cc-4739-87dc-0ec8ed222d4a.mp4"
10+
type="video/mp4">
11+
Sorry, your browser doesn't support embedded videos.
12+
</video>
13+
14+
### Download
15+
16+
Download silk-compose [from **Modrinth**](https://modrinth.com/mod/silk-compose) to provide it at runtime and add it as
17+
a mod.
18+
19+
### API docs
20+
21+
Have a look at [the docs for the main silk-compose module][silk-compose].

silk-compose/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ plugins {
44
`mod-build-script`
55
`project-publish-script`
66
`mod-upload-script`
7+
`dokka-script`
78
id("com.google.devtools.ksp")
89
id("org.jetbrains.compose")
910
}

silk-compose/docs/Module.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Module fabrikmc-compose
1+
# Module silk-compose
22

33
Adds server-side Compose support to the game. This allows you to create any gui you want, without any limitations -
44
using a modern UI toolkit.
@@ -35,7 +35,9 @@ You can now have a look at the **UI** package (below) to see custom composable f
3535

3636
There are docs at [Android Developer Website](https://developer.android.com/jetpack/compose/documentation) and you can
3737
find desktop specific documentation at the [compose-jb](https://github.com/JetBrains/compose-jb) repository.
38-
Additionally, there is a [communtiy maintained playground](https://foso.github.io/Jetpack-Compose-Playground/).
38+
Additionally, there is a [community maintained playground](https://foso.github.io/Jetpack-Compose-Playground/).
39+
For each Compose module, you can also find very useful API docs, e.g.
40+
[the ones for Material 3](https://developer.android.com/reference/kotlin/androidx/compose/material3/package-summary).
3941

4042
# Package net.silkmc.silk.compose
4143

0 commit comments

Comments
 (0)