From f03083d7534209ad94dc3c4d7afd17f58e58127d Mon Sep 17 00:00:00 2001 From: vmishenev Date: Wed, 28 Jul 2021 14:57:38 +0300 Subject: 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 --- .github/workflows/dokka-examples.yml | 119 +++++++++++++ .github/workflows/gh-pages-examples.yml | 59 +++++++ README.md | 4 +- docs/src/doc/docs/user_guide/gradle/usage.md | 4 +- docs/src/doc/docs/user_guide/maven/usage.md | 2 +- .../dokka-customFormat-example/build.gradle.kts | 31 ++++ .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 55616 bytes .../gradle/wrapper/gradle-wrapper.properties | 5 + examples/gradle/dokka-customFormat-example/gradlew | 188 +++++++++++++++++++++ .../gradle/dokka-customFormat-example/gradlew.bat | 100 +++++++++++ .../dokka-customFormat-example/ktor-logo.png | Bin 0 -> 179624 bytes .../dokka-customFormat-example/logo-styles.css | 6 + .../dokka-customFormat-example/settings.gradle.kts | 1 + .../src/main/kotlin/demo/HelloWorld.kt | 20 +++ examples/gradle/dokka-gradle-example/Module.md | 7 + .../gradle/dokka-gradle-example/build.gradle.kts | 32 ++++ .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 55616 bytes .../gradle/wrapper/gradle-wrapper.properties | 5 + examples/gradle/dokka-gradle-example/gradlew | 188 +++++++++++++++++++++ examples/gradle/dokka-gradle-example/gradlew.bat | 100 +++++++++++ .../dokka-gradle-example/settings.gradle.kts | 1 + .../src/main/kotlin/demo/HelloWorld.kt | 20 +++ .../dokka-kotlinAsJava-example/build.gradle.kts | 22 +++ .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 55616 bytes .../gradle/wrapper/gradle-wrapper.properties | 5 + examples/gradle/dokka-kotlinAsJava-example/gradlew | 188 +++++++++++++++++++++ .../gradle/dokka-kotlinAsJava-example/gradlew.bat | 100 +++++++++++ .../dokka-kotlinAsJava-example/settings.gradle.kts | 1 + .../src/main/kotlin/demo/HelloWorld.kt | 20 +++ .../build.gradle.kts | 44 +++++ .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 55616 bytes .../gradle/wrapper/gradle-wrapper.properties | 5 + .../dokka-library-publishing-example/gradlew | 188 +++++++++++++++++++++ .../dokka-library-publishing-example/gradlew.bat | 100 +++++++++++ .../settings.gradle.kts | 1 + .../src/main/kotlin/demo/HelloWorld.kt | 20 +++ .../dokka-multimodule-example/build.gradle.kts | 5 + .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 55616 bytes .../gradle/wrapper/gradle-wrapper.properties | 5 + examples/gradle/dokka-multimodule-example/gradlew | 188 +++++++++++++++++++++ .../gradle/dokka-multimodule-example/gradlew.bat | 100 +++++++++++ .../parentProject/build.gradle.kts | 20 +++ .../parentProject/childProjectA/Module.md | 5 + .../parentProject/childProjectA/build.gradle.kts | 18 ++ .../src/main/kotlin/demo/ChildProjectAClass.kt | 8 + .../parentProject/childProjectB/Module.md | 5 + .../parentProject/childProjectB/build.gradle.kts | 18 ++ .../src/main/kotlin/demo/ChildProjectBClass.kt | 8 + .../dokka-multimodule-example/settings.gradle.kts | 12 ++ .../dokka-multiplatform-example/build.gradle.kts | 44 +++++ .../dokka-multiplatform-example/gradle.properties | 1 + .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 56177 bytes .../gradle/wrapper/gradle-wrapper.properties | 5 + .../gradle/dokka-multiplatform-example/gradlew | 172 +++++++++++++++++++ .../gradle/dokka-multiplatform-example/gradlew.bat | 84 +++++++++ .../settings.gradle.kts | 2 + .../kotlin/org.kotlintestmpp.common/main.kt | 4 + .../kotlin/org/kotlintestmpp/coroutines.kt | 6 + .../kotlin/org/kotlintestmpp/getCurrentDate.kt | 8 + .../customJdk9/kotlin/demo/CustomSourceSetFile.kt | 11 ++ .../kotlin/org/kotlintestmpp/asyncWithDealy.kt | 8 + .../src/jsMain/kotlin/org/kotlintestmpp/main.kt | 17 ++ .../src/jsMain/kotlin/shouldbesuppressed/supp.kt | 11 ++ .../kotlin/org/kotlintestmpp/MainCommand.java | 16 ++ .../kotlin/org/kotlintestmpp/asyncWithDealy.kt | 8 + .../src/jvmMain/kotlin/org/kotlintestmpp/main.kt | 30 ++++ .../src/jvmMain/kotlin/shouldbesuppressed/supp.kt | 11 ++ .../kotlin/org/kotlintestmpp/asyncWithDealy.kt | 8 + .../linuxMain/kotlin/org/kotlintestmpp/cinterop.kt | 10 ++ .../kotlin/org/kotlintestmpp/getCurrentDate.kt | 8 + .../kotlin/org/kotlintestmpp/asyncWithDealy.kt | 8 + .../kotlin/org/kotlintestmpp/getCurrentDate.kt | 8 + examples/maven/Module.md | 7 + examples/maven/pom.xml | 75 ++++++++ examples/maven/src/main/kotlin/HelloWorld.kt | 20 +++ 75 files changed, 2556 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/dokka-examples.yml create mode 100644 .github/workflows/gh-pages-examples.yml create mode 100644 examples/gradle/dokka-customFormat-example/build.gradle.kts create mode 100644 examples/gradle/dokka-customFormat-example/gradle/wrapper/gradle-wrapper.jar create mode 100644 examples/gradle/dokka-customFormat-example/gradle/wrapper/gradle-wrapper.properties create mode 100755 examples/gradle/dokka-customFormat-example/gradlew create mode 100644 examples/gradle/dokka-customFormat-example/gradlew.bat create mode 100644 examples/gradle/dokka-customFormat-example/ktor-logo.png create mode 100644 examples/gradle/dokka-customFormat-example/logo-styles.css create mode 100644 examples/gradle/dokka-customFormat-example/settings.gradle.kts create mode 100644 examples/gradle/dokka-customFormat-example/src/main/kotlin/demo/HelloWorld.kt create mode 100644 examples/gradle/dokka-gradle-example/Module.md create mode 100644 examples/gradle/dokka-gradle-example/build.gradle.kts create mode 100644 examples/gradle/dokka-gradle-example/gradle/wrapper/gradle-wrapper.jar create mode 100644 examples/gradle/dokka-gradle-example/gradle/wrapper/gradle-wrapper.properties create mode 100755 examples/gradle/dokka-gradle-example/gradlew create mode 100644 examples/gradle/dokka-gradle-example/gradlew.bat create mode 100644 examples/gradle/dokka-gradle-example/settings.gradle.kts create mode 100644 examples/gradle/dokka-gradle-example/src/main/kotlin/demo/HelloWorld.kt create mode 100644 examples/gradle/dokka-kotlinAsJava-example/build.gradle.kts create mode 100644 examples/gradle/dokka-kotlinAsJava-example/gradle/wrapper/gradle-wrapper.jar create mode 100644 examples/gradle/dokka-kotlinAsJava-example/gradle/wrapper/gradle-wrapper.properties create mode 100755 examples/gradle/dokka-kotlinAsJava-example/gradlew create mode 100644 examples/gradle/dokka-kotlinAsJava-example/gradlew.bat create mode 100644 examples/gradle/dokka-kotlinAsJava-example/settings.gradle.kts create mode 100644 examples/gradle/dokka-kotlinAsJava-example/src/main/kotlin/demo/HelloWorld.kt create mode 100644 examples/gradle/dokka-library-publishing-example/build.gradle.kts create mode 100644 examples/gradle/dokka-library-publishing-example/gradle/wrapper/gradle-wrapper.jar create mode 100644 examples/gradle/dokka-library-publishing-example/gradle/wrapper/gradle-wrapper.properties create mode 100755 examples/gradle/dokka-library-publishing-example/gradlew create mode 100644 examples/gradle/dokka-library-publishing-example/gradlew.bat create mode 100644 examples/gradle/dokka-library-publishing-example/settings.gradle.kts create mode 100644 examples/gradle/dokka-library-publishing-example/src/main/kotlin/demo/HelloWorld.kt create mode 100644 examples/gradle/dokka-multimodule-example/build.gradle.kts create mode 100644 examples/gradle/dokka-multimodule-example/gradle/wrapper/gradle-wrapper.jar create mode 100644 examples/gradle/dokka-multimodule-example/gradle/wrapper/gradle-wrapper.properties create mode 100755 examples/gradle/dokka-multimodule-example/gradlew create mode 100644 examples/gradle/dokka-multimodule-example/gradlew.bat create mode 100644 examples/gradle/dokka-multimodule-example/parentProject/build.gradle.kts create mode 100644 examples/gradle/dokka-multimodule-example/parentProject/childProjectA/Module.md create mode 100644 examples/gradle/dokka-multimodule-example/parentProject/childProjectA/build.gradle.kts create mode 100644 examples/gradle/dokka-multimodule-example/parentProject/childProjectA/src/main/kotlin/demo/ChildProjectAClass.kt create mode 100644 examples/gradle/dokka-multimodule-example/parentProject/childProjectB/Module.md create mode 100644 examples/gradle/dokka-multimodule-example/parentProject/childProjectB/build.gradle.kts create mode 100644 examples/gradle/dokka-multimodule-example/parentProject/childProjectB/src/main/kotlin/demo/ChildProjectBClass.kt create mode 100644 examples/gradle/dokka-multimodule-example/settings.gradle.kts create mode 100644 examples/gradle/dokka-multiplatform-example/build.gradle.kts create mode 100644 examples/gradle/dokka-multiplatform-example/gradle.properties create mode 100644 examples/gradle/dokka-multiplatform-example/gradle/wrapper/gradle-wrapper.jar create mode 100644 examples/gradle/dokka-multiplatform-example/gradle/wrapper/gradle-wrapper.properties create mode 100755 examples/gradle/dokka-multiplatform-example/gradlew create mode 100644 examples/gradle/dokka-multiplatform-example/gradlew.bat create mode 100644 examples/gradle/dokka-multiplatform-example/settings.gradle.kts create mode 100644 examples/gradle/dokka-multiplatform-example/src/commonMain/kotlin/org.kotlintestmpp.common/main.kt create mode 100644 examples/gradle/dokka-multiplatform-example/src/commonMain/kotlin/org/kotlintestmpp/coroutines.kt create mode 100644 examples/gradle/dokka-multiplatform-example/src/commonMain/kotlin/org/kotlintestmpp/getCurrentDate.kt create mode 100644 examples/gradle/dokka-multiplatform-example/src/customJdk9/kotlin/demo/CustomSourceSetFile.kt create mode 100644 examples/gradle/dokka-multiplatform-example/src/jsMain/kotlin/org/kotlintestmpp/asyncWithDealy.kt create mode 100644 examples/gradle/dokka-multiplatform-example/src/jsMain/kotlin/org/kotlintestmpp/main.kt create mode 100644 examples/gradle/dokka-multiplatform-example/src/jsMain/kotlin/shouldbesuppressed/supp.kt create mode 100644 examples/gradle/dokka-multiplatform-example/src/jvmMain/kotlin/org/kotlintestmpp/MainCommand.java create mode 100644 examples/gradle/dokka-multiplatform-example/src/jvmMain/kotlin/org/kotlintestmpp/asyncWithDealy.kt create mode 100644 examples/gradle/dokka-multiplatform-example/src/jvmMain/kotlin/org/kotlintestmpp/main.kt create mode 100644 examples/gradle/dokka-multiplatform-example/src/jvmMain/kotlin/shouldbesuppressed/supp.kt create mode 100644 examples/gradle/dokka-multiplatform-example/src/linuxMain/kotlin/org/kotlintestmpp/asyncWithDealy.kt create mode 100644 examples/gradle/dokka-multiplatform-example/src/linuxMain/kotlin/org/kotlintestmpp/cinterop.kt create mode 100644 examples/gradle/dokka-multiplatform-example/src/linuxMain/kotlin/org/kotlintestmpp/getCurrentDate.kt create mode 100644 examples/gradle/dokka-multiplatform-example/src/macosMain/kotlin/org/kotlintestmpp/asyncWithDealy.kt create mode 100644 examples/gradle/dokka-multiplatform-example/src/macosMain/kotlin/org/kotlintestmpp/getCurrentDate.kt create mode 100644 examples/maven/Module.md create mode 100644 examples/maven/pom.xml create mode 100644 examples/maven/src/main/kotlin/HelloWorld.kt 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: ``` -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("dokkaCustomFormat") { + pluginConfiguration { + 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 Binary files /dev/null and b/examples/gradle/dokka-customFormat-example/gradle/wrapper/gradle-wrapper.jar 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" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/examples/gradle/dokka-customFormat-example/gradlew.bat b/examples/gradle/dokka-customFormat-example/gradlew.bat new file mode 100644 index 00000000..24467a14 --- /dev/null +++ b/examples/gradle/dokka-customFormat-example/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/examples/gradle/dokka-customFormat-example/ktor-logo.png b/examples/gradle/dokka-customFormat-example/ktor-logo.png new file mode 100644 index 00000000..ef943896 Binary files /dev/null and b/examples/gradle/dokka-customFormat-example/ktor-logo.png differ diff --git a/examples/gradle/dokka-customFormat-example/logo-styles.css b/examples/gradle/dokka-customFormat-example/logo-styles.css new file mode 100644 index 00000000..bde131cd --- /dev/null +++ b/examples/gradle/dokka-customFormat-example/logo-styles.css @@ -0,0 +1,6 @@ +#logo { + background-image: url('../images/ktor-logo.png'); + background-size: 125px 50px; + padding-top: 12px; + height: 65px; +} \ No newline at end of file diff --git a/examples/gradle/dokka-customFormat-example/settings.gradle.kts b/examples/gradle/dokka-customFormat-example/settings.gradle.kts new file mode 100644 index 00000000..9855e823 --- /dev/null +++ b/examples/gradle/dokka-customFormat-example/settings.gradle.kts @@ -0,0 +1 @@ +rootProject.name = "dokka-customFormat-example" diff --git a/examples/gradle/dokka-customFormat-example/src/main/kotlin/demo/HelloWorld.kt b/examples/gradle/dokka-customFormat-example/src/main/kotlin/demo/HelloWorld.kt new file mode 100644 index 00000000..172e18f7 --- /dev/null +++ b/examples/gradle/dokka-customFormat-example/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) { + Greeter(args[0]).greet() +} diff --git a/examples/gradle/dokka-gradle-example/Module.md b/examples/gradle/dokka-gradle-example/Module.md new file mode 100644 index 00000000..0d051cb1 --- /dev/null +++ b/examples/gradle/dokka-gradle-example/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/examples/gradle/dokka-gradle-example/build.gradle.kts b/examples/gradle/dokka-gradle-example/build.gradle.kts new file mode 100644 index 00000000..4749dd6c --- /dev/null +++ b/examples/gradle/dokka-gradle-example/build.gradle.kts @@ -0,0 +1,32 @@ +import org.jetbrains.dokka.gradle.DokkaTask +import java.net.URL + +plugins { + kotlin("jvm") version "1.4.32" + id("org.jetbrains.dokka") version ("1.4.32") +} + +repositories { + mavenCentral() +} + +dependencies { + implementation(kotlin("stdlib")) + testImplementation(kotlin("test-junit")) +} + +tasks.withType().configureEach { + dokkaSourceSets { + named("main") { + moduleName.set("Dokka Gradle Example") + includes.from("Module.md") + 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/examples/gradle/dokka-gradle-example/gradle/wrapper/gradle-wrapper.jar b/examples/gradle/dokka-gradle-example/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..5c2d1cf0 Binary files /dev/null and b/examples/gradle/dokka-gradle-example/gradle/wrapper/gradle-wrapper.jar differ diff --git a/examples/gradle/dokka-gradle-example/gradle/wrapper/gradle-wrapper.properties b/examples/gradle/dokka-gradle-example/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..f371643e --- /dev/null +++ b/examples/gradle/dokka-gradle-example/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/examples/gradle/dokka-gradle-example/gradlew b/examples/gradle/dokka-gradle-example/gradlew new file mode 100755 index 00000000..83f2acfd --- /dev/null +++ b/examples/gradle/dokka-gradle-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" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/examples/gradle/dokka-gradle-example/gradlew.bat b/examples/gradle/dokka-gradle-example/gradlew.bat new file mode 100644 index 00000000..24467a14 --- /dev/null +++ b/examples/gradle/dokka-gradle-example/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/examples/gradle/dokka-gradle-example/settings.gradle.kts b/examples/gradle/dokka-gradle-example/settings.gradle.kts new file mode 100644 index 00000000..5b8c3c92 --- /dev/null +++ b/examples/gradle/dokka-gradle-example/settings.gradle.kts @@ -0,0 +1 @@ +rootProject.name = "dokka-gradle-example" diff --git a/examples/gradle/dokka-gradle-example/src/main/kotlin/demo/HelloWorld.kt b/examples/gradle/dokka-gradle-example/src/main/kotlin/demo/HelloWorld.kt new file mode 100644 index 00000000..172e18f7 --- /dev/null +++ b/examples/gradle/dokka-gradle-example/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) { + Greeter(args[0]).greet() +} diff --git a/examples/gradle/dokka-kotlinAsJava-example/build.gradle.kts b/examples/gradle/dokka-kotlinAsJava-example/build.gradle.kts new file mode 100644 index 00000000..a6817983 --- /dev/null +++ b/examples/gradle/dokka-kotlinAsJava-example/build.gradle.kts @@ -0,0 +1,22 @@ +plugins { + kotlin("jvm") version "1.4.32" + id("org.jetbrains.dokka") version ("1.4.32") +} + +repositories { + mavenCentral() +} + +dependencies { + implementation(kotlin("stdlib")) + testImplementation(kotlin("test-junit")) + + // Will apply the plugin to all dokka tasks + dokkaPlugin("org.jetbrains.dokka:kotlin-as-java-plugin:1.4.32") + + // Will apply the plugin only to the `:dokkaHtml` task + //dokkaHtmlPlugin("org.jetbrains.dokka:kotlin-as-java-plugin:1.4.32") + + // Will apply the plugin only to the `:dokkaGfm` task + //dokkaGfmPlugin("org.jetbrains.dokka:kotlin-as-java-plugin:1.4.32") +} diff --git a/examples/gradle/dokka-kotlinAsJava-example/gradle/wrapper/gradle-wrapper.jar b/examples/gradle/dokka-kotlinAsJava-example/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..5c2d1cf0 Binary files /dev/null and b/examples/gradle/dokka-kotlinAsJava-example/gradle/wrapper/gradle-wrapper.jar differ diff --git a/examples/gradle/dokka-kotlinAsJava-example/gradle/wrapper/gradle-wrapper.properties b/examples/gradle/dokka-kotlinAsJava-example/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..bb8b2fc2 --- /dev/null +++ b/examples/gradle/dokka-kotlinAsJava-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-kotlinAsJava-example/gradlew b/examples/gradle/dokka-kotlinAsJava-example/gradlew new file mode 100755 index 00000000..83f2acfd --- /dev/null +++ b/examples/gradle/dokka-kotlinAsJava-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" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/examples/gradle/dokka-kotlinAsJava-example/gradlew.bat b/examples/gradle/dokka-kotlinAsJava-example/gradlew.bat new file mode 100644 index 00000000..24467a14 --- /dev/null +++ b/examples/gradle/dokka-kotlinAsJava-example/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/examples/gradle/dokka-kotlinAsJava-example/settings.gradle.kts b/examples/gradle/dokka-kotlinAsJava-example/settings.gradle.kts new file mode 100644 index 00000000..0a0b8c0e --- /dev/null +++ b/examples/gradle/dokka-kotlinAsJava-example/settings.gradle.kts @@ -0,0 +1 @@ +rootProject.name = "dokka-kotlinAsJava-example" diff --git a/examples/gradle/dokka-kotlinAsJava-example/src/main/kotlin/demo/HelloWorld.kt b/examples/gradle/dokka-kotlinAsJava-example/src/main/kotlin/demo/HelloWorld.kt new file mode 100644 index 00000000..172e18f7 --- /dev/null +++ b/examples/gradle/dokka-kotlinAsJava-example/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) { + Greeter(args[0]).greet() +} diff --git a/examples/gradle/dokka-library-publishing-example/build.gradle.kts b/examples/gradle/dokka-library-publishing-example/build.gradle.kts new file mode 100644 index 00000000..1d94ae9e --- /dev/null +++ b/examples/gradle/dokka-library-publishing-example/build.gradle.kts @@ -0,0 +1,44 @@ +plugins { + kotlin("jvm") version "1.4.32" + id("org.jetbrains.dokka") version ("1.4.32") + `java-library` + `maven-publish` +} + +repositories { + mavenCentral() +} + +dependencies { + implementation(kotlin("stdlib")) + testImplementation(kotlin("test-junit")) +} + +val dokkaJavadocJar by tasks.register("dokkaJavadocJar") { + dependsOn(tasks.dokkaJavadoc) + from(tasks.dokkaJavadoc.flatMap { it.outputDirectory }) + archiveClassifier.set("javadoc") +} + +val dokkaHtmlJar by tasks.register("dokkaHtmlJar") { + dependsOn(tasks.dokkaHtml) + from(tasks.dokkaHtml.flatMap { it.outputDirectory }) + archiveClassifier.set("html-doc") +} + +publishing { + publications { + register("library") { + from(components["java"]) + version = "1.0.0" + groupId = "demo" + artifactId = "dokka-library-publishing-example" + artifact(dokkaJavadocJar) + artifact(dokkaHtmlJar) + } + } +} + + + + diff --git a/examples/gradle/dokka-library-publishing-example/gradle/wrapper/gradle-wrapper.jar b/examples/gradle/dokka-library-publishing-example/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..5c2d1cf0 Binary files /dev/null and b/examples/gradle/dokka-library-publishing-example/gradle/wrapper/gradle-wrapper.jar differ diff --git a/examples/gradle/dokka-library-publishing-example/gradle/wrapper/gradle-wrapper.properties b/examples/gradle/dokka-library-publishing-example/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..bb8b2fc2 --- /dev/null +++ b/examples/gradle/dokka-library-publishing-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-library-publishing-example/gradlew b/examples/gradle/dokka-library-publishing-example/gradlew new file mode 100755 index 00000000..83f2acfd --- /dev/null +++ b/examples/gradle/dokka-library-publishing-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" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could