Skip to content

Commit

Permalink
Configure Dokka for the new separated repo
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobkmar committed Jun 26, 2022
1 parent 605f7f6 commit 4239279
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 3 deletions.
8 changes: 8 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import org.jetbrains.dokka.gradle.DokkaMultiModuleTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("com.google.devtools.ksp") version "1.7.0-1.0.6" apply false
id("org.jetbrains.compose") version "1.2.0-alpha01-dev725" apply false
id("org.jetbrains.dokka")
}

allprojects {
Expand Down Expand Up @@ -39,3 +41,9 @@ allprojects {
}

extra["kotlin.code.style"] = "official"

tasks {
withType<DokkaMultiModuleTask> {
includes.from("dokka/includes/main.md")
}
}
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/BuildConstants.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
val githubRepo = "SilkMC/silk-compose"
53 changes: 53 additions & 0 deletions buildSrc/src/main/kotlin/dokka-script.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import org.jetbrains.dokka.gradle.DokkaTaskPartial
import java.net.URL

plugins {
id("org.jetbrains.dokka")
}

tasks {
val processDokkaMarkdown = register<Copy>("processDokkaMarkdown") {
from(layout.projectDirectory.dir("docs"))
into(layout.buildDirectory.dir("docs-markdown"))

val properties = linkedMapOf(
"dependencyNotice" to """
### Dependency
```kt
modImplementation("net.silkmc:${project.name}:${rootProject.version}")
```
""".trimIndent()
)

inputs.properties(properties)
expand(properties)
}

withType<DokkaTaskPartial> {
dependsOn(processDokkaMarkdown)

dokkaSourceSets {
configureEach {
includes.from(
buildDir.resolve("docs-markdown").listFiles()!!
.sortedBy { if (it.name == "Module.md") "0" else it.name }
.map { "build/docs-markdown/${it.name}" }
.toTypedArray()
)

sourceLink {
localDirectory.set(file("src/main/kotlin"))
remoteUrl.set(URL("https://github.com/$githubRepo/tree/main/src/main/kotlin"))
remoteLineSuffix.set("#L")
}

listOf("internal", "mixin").forEach {
perPackageOption {
matchingRegex.set(""".*\.$it.*""")
suppress.set(true)
}
}
}
}
}
}
6 changes: 5 additions & 1 deletion buildSrc/src/main/kotlin/project-publish-script.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
plugins {
`maven-publish`
signing
kotlin("jvm")
}

val githubRepo = "SilkMC/silk-compose"
java {
withSourcesJar()
withJavadocJar()
}

publishing {
repositories {
Expand Down
21 changes: 21 additions & 0 deletions dokka/includes/main.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## silk-compose

Silk Compose is a module for [SilkMC](https://github.com/SilkMC/silk) which makes it possible to use Compose
Multiplatform inside Minecraft, both on the server- and the client-side (the latter only planned).

### Demo

<video controls width="550">
<source src="https://user-images.githubusercontent.com/52456572/175792435-1a7f0e30-76cc-4739-87dc-0ec8ed222d4a.mp4"
type="video/mp4">
Sorry, your browser doesn't support embedded videos.
</video>

### Download

Download silk-compose [from **Modrinth**](https://modrinth.com/mod/silk-compose) to provide it at runtime and add it as
a mod.

### API docs

Have a look at [the docs for the main silk-compose module][silk-compose].
1 change: 1 addition & 0 deletions silk-compose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
`mod-build-script`
`project-publish-script`
`mod-upload-script`
`dokka-script`
id("com.google.devtools.ksp")
id("org.jetbrains.compose")
}
Expand Down
6 changes: 4 additions & 2 deletions silk-compose/docs/Module.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Module fabrikmc-compose
# Module silk-compose

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

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

# Package net.silkmc.silk.compose

Expand Down

0 comments on commit 4239279

Please sign in to comment.