aboutsummaryrefslogtreecommitdiff
path: root/dokka-runners/dokkatoo/examples/gradle-example
diff options
context:
space:
mode:
Diffstat (limited to 'dokka-runners/dokkatoo/examples/gradle-example')
-rw-r--r--dokka-runners/dokkatoo/examples/gradle-example/dokka/Module.md7
-rw-r--r--dokka-runners/dokkatoo/examples/gradle-example/dokka/README.md22
-rw-r--r--dokka-runners/dokkatoo/examples/gradle-example/dokka/build.gradle.kts37
-rw-r--r--dokka-runners/dokkatoo/examples/gradle-example/dokka/demo.pngbin0 -> 71039 bytes
-rw-r--r--dokka-runners/dokkatoo/examples/gradle-example/dokka/settings.gradle.kts1
-rw-r--r--dokka-runners/dokkatoo/examples/gradle-example/dokka/src/main/kotlin/demo/HelloWorld.kt20
-rw-r--r--dokka-runners/dokkatoo/examples/gradle-example/dokkatoo/Module.md7
-rw-r--r--dokka-runners/dokkatoo/examples/gradle-example/dokkatoo/build.gradle.kts23
-rw-r--r--dokka-runners/dokkatoo/examples/gradle-example/dokkatoo/settings.gradle.kts17
-rw-r--r--dokka-runners/dokkatoo/examples/gradle-example/dokkatoo/src/main/kotlin/demo/HelloWorld.kt20
10 files changed, 154 insertions, 0 deletions
diff --git a/dokka-runners/dokkatoo/examples/gradle-example/dokka/Module.md b/dokka-runners/dokkatoo/examples/gradle-example/dokka/Module.md
new file mode 100644
index 00000000..0d051cb1
--- /dev/null
+++ b/dokka-runners/dokkatoo/examples/gradle-example/dokka/Module.md
@@ -0,0 +1,7 @@
+# Module Dokka Gradle Example
+
+This is an example of how you can write module documentation with Dokka.
+
+# Package demo
+
+This package contains a few examples of Dokka usage.
diff --git a/dokka-runners/dokkatoo/examples/gradle-example/dokka/README.md b/dokka-runners/dokkatoo/examples/gradle-example/dokka/README.md
new file mode 100644
index 00000000..3401e8e9
--- /dev/null
+++ b/dokka-runners/dokkatoo/examples/gradle-example/dokka/README.md
@@ -0,0 +1,22 @@
+# Dokka Gradle example
+
+This example demonstrates how to apply Dokka in a simple single-project Gradle build, as well as how to configure it.
+
+Configuration changes:
+
+* Custom project name used in the header, `Dokka Gradle Example`.
+* Description for the project and the packages taken from [Module.md](Module.md).
+* Documentation contains source links that lead to declarations in this GitHub repository.
+
+You can see up-to-date documentation generated for this example on
+[GitHub Pages](https://kotlin.github.io/dokka/examples/dokka-gradle-example/html/index.html).
+
+![screenshot demonstration of output](demo.png)
+
+### Running
+
+Run `dokkaHtml` task to generate documentation for this example:
+
+```bash
+./gradlew dokkaHtml
+```
diff --git a/dokka-runners/dokkatoo/examples/gradle-example/dokka/build.gradle.kts b/dokka-runners/dokkatoo/examples/gradle-example/dokka/build.gradle.kts
new file mode 100644
index 00000000..5f54ad9d
--- /dev/null
+++ b/dokka-runners/dokkatoo/examples/gradle-example/dokka/build.gradle.kts
@@ -0,0 +1,37 @@
+import org.jetbrains.dokka.gradle.DokkaTask
+import java.net.URL
+
+plugins {
+ kotlin("jvm") version "1.9.0"
+ id("org.jetbrains.dokka") version "1.9.0"
+}
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ testImplementation(kotlin("test-junit"))
+}
+
+tasks.withType<DokkaTask>().configureEach {
+ dokkaSourceSets {
+ named("main") {
+ // used as project name in the header
+ moduleName.set("Dokka Gradle Example")
+
+ // contains descriptions for the module and the packages
+ includes.from("Module.md")
+
+ // adds source links that lead to this repository, allowing readers
+ // to easily find source code for inspected declarations
+ sourceLink {
+ localDirectory.set(file("src/main/kotlin"))
+ remoteUrl.set(URL("https://github.com/Kotlin/dokka/tree/master/" +
+ "examples/gradle/dokka-gradle-example/src/main/kotlin"
+ ))
+ remoteLineSuffix.set("#L")
+ }
+ }
+ }
+}
diff --git a/dokka-runners/dokkatoo/examples/gradle-example/dokka/demo.png b/dokka-runners/dokkatoo/examples/gradle-example/dokka/demo.png
new file mode 100644
index 00000000..4462f3b5
--- /dev/null
+++ b/dokka-runners/dokkatoo/examples/gradle-example/dokka/demo.png
Binary files differ
diff --git a/dokka-runners/dokkatoo/examples/gradle-example/dokka/settings.gradle.kts b/dokka-runners/dokkatoo/examples/gradle-example/dokka/settings.gradle.kts
new file mode 100644
index 00000000..5b8c3c92
--- /dev/null
+++ b/dokka-runners/dokkatoo/examples/gradle-example/dokka/settings.gradle.kts
@@ -0,0 +1 @@
+rootProject.name = "dokka-gradle-example"
diff --git a/dokka-runners/dokkatoo/examples/gradle-example/dokka/src/main/kotlin/demo/HelloWorld.kt b/dokka-runners/dokkatoo/examples/gradle-example/dokka/src/main/kotlin/demo/HelloWorld.kt
new file mode 100644
index 00000000..172e18f7
--- /dev/null
+++ b/dokka-runners/dokkatoo/examples/gradle-example/dokka/src/main/kotlin/demo/HelloWorld.kt
@@ -0,0 +1,20 @@
+package demo
+
+/**
+ * This class supports greeting people by name.
+ *
+ * @property name The name of the person to be greeted.
+ */
+class Greeter(val name: String) {
+
+ /**
+ * Prints the greeting to the standard output.
+ */
+ fun greet() {
+ println("Hello $name!")
+ }
+}
+
+fun main(args: Array<String>) {
+ Greeter(args[0]).greet()
+}
diff --git a/dokka-runners/dokkatoo/examples/gradle-example/dokkatoo/Module.md b/dokka-runners/dokkatoo/examples/gradle-example/dokkatoo/Module.md
new file mode 100644
index 00000000..0d051cb1
--- /dev/null
+++ b/dokka-runners/dokkatoo/examples/gradle-example/dokkatoo/Module.md
@@ -0,0 +1,7 @@
+# Module Dokka Gradle Example
+
+This is an example of how you can write module documentation with Dokka.
+
+# Package demo
+
+This package contains a few examples of Dokka usage.
diff --git a/dokka-runners/dokkatoo/examples/gradle-example/dokkatoo/build.gradle.kts b/dokka-runners/dokkatoo/examples/gradle-example/dokkatoo/build.gradle.kts
new file mode 100644
index 00000000..2cfc30bd
--- /dev/null
+++ b/dokka-runners/dokkatoo/examples/gradle-example/dokkatoo/build.gradle.kts
@@ -0,0 +1,23 @@
+plugins {
+ kotlin("jvm") version "1.9.0"
+ id("org.jetbrains.dokka.dokkatoo") version "2.1.0-SNAPSHOT"
+}
+
+dokkatoo {
+ // used as project name in the header
+ moduleName.set("Dokka Gradle Example")
+
+ dokkatooSourceSets.main {
+
+ // contains descriptions for the module and the packages
+ includes.from("Module.md")
+
+ // adds source links that lead to this repository, allowing readers
+ // to easily find source code for inspected declarations
+ sourceLink {
+ localDirectory.set(file("src/main/kotlin"))
+ remoteUrl("https://github.com/Kotlin/dokka/tree/master/examples/gradle/dokka-gradle-example/src/main/kotlin")
+ remoteLineSuffix.set("#L")
+ }
+ }
+}
diff --git a/dokka-runners/dokkatoo/examples/gradle-example/dokkatoo/settings.gradle.kts b/dokka-runners/dokkatoo/examples/gradle-example/dokkatoo/settings.gradle.kts
new file mode 100644
index 00000000..02c75bfb
--- /dev/null
+++ b/dokka-runners/dokkatoo/examples/gradle-example/dokkatoo/settings.gradle.kts
@@ -0,0 +1,17 @@
+rootProject.name = "gradle-example"
+
+pluginManagement {
+ repositories {
+ gradlePluginPortal()
+ mavenCentral()
+ maven(providers.gradleProperty("testMavenRepo"))
+ }
+}
+
+@Suppress("UnstableApiUsage")
+dependencyResolutionManagement {
+ repositories {
+ mavenCentral()
+ maven(providers.gradleProperty("testMavenRepo"))
+ }
+}
diff --git a/dokka-runners/dokkatoo/examples/gradle-example/dokkatoo/src/main/kotlin/demo/HelloWorld.kt b/dokka-runners/dokkatoo/examples/gradle-example/dokkatoo/src/main/kotlin/demo/HelloWorld.kt
new file mode 100644
index 00000000..172e18f7
--- /dev/null
+++ b/dokka-runners/dokkatoo/examples/gradle-example/dokkatoo/src/main/kotlin/demo/HelloWorld.kt
@@ -0,0 +1,20 @@
+package demo
+
+/**
+ * This class supports greeting people by name.
+ *
+ * @property name The name of the person to be greeted.
+ */
+class Greeter(val name: String) {
+
+ /**
+ * Prints the greeting to the standard output.
+ */
+ fun greet() {
+ println("Hello $name!")
+ }
+}
+
+fun main(args: Array<String>) {
+ Greeter(args[0]).greet()
+}