aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvmishenev <vad-mishenev@yandex.ru>2021-07-28 14:57:38 +0300
committervmishenev <vad-mishenev@yandex.ru>2021-07-28 19:11:50 +0300
commitf03083d7534209ad94dc3c4d7afd17f58e58127d (patch)
tree8160e6e8d376fc16ad559cfa59048c5447d2e2bd
parent2cd95b0828518dde751d039f4456dcf93e04dfc1 (diff)
downloaddokka-f03083d7534209ad94dc3c4d7afd17f58e58127d.tar.gz
dokka-f03083d7534209ad94dc3c4d7afd17f58e58127d.tar.bz2
dokka-f03083d7534209ad94dc3c4d7afd17f58e58127d.zip
Migrate Dokka examples to Dokka repo (KT-47798) (#2030)
* Migrate Dokka examples to Dokka repo (KT-47798) * Configure workflow of examples checking * Add workflow to deploy examples
-rw-r--r--.github/workflows/dokka-examples.yml119
-rw-r--r--.github/workflows/gh-pages-examples.yml59
-rw-r--r--README.md4
-rw-r--r--docs/src/doc/docs/user_guide/gradle/usage.md4
-rw-r--r--docs/src/doc/docs/user_guide/maven/usage.md2
-rw-r--r--examples/gradle/dokka-customFormat-example/build.gradle.kts31
-rw-r--r--examples/gradle/dokka-customFormat-example/gradle/wrapper/gradle-wrapper.jarbin0 -> 55616 bytes
-rw-r--r--examples/gradle/dokka-customFormat-example/gradle/wrapper/gradle-wrapper.properties5
-rwxr-xr-xexamples/gradle/dokka-customFormat-example/gradlew188
-rw-r--r--examples/gradle/dokka-customFormat-example/gradlew.bat100
-rw-r--r--examples/gradle/dokka-customFormat-example/ktor-logo.pngbin0 -> 179624 bytes
-rw-r--r--examples/gradle/dokka-customFormat-example/logo-styles.css6
-rw-r--r--examples/gradle/dokka-customFormat-example/settings.gradle.kts1
-rw-r--r--examples/gradle/dokka-customFormat-example/src/main/kotlin/demo/HelloWorld.kt20
-rw-r--r--examples/gradle/dokka-gradle-example/Module.md7
-rw-r--r--examples/gradle/dokka-gradle-example/build.gradle.kts32
-rw-r--r--examples/gradle/dokka-gradle-example/gradle/wrapper/gradle-wrapper.jarbin0 -> 55616 bytes
-rw-r--r--examples/gradle/dokka-gradle-example/gradle/wrapper/gradle-wrapper.properties5
-rwxr-xr-xexamples/gradle/dokka-gradle-example/gradlew188
-rw-r--r--examples/gradle/dokka-gradle-example/gradlew.bat100
-rw-r--r--examples/gradle/dokka-gradle-example/settings.gradle.kts1
-rw-r--r--examples/gradle/dokka-gradle-example/src/main/kotlin/demo/HelloWorld.kt20
-rw-r--r--examples/gradle/dokka-kotlinAsJava-example/build.gradle.kts22
-rw-r--r--examples/gradle/dokka-kotlinAsJava-example/gradle/wrapper/gradle-wrapper.jarbin0 -> 55616 bytes
-rw-r--r--examples/gradle/dokka-kotlinAsJava-example/gradle/wrapper/gradle-wrapper.properties5
-rwxr-xr-xexamples/gradle/dokka-kotlinAsJava-example/gradlew188
-rw-r--r--examples/gradle/dokka-kotlinAsJava-example/gradlew.bat100
-rw-r--r--examples/gradle/dokka-kotlinAsJava-example/settings.gradle.kts1
-rw-r--r--examples/gradle/dokka-kotlinAsJava-example/src/main/kotlin/demo/HelloWorld.kt20
-rw-r--r--examples/gradle/dokka-library-publishing-example/build.gradle.kts44
-rw-r--r--examples/gradle/dokka-library-publishing-example/gradle/wrapper/gradle-wrapper.jarbin0 -> 55616 bytes
-rw-r--r--examples/gradle/dokka-library-publishing-example/gradle/wrapper/gradle-wrapper.properties5
-rwxr-xr-xexamples/gradle/dokka-library-publishing-example/gradlew188
-rw-r--r--examples/gradle/dokka-library-publishing-example/gradlew.bat100
-rw-r--r--examples/gradle/dokka-library-publishing-example/settings.gradle.kts1
-rw-r--r--examples/gradle/dokka-library-publishing-example/src/main/kotlin/demo/HelloWorld.kt20
-rw-r--r--examples/gradle/dokka-multimodule-example/build.gradle.kts5
-rw-r--r--examples/gradle/dokka-multimodule-example/gradle/wrapper/gradle-wrapper.jarbin0 -> 55616 bytes
-rw-r--r--examples/gradle/dokka-multimodule-example/gradle/wrapper/gradle-wrapper.properties5
-rwxr-xr-xexamples/gradle/dokka-multimodule-example/gradlew188
-rw-r--r--examples/gradle/dokka-multimodule-example/gradlew.bat100
-rw-r--r--examples/gradle/dokka-multimodule-example/parentProject/build.gradle.kts20
-rw-r--r--examples/gradle/dokka-multimodule-example/parentProject/childProjectA/Module.md5
-rw-r--r--examples/gradle/dokka-multimodule-example/parentProject/childProjectA/build.gradle.kts18
-rw-r--r--examples/gradle/dokka-multimodule-example/parentProject/childProjectA/src/main/kotlin/demo/ChildProjectAClass.kt8
-rw-r--r--examples/gradle/dokka-multimodule-example/parentProject/childProjectB/Module.md5
-rw-r--r--examples/gradle/dokka-multimodule-example/parentProject/childProjectB/build.gradle.kts18
-rw-r--r--examples/gradle/dokka-multimodule-example/parentProject/childProjectB/src/main/kotlin/demo/ChildProjectBClass.kt8
-rw-r--r--examples/gradle/dokka-multimodule-example/settings.gradle.kts12
-rw-r--r--examples/gradle/dokka-multiplatform-example/build.gradle.kts44
-rw-r--r--examples/gradle/dokka-multiplatform-example/gradle.properties1
-rw-r--r--examples/gradle/dokka-multiplatform-example/gradle/wrapper/gradle-wrapper.jarbin0 -> 56177 bytes
-rw-r--r--examples/gradle/dokka-multiplatform-example/gradle/wrapper/gradle-wrapper.properties5
-rwxr-xr-xexamples/gradle/dokka-multiplatform-example/gradlew172
-rw-r--r--examples/gradle/dokka-multiplatform-example/gradlew.bat84
-rw-r--r--examples/gradle/dokka-multiplatform-example/settings.gradle.kts2
-rw-r--r--examples/gradle/dokka-multiplatform-example/src/commonMain/kotlin/org.kotlintestmpp.common/main.kt4
-rw-r--r--examples/gradle/dokka-multiplatform-example/src/commonMain/kotlin/org/kotlintestmpp/coroutines.kt6
-rw-r--r--examples/gradle/dokka-multiplatform-example/src/commonMain/kotlin/org/kotlintestmpp/getCurrentDate.kt8
-rw-r--r--examples/gradle/dokka-multiplatform-example/src/customJdk9/kotlin/demo/CustomSourceSetFile.kt11
-rw-r--r--examples/gradle/dokka-multiplatform-example/src/jsMain/kotlin/org/kotlintestmpp/asyncWithDealy.kt8
-rw-r--r--examples/gradle/dokka-multiplatform-example/src/jsMain/kotlin/org/kotlintestmpp/main.kt17
-rw-r--r--examples/gradle/dokka-multiplatform-example/src/jsMain/kotlin/shouldbesuppressed/supp.kt11
-rw-r--r--examples/gradle/dokka-multiplatform-example/src/jvmMain/kotlin/org/kotlintestmpp/MainCommand.java16
-rw-r--r--examples/gradle/dokka-multiplatform-example/src/jvmMain/kotlin/org/kotlintestmpp/asyncWithDealy.kt8
-rw-r--r--examples/gradle/dokka-multiplatform-example/src/jvmMain/kotlin/org/kotlintestmpp/main.kt30
-rw-r--r--examples/gradle/dokka-multiplatform-example/src/jvmMain/kotlin/shouldbesuppressed/supp.kt11
-rw-r--r--examples/gradle/dokka-multiplatform-example/src/linuxMain/kotlin/org/kotlintestmpp/asyncWithDealy.kt8
-rw-r--r--examples/gradle/dokka-multiplatform-example/src/linuxMain/kotlin/org/kotlintestmpp/cinterop.kt10
-rw-r--r--examples/gradle/dokka-multiplatform-example/src/linuxMain/kotlin/org/kotlintestmpp/getCurrentDate.kt8
-rw-r--r--examples/gradle/dokka-multiplatform-example/src/macosMain/kotlin/org/kotlintestmpp/asyncWithDealy.kt8
-rw-r--r--examples/gradle/dokka-multiplatform-example/src/macosMain/kotlin/org/kotlintestmpp/getCurrentDate.kt8
-rw-r--r--examples/maven/Module.md7
-rw-r--r--examples/maven/pom.xml75
-rw-r--r--examples/maven/src/main/kotlin/HelloWorld.kt20
75 files changed, 2556 insertions, 4 deletions
diff --git a/.github/workflows/dokka-examples.yml b/.github/workflows/dokka-examples.yml
new file mode 100644
index 00000000..35fc5f92
--- /dev/null
+++ b/.github/workflows/dokka-examples.yml
@@ -0,0 +1,119 @@
+name: Build examples
+
+on: pull_request
+
+jobs:
+ build:
+ strategy:
+ matrix:
+ projects: [
+ examples/gradle/dokka-gradle-example,
+ examples/gradle/dokka-kotlinAsJava-example,
+ examples/gradle/dokka-library-publishing-example,
+ examples/gradle/dokka-multimodule-example,
+ examples/gradle/dokka-multiplatform-example,
+ examples/gradle/dokka-customFormat-example
+ ]
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: dorny/paths-filter@v2
+ id: filter
+ with:
+ filters: |
+ examples_changed:
+ - '${{ matrix.projects }}/**'
+ - uses: actions/setup-java@v1
+ with:
+ java-version: 11
+ - run: ./gradlew build --no-daemon --stacktrace
+ working-directory: ${{ matrix.projects }}
+ if: steps.filter.outputs.examples_changed == 'true'
+
+ run-dokka-html:
+ strategy:
+ matrix:
+ projects: [
+ examples/gradle/dokka-gradle-example,
+ examples/gradle/dokka-kotlinAsJava-example,
+ examples/gradle/dokka-library-publishing-example,
+ examples/gradle/dokka-multiplatform-example,
+ examples/gradle/dokka-customFormat-example
+ ]
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: dorny/paths-filter@v2
+ id: filter
+ with:
+ filters: |
+ examples_changed:
+ - '${{ matrix.projects }}/**'
+ - uses: actions/setup-java@v1
+ with:
+ java-version: 11
+ - run: ./gradlew dokkaHtml --no-daemon --stacktrace
+ working-directory: ${{ matrix.projects }}
+ if: steps.filter.outputs.examples_changed == 'true'
+
+ run-dokka-publishing:
+ strategy:
+ matrix:
+ tasks: [dokkaJavadocJar, dokkaHtmlJar]
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: dorny/paths-filter@v2
+ id: filter
+ with:
+ filters: |
+ examples_changed:
+ - 'examples/gradle/dokka-library-publishing-example/**'
+ - uses: actions/setup-java@v1
+ with:
+ java-version: 11
+ - run: ./gradlew ${{ matrix.tasks }} --no-daemon --stacktrace
+ working-directory: examples/gradle/dokka-library-publishing-example
+ if: steps.filter.outputs.examples_changed == 'true'
+
+ run-dokka-gradle-tasks:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ include:
+ - task: "dokkaCustomFormat"
+ dir: "examples/gradle/dokka-customFormat-example"
+ - task: "dokkaHtmlMultiModule"
+ dir: "examples/gradle/dokka-multimodule-example"
+ steps:
+ - uses: actions/checkout@v2
+ - uses: dorny/paths-filter@v2
+ id: filter
+ with:
+ filters: |
+ examples_changed:
+ - '${{ matrix.dir }}/**'
+ - uses: actions/setup-java@v1
+ with:
+ java-version: 11
+ - run: ./gradlew ${{ matrix.task }} --no-daemon --stacktrace
+ working-directory: ${{ matrix.dir }}
+ if: steps.filter.outputs.examples_changed == 'true'
+
+ run-dokka-maven-example:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: dorny/paths-filter@v2
+ id: filter
+ with:
+ filters: |
+ examples_changed:
+ - 'examples/maven/**'
+ working-directory: examples/maven
+ - uses: actions/setup-java@v1
+ with:
+ java-version: 11
+ - run: mvn compile dokka:dokka
+ working-directory: examples/maven
+ if: steps.filter.outputs.examples_changed == 'true' \ No newline at end of file
diff --git a/.github/workflows/gh-pages-examples.yml b/.github/workflows/gh-pages-examples.yml
new file mode 100644
index 00000000..1931aaa7
--- /dev/null
+++ b/.github/workflows/gh-pages-examples.yml
@@ -0,0 +1,59 @@
+name: Build and deploy examples to GitHub Pages
+
+on:
+ push:
+ branches:
+ - master
+jobs:
+ build-examples:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ projects: [
+ dokka-gradle-example,
+ dokka-kotlinAsJava-example,
+ dokka-library-publishing-example,
+ dokka-multiplatform-example,
+ dokka-customFormat-example
+ ]
+ steps:
+ - name: Checkout dokka
+ uses: actions/checkout@v2
+ - uses: dorny/paths-filter@v2
+ id: filter
+ with:
+ filters: |
+ examples_changed:
+ - 'examples/gradle/${{ matrix.projects }}/**'
+
+ - uses: actions/setup-java@v1
+ with:
+ java-version: 11
+
+ - name: Build html
+ run: ./gradlew dokkaHtml --no-daemon --stacktrace
+ working-directory: examples/gradle/${{ matrix.projects }}
+ if: steps.filter.outputs.examples_changed == 'true'
+
+ - name: Upload artifact
+ uses: actions/upload-artifact@v2
+ if: steps.filter.outputs.examples_changed == 'true'
+ with:
+ name: ${{ matrix.projects }}
+ path: examples/gradle/${{ matrix.projects }}/build/dokka
+
+
+ deploy-examples:
+ runs-on: ubuntu-latest
+ needs: build-examples
+ steps:
+ - uses: actions/download-artifact@v2
+ with:
+ path: public/examples
+ - name: Deploy
+ uses: peaceiris/actions-gh-pages@v3
+ with:
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ keep_files: true
+ publish_dir: ./public
+ full_commit_message: Publish examples \ No newline at end of file
diff --git a/README.md b/README.md
index 5cb2370b..dc18c641 100644
--- a/README.md
+++ b/README.md
@@ -55,7 +55,7 @@ To generate the documentation, use the appropriate `dokka${format}` Gradle task:
./gradlew dokkaHtml
```
-Please see the [Dokka Gradle example project](https://github.com/Kotlin/kotlin-examples/tree/master/gradle/dokka/dokka-gradle-example) for an example.
+Please see the [Dokka Gradle example project](https://github.com/Kotlin/dokka/tree/master/examples/gradle/dokka-gradle-example) for an example.
We encourage users to create their own plugins and share them with the community on [official plugins list](docs/src/doc/docs/community/plugins-list.md).
@@ -140,7 +140,7 @@ You can add plugins inside the `dokkaPlugins` block:
</plugin>
```
-Please see the [Dokka Maven example project](https://github.com/JetBrains/kotlin-examples/tree/master/maven/dokka-maven-example) for an example.
+Please see the [Dokka Maven example project](https://github.com/Kotlin/dokka/tree/master/examples/maven) for an example.
### Using the Command Line
diff --git a/docs/src/doc/docs/user_guide/gradle/usage.md b/docs/src/doc/docs/user_guide/gradle/usage.md
index 85e7d75f..aa9783b4 100644
--- a/docs/src/doc/docs/user_guide/gradle/usage.md
+++ b/docs/src/doc/docs/user_guide/gradle/usage.md
@@ -330,4 +330,6 @@ tasks.dokkaHtmlPartial.configure {
## Example projects
-Please see the [Dokka Gradle single module example project](https://github.com/Kotlin/kotlin-examples/tree/master/gradle/dokka/dokka-gradle-example) or [multimodule](https://github.com/Kotlin/kotlin-examples/tree/master/gradle/dokka/dokka-multimodule-example) for an example.
+Please see the [Dokka Gradle single module example project](https://github.com/Kotlin/dokka/tree/master/examples/gradle/dokka-gradle-example) or [multimodule](https://github.com/Kotlin/dokka/tree/master/examples/gradle/dokka-multimodule-example) for an example.
+
+Also see [generated documentation](https://Kotlin.github.io/dokka/examples/dokka-gradle-example/html) in `HTML` format. \ No newline at end of file
diff --git a/docs/src/doc/docs/user_guide/maven/usage.md b/docs/src/doc/docs/user_guide/maven/usage.md
index 6137d23d..25ccabf0 100644
--- a/docs/src/doc/docs/user_guide/maven/usage.md
+++ b/docs/src/doc/docs/user_guide/maven/usage.md
@@ -219,4 +219,4 @@ Some plugins can be configured separately using plugin's fully qualified name. F
## Example project
-Please see the [Dokka Maven example project](https://github.com/JetBrains/kotlin-examples/tree/master/maven/dokka-maven-example) for an example.
+Please see the [Dokka Maven example project](https://github.com/Kotlin/dokka/tree/master/examples/maven) for an example.
diff --git a/examples/gradle/dokka-customFormat-example/build.gradle.kts b/examples/gradle/dokka-customFormat-example/build.gradle.kts
new file mode 100644
index 00000000..94ea5029
--- /dev/null
+++ b/examples/gradle/dokka-customFormat-example/build.gradle.kts
@@ -0,0 +1,31 @@
+import org.jetbrains.dokka.gradle.DokkaTask
+
+plugins {
+ kotlin("jvm") version "1.4.32"
+ id("org.jetbrains.dokka") version ("1.4.32")
+}
+
+buildscript {
+ dependencies {
+ classpath("org.jetbrains.dokka:dokka-base:1.4.32")
+ }
+}
+
+repositories {
+ mavenCentral()
+}
+
+/**
+ * Custom format adds a custom logo
+ */
+tasks.register<DokkaTask>("dokkaCustomFormat") {
+ pluginConfiguration<org.jetbrains.dokka.base.DokkaBase, org.jetbrains.dokka.base.DokkaBaseConfiguration> {
+ customStyleSheets = listOf(file("logo-styles.css"))
+ customAssets = listOf(file("ktor-logo.png"))
+ }
+}
+
+dependencies {
+ implementation(kotlin("stdlib"))
+ testImplementation(kotlin("test-junit"))
+}
diff --git a/examples/gradle/dokka-customFormat-example/gradle/wrapper/gradle-wrapper.jar b/examples/gradle/dokka-customFormat-example/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 00000000..5c2d1cf0
--- /dev/null
+++ b/examples/gradle/dokka-customFormat-example/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/examples/gradle/dokka-customFormat-example/gradle/wrapper/gradle-wrapper.properties b/examples/gradle/dokka-customFormat-example/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 00000000..bb8b2fc2
--- /dev/null
+++ b/examples/gradle/dokka-customFormat-example/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/examples/gradle/dokka-customFormat-example/gradlew b/examples/gradle/dokka-customFormat-example/gradlew
new file mode 100755
index 00000000..83f2acfd
--- /dev/null
+++ b/examples/gradle/dokka-customFormat-example/gradlew
@@ -0,0 +1,188 @@
+#!/usr/bin/env sh
+
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"