diff options
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 @@ -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 Binary files differnew file mode 100644 index 00000000..5c2d1cf0 --- /dev/null +++ b/examples/gradle/dokka-customFormat-example/gradle/wrapper/gradle-wrapper.jar 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 Binary files differnew file mode 100644 index 00000000..ef943896 --- /dev/null +++ b/examples/gradle/dokka-customFormat-example/ktor-logo.png 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<String>) { + 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<DokkaTask>().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 Binary files differnew file mode 100644 index 00000000..5c2d1cf0 --- /dev/null +++ b/examples/gradle/dokka-gradle-example/gradle/wrapper/gradle-wrapper.jar 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<String>) { + 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 Binary files differnew file mode 100644 index 00000000..5c2d1cf0 --- /dev/null +++ b/examples/gradle/dokka-kotlinAsJava-example/gradle/wrapper/gradle-wrapper.jar 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<String>) { + 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<Jar>("dokkaJavadocJar") { + dependsOn(tasks.dokkaJavadoc) + from(tasks.dokkaJavadoc.flatMap { it.outputDirectory }) + archiveClassifier.set("javadoc") +} + +val dokkaHtmlJar by tasks.register<Jar>("dokkaHtmlJar") { + dependsOn(tasks.dokkaHtml) + from(tasks.dokkaHtml.flatMap { it.outputDirectory }) + archiveClassifier.set("html-doc") +} + +publishing { + publications { + register<MavenPublication>("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 Binary files differnew file mode 100644 index 00000000..5c2d1cf0 --- /dev/null +++ b/examples/gradle/dokka-library-publishing-example/gradle/wrapper/gradle-wrapper.jar 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 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-library-publishing-example/gradlew.bat b/examples/gradle/dokka-library-publishing-example/gradlew.bat new file mode 100644 index 00000000..24467a14 --- /dev/null +++ b/examples/gradle/dokka-library-publishing-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-library-publishing-example/settings.gradle.kts b/examples/gradle/dokka-library-publishing-example/settings.gradle.kts new file mode 100644 index 00000000..e0847ac9 --- /dev/null +++ b/examples/gradle/dokka-library-publishing-example/settings.gradle.kts @@ -0,0 +1 @@ +rootProject.name = "dokka-library-publishing-example" diff --git a/examples/gradle/dokka-library-publishing-example/src/main/kotlin/demo/HelloWorld.kt b/examples/gradle/dokka-library-publishing-example/src/main/kotlin/demo/HelloWorld.kt new file mode 100644 index 00000000..172e18f7 --- /dev/null +++ b/examples/gradle/dokka-library-publishing-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<String>) { + Greeter(args[0]).greet() +} diff --git a/examples/gradle/dokka-multimodule-example/build.gradle.kts b/examples/gradle/dokka-multimodule-example/build.gradle.kts new file mode 100644 index 00000000..6b416abc --- /dev/null +++ b/examples/gradle/dokka-multimodule-example/build.gradle.kts @@ -0,0 +1,5 @@ +subprojects { + repositories { + mavenCentral() + } +} diff --git a/examples/gradle/dokka-multimodule-example/gradle/wrapper/gradle-wrapper.jar b/examples/gradle/dokka-multimodule-example/gradle/wrapper/gradle-wrapper.jar Binary files differnew file mode 100644 index 00000000..5c2d1cf0 --- /dev/null +++ b/examples/gradle/dokka-multimodule-example/gradle/wrapper/gradle-wrapper.jar diff --git a/examples/gradle/dokka-multimodule-example/gradle/wrapper/gradle-wrapper.properties b/examples/gradle/dokka-multimodule-example/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..bb8b2fc2 --- /dev/null +++ b/examples/gradle/dokka-multimodule-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-multimodule-example/gradlew b/examples/gradle/dokka-multimodule-example/gradlew new file mode 100755 index 00000000..83f2acfd --- /dev/null +++ b/examples/gradle/dokka-multimodule-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-multimodule-example/gradlew.bat b/examples/gradle/dokka-multimodule-example/gradlew.bat new file mode 100644 index 00000000..24467a14 --- /dev/null +++ b/examples/gradle/dokka-multimodule-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-multimodule-example/parentProject/build.gradle.kts b/examples/gradle/dokka-multimodule-example/parentProject/build.gradle.kts new file mode 100644 index 00000000..397ad22f --- /dev/null +++ b/examples/gradle/dokka-multimodule-example/parentProject/build.gradle.kts @@ -0,0 +1,20 @@ +plugins { + /** + * Kotlin plugin necessary because of potential Gradle bug! + * This is not necessary if the kotlin gradle plugin is added as buildscript + * dependency like + * + * buildscript { + * dependencies { + * classpath("org.jetbrains.kotlin:kotlin-gradle-plugin") + * } + * } + */ + kotlin("jvm") + id("org.jetbrains.dokka") +} + +dependencies { + implementation(kotlin("stdlib")) +} + diff --git a/examples/gradle/dokka-multimodule-example/parentProject/childProjectA/Module.md b/examples/gradle/dokka-multimodule-example/parentProject/childProjectA/Module.md new file mode 100644 index 00000000..e6cf0e04 --- /dev/null +++ b/examples/gradle/dokka-multimodule-example/parentProject/childProjectA/Module.md @@ -0,0 +1,5 @@ +# Module childProjectA +This is the child module a + +# Package demo +This package contains a few examples of Dokka usage. diff --git a/examples/gradle/dokka-multimodule-example/parentProject/childProjectA/build.gradle.kts b/examples/gradle/dokka-multimodule-example/parentProject/childProjectA/build.gradle.kts new file mode 100644 index 00000000..b3c42aba --- /dev/null +++ b/examples/gradle/dokka-multimodule-example/parentProject/childProjectA/build.gradle.kts @@ -0,0 +1,18 @@ +import org.jetbrains.dokka.gradle.DokkaTaskPartial + +plugins { + kotlin("jvm") + id("org.jetbrains.dokka") +} + +dependencies { + implementation(kotlin("stdlib")) +} + +tasks.withType<DokkaTaskPartial>().configureEach { + dokkaSourceSets { + configureEach { + includes.from("Module.md") + } + } +} diff --git a/examples/gradle/dokka-multimodule-example/parentProject/childProjectA/src/main/kotlin/demo/ChildProjectAClass.kt b/examples/gradle/dokka-multimodule-example/parentProject/childProjectA/src/main/kotlin/demo/ChildProjectAClass.kt new file mode 100644 index 00000000..533b305c --- /dev/null +++ b/examples/gradle/dokka-multimodule-example/parentProject/childProjectA/src/main/kotlin/demo/ChildProjectAClass.kt @@ -0,0 +1,8 @@ +@file:Suppress("unused") + +package demo + +/** + * Class defined in child project a + */ +class ChildProjectAClass diff --git a/examples/gradle/dokka-multimodule-example/parentProject/childProjectB/Module.md b/examples/gradle/dokka-multimodule-example/parentProject/childProjectB/Module.md new file mode 100644 index 00000000..27031edf --- /dev/null +++ b/examples/gradle/dokka-multimodule-example/parentProject/childProjectB/Module.md @@ -0,0 +1,5 @@ +# Module childProjectB +This is the child module b + +# Package demo +This package contains a few examples of Dokka usage. diff --git a/examples/gradle/dokka-multimodule-example/parentProject/childProjectB/build.gradle.kts b/examples/gradle/dokka-multimodule-example/parentProject/childProjectB/build.gradle.kts new file mode 100644 index 00000000..b3c42aba --- /dev/null +++ b/examples/gradle/dokka-multimodule-example/parentProject/childProjectB/build.gradle.kts @@ -0,0 +1,18 @@ +import org.jetbrains.dokka.gradle.DokkaTaskPartial + +plugins { + kotlin("jvm") + id("org.jetbrains.dokka") +} + +dependencies { + implementation(kotlin("stdlib")) +} + +tasks.withType<DokkaTaskPartial>().configureEach { + dokkaSourceSets { + configureEach { + includes.from("Module.md") + } + } +} diff --git a/examples/gradle/dokka-multimodule-example/parentProject/childProjectB/src/main/kotlin/demo/ChildProjectBClass.kt b/examples/gradle/dokka-multimodule-example/parentProject/childProjectB/src/main/kotlin/demo/ChildProjectBClass.kt new file mode 100644 index 00000000..6bfd22eb --- /dev/null +++ b/examples/gradle/dokka-multimodule-example/parentProject/childProjectB/src/main/kotlin/demo/ChildProjectBClass.kt @@ -0,0 +1,8 @@ +@file:Suppress("unused") + +package demo + +/** + * Class defined in child module b + */ +class ChildProjectBClass diff --git a/examples/gradle/dokka-multimodule-example/settings.gradle.kts b/examples/gradle/dokka-multimodule-example/settings.gradle.kts new file mode 100644 index 00000000..20bdfe65 --- /dev/null +++ b/examples/gradle/dokka-multimodule-example/settings.gradle.kts @@ -0,0 +1,12 @@ +pluginManagement { + plugins { + kotlin("jvm") version "1.4.32" + id("org.jetbrains.dokka") version ("1.4.32") + } +} + +include(":parentProject") +include(":parentProject:childProjectA") +include(":parentProject:childProjectB") + +rootProject.name = "dokka-multimodule-example" diff --git a/examples/gradle/dokka-multiplatform-example/build.gradle.kts b/examples/gradle/dokka-multiplatform-example/build.gradle.kts new file mode 100644 index 00000000..05278cea --- /dev/null +++ b/examples/gradle/dokka-multiplatform-example/build.gradle.kts @@ -0,0 +1,44 @@ +@file:Suppress("UNUSED_VARIABLE") + +import org.jetbrains.dokka.gradle.DokkaTask +import org.jetbrains.dokka.Platform + +plugins { + kotlin("multiplatform") version "1.4.32" + id("org.jetbrains.dokka") version "1.4.32" +} + +repositories { + mavenCentral() +} + +group = "org.test" +version = "1.0-SNAPSHOT" + +kotlin { + jvm() // Create a JVM target with the default name "jvm" + linuxX64("linux") + macosX64("macos") + js() + sourceSets { + val commonMain by getting { + dependencies { + implementation(kotlin("stdlib-common")) + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9") + } + } + } +} + +tasks.withType<DokkaTask>().configureEach { + dokkaSourceSets { + /* + Create custom source set (not known to the Kotlin Gradle Plugin) + */ + register("customSourceSet") { + this.jdkVersion.set(9) + this.displayName.set("custom") + this.sourceRoots.from(file("src/customJdk9/kotlin")) + } + } +} diff --git a/examples/gradle/dokka-multiplatform-example/gradle.properties b/examples/gradle/dokka-multiplatform-example/gradle.properties new file mode 100644 index 00000000..29e08e8c --- /dev/null +++ b/examples/gradle/dokka-multiplatform-example/gradle.properties @@ -0,0 +1 @@ +kotlin.code.style=official
\ No newline at end of file diff --git a/examples/gradle/dokka-multiplatform-example/gradle/wrapper/gradle-wrapper.jar b/examples/gradle/dokka-multiplatform-example/gradle/wrapper/gradle-wrapper.jar Binary files differnew file mode 100644 index 00000000..94336fca --- /dev/null +++ b/examples/gradle/dokka-multiplatform-example/gradle/wrapper/gradle-wrapper.jar diff --git a/examples/gradle/dokka-multiplatform-example/gradle/wrapper/gradle-wrapper.properties b/examples/gradle/dokka-multiplatform-example/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..bb8b2fc2 --- /dev/null +++ b/examples/gradle/dokka-multiplatform-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-multiplatform-example/gradlew b/examples/gradle/dokka-multiplatform-example/gradlew new file mode 100755 index 00000000..cccdd3d5 --- /dev/null +++ b/examples/gradle/dokka-multiplatform-example/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## 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="" + +# 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, switch paths to Windows format before running java +if $cygwin ; 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-multiplatform-example/gradlew.bat b/examples/gradle/dokka-multiplatform-example/gradlew.bat new file mode 100644 index 00000000..e95643d6 --- /dev/null +++ b/examples/gradle/dokka-multiplatform-example/gradlew.bat @@ -0,0 +1,84 @@ +@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=
+
+@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-multiplatform-example/settings.gradle.kts b/examples/gradle/dokka-multiplatform-example/settings.gradle.kts new file mode 100644 index 00000000..e9daf094 --- /dev/null +++ b/examples/gradle/dokka-multiplatform-example/settings.gradle.kts @@ -0,0 +1,2 @@ +rootProject.name = "dokka-multiplatform-example" + diff --git a/examples/gradle/dokka-multiplatform-example/src/commonMain/kotlin/org.kotlintestmpp.common/main.kt b/examples/gradle/dokka-multiplatform-example/src/commonMain/kotlin/org.kotlintestmpp.common/main.kt new file mode 100644 index 00000000..1746d513 --- /dev/null +++ b/examples/gradle/dokka-multiplatform-example/src/commonMain/kotlin/org.kotlintestmpp.common/main.kt @@ -0,0 +1,4 @@ +package org.kotlintestmpp.common + +class Foo {} + diff --git a/examples/gradle/dokka-multiplatform-example/src/commonMain/kotlin/org/kotlintestmpp/coroutines.kt b/examples/gradle/dokka-multiplatform-example/src/commonMain/kotlin/org/kotlintestmpp/coroutines.kt new file mode 100644 index 00000000..330cd83a --- /dev/null +++ b/examples/gradle/dokka-multiplatform-example/src/commonMain/kotlin/org/kotlintestmpp/coroutines.kt @@ -0,0 +1,6 @@ +package org.kotlintestmpp + +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Deferred + +expect fun <T> CoroutineScope.asyncWithDealy(delay: Long, block: suspend () -> T): Deferred<T> diff --git a/examples/gradle/dokka-multiplatform-example/src/commonMain/kotlin/org/kotlintestmpp/getCurrentDate.kt b/examples/gradle/dokka-multiplatform-example/src/commonMain/kotlin/org/kotlintestmpp/getCurrentDate.kt new file mode 100644 index 00000000..46a1dd23 --- /dev/null +++ b/examples/gradle/dokka-multiplatform-example/src/commonMain/kotlin/org/kotlintestmpp/getCurrentDate.kt @@ -0,0 +1,8 @@ +package org.kotlintestmpp + +expect fun getCurrentDate(): String + +fun getDate(): String { + return "Today's Date is ${getCurrentDate()}" +} + diff --git a/examples/gradle/dokka-multiplatform-example/src/customJdk9/kotlin/demo/CustomSourceSetFile.kt b/examples/gradle/dokka-multiplatform-example/src/customJdk9/kotlin/demo/CustomSourceSetFile.kt new file mode 100644 index 00000000..5b642416 --- /dev/null +++ b/examples/gradle/dokka-multiplatform-example/src/customJdk9/kotlin/demo/CustomSourceSetFile.kt @@ -0,0 +1,11 @@ +package demo + +/** + * This class demonstrates custom dokka source sets + */ +class CustomSourceSetFile { + /** + * This function will not do anything + */ + fun thisIsAFunction() {} +} diff --git a/examples/gradle/dokka-multiplatform-example/src/jsMain/kotlin/org/kotlintestmpp/asyncWithDealy.kt b/examples/gradle/dokka-multiplatform-example/src/jsMain/kotlin/org/kotlintestmpp/asyncWithDealy.kt new file mode 100644 index 00000000..7b5fe652 --- /dev/null +++ b/examples/gradle/dokka-multiplatform-example/src/jsMain/kotlin/org/kotlintestmpp/asyncWithDealy.kt @@ -0,0 +1,8 @@ +package org.kotlintestmpp + +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Deferred + +actual fun <T> CoroutineScope.asyncWithDealy(delay: Long, block: suspend () -> T): Deferred<T> { + TODO("Not yet implemented") +} diff --git a/examples/gradle/dokka-multiplatform-example/src/jsMain/kotlin/org/kotlintestmpp/main.kt b/examples/gradle/dokka-multiplatform-example/src/jsMain/kotlin/org/kotlintestmpp/main.kt new file mode 100644 index 00000000..8cb66e6d --- /dev/null +++ b/examples/gradle/dokka-multiplatform-example/src/jsMain/kotlin/org/kotlintestmpp/main.kt @@ -0,0 +1,17 @@ +package org.kotlintestmpp + +fun main(args : Array<String>) { + console.log("Hello, world!") +} + +fun js(){} +fun shared(){} + +/** + * Actual function for js + */ +actual fun getCurrentDate(): String { + return "test" +} + +fun String.myExtension() = println("test")
\ No newline at end of file diff --git a/examples/gradle/dokka-multiplatform-example/src/jsMain/kotlin/shouldbesuppressed/supp.kt b/examples/gradle/dokka-multiplatform-example/src/jsMain/kotlin/shouldbesuppressed/supp.kt new file mode 100644 index 00000000..21dca566 --- /dev/null +++ b/examples/gradle/dokka-multiplatform-example/src/jsMain/kotlin/shouldbesuppressed/supp.kt @@ -0,0 +1,11 @@ +package shouldbesuppressed + +/** + * This function should not be visible + */ +fun thatShouldNotBeVisible(): String = "oops" + +/** + * This class should not be visible + */ +class DontLookAtMe(val stealth: Int = 9001)
\ No newline at end of file diff --git a/examples/gradle/dokka-multiplatform-example/src/jvmMain/kotlin/org/kotlintestmpp/MainCommand.java b/examples/gradle/dokka-multiplatform-example/src/jvmMain/kotlin/org/kotlintestmpp/MainCommand.java new file mode 100644 index 00000000..16de8ef3 --- /dev/null +++ b/examples/gradle/dokka-multiplatform-example/src/jvmMain/kotlin/org/kotlintestmpp/MainCommand.java @@ -0,0 +1,16 @@ +package org.kotlintestmpp; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface MainCommand { + String command(); + + String[] aliases(); + + String description(); +}
\ No newline at end of file diff --git a/examples/gradle/dokka-multiplatform-example/src/jvmMain/kotlin/org/kotlintestmpp/asyncWithDealy.kt b/examples/gradle/dokka-multiplatform-example/src/jvmMain/kotlin/org/kotlintestmpp/asyncWithDealy.kt new file mode 100644 index 00000000..7b5fe652 --- /dev/null +++ b/examples/gradle/dokka-multiplatform-example/src/jvmMain/kotlin/org/kotlintestmpp/asyncWithDealy.kt @@ -0,0 +1,8 @@ +package org.kotlintestmpp + +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Deferred + +actual fun <T> CoroutineScope.asyncWithDealy(delay: Long, block: suspend () -> T): Deferred<T> { + TODO("Not yet implemented") +} diff --git a/examples/gradle/dokka-multiplatform-example/src/jvmMain/kotlin/org/kotlintestmpp/main.kt b/examples/gradle/dokka-multiplatform-example/src/jvmMain/kotlin/org/kotlintestmpp/main.kt new file mode 100644 index 00000000..bc5b53de --- /dev/null +++ b/examples/gradle/dokka-multiplatform-example/src/jvmMain/kotlin/org/kotlintestmpp/main.kt @@ -0,0 +1,30 @@ +package org.kotlintestmpp +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Job +import kotlinx.coroutines.launch +import org.kotlintestmpp.common.Foo + +fun main(args : Array<String>) { + println("Hello, world!") +} + +/** + * also see the [Foo] class + * @see org.kotlintestmpp.common.Foo + */ +fun jvm(){} +fun shared(){} +fun CoroutineScope.startConnectionPipeline( + input: String +): Job = launch { TODO () } + +/** + * Actual function for jvm + */ +actual fun getCurrentDate(): String { + return "test" +} + +fun String.myExtension() = println("test2") + + diff --git a/examples/gradle/dokka-multiplatform-example/src/jvmMain/kotlin/shouldbesuppressed/supp.kt b/examples/gradle/dokka-multiplatform-example/src/jvmMain/kotlin/shouldbesuppressed/supp.kt new file mode 100644 index 00000000..21dca566 --- /dev/null +++ b/examples/gradle/dokka-multiplatform-example/src/jvmMain/kotlin/shouldbesuppressed/supp.kt @@ -0,0 +1,11 @@ +package shouldbesuppressed + +/** + * This function should not be visible + */ +fun thatShouldNotBeVisible(): String = "oops" + +/** + * This class should not be visible + */ +class DontLookAtMe(val stealth: Int = 9001)
\ No newline at end of file diff --git a/examples/gradle/dokka-multiplatform-example/src/linuxMain/kotlin/org/kotlintestmpp/asyncWithDealy.kt b/examples/gradle/dokka-multiplatform-example/src/linuxMain/kotlin/org/kotlintestmpp/asyncWithDealy.kt new file mode 100644 index 00000000..7b5fe652 --- /dev/null +++ b/examples/gradle/dokka-multiplatform-example/src/linuxMain/kotlin/org/kotlintestmpp/asyncWithDealy.kt @@ -0,0 +1,8 @@ +package org.kotlintestmpp + +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Deferred + +actual fun <T> CoroutineScope.asyncWithDealy(delay: Long, block: suspend () -> T): Deferred<T> { + TODO("Not yet implemented") +} diff --git a/examples/gradle/dokka-multiplatform-example/src/linuxMain/kotlin/org/kotlintestmpp/cinterop.kt b/examples/gradle/dokka-multiplatform-example/src/linuxMain/kotlin/org/kotlintestmpp/cinterop.kt new file mode 100644 index 00000000..efc60f23 --- /dev/null +++ b/examples/gradle/dokka-multiplatform-example/src/linuxMain/kotlin/org/kotlintestmpp/cinterop.kt @@ -0,0 +1,10 @@ +@file:Suppress("unused") + +package org.kotlintestmpp + +import kotlinx.cinterop.CPointed +import kotlinx.cinterop.CPointer + +fun<T: CPointed> printPointerRawValue(pointer: CPointer<T>) { + println(pointer.rawValue) +} diff --git a/examples/gradle/dokka-multiplatform-example/src/linuxMain/kotlin/org/kotlintestmpp/getCurrentDate.kt b/examples/gradle/dokka-multiplatform-example/src/linuxMain/kotlin/org/kotlintestmpp/getCurrentDate.kt new file mode 100644 index 00000000..86f27c15 --- /dev/null +++ b/examples/gradle/dokka-multiplatform-example/src/linuxMain/kotlin/org/kotlintestmpp/getCurrentDate.kt @@ -0,0 +1,8 @@ +package org.kotlintestmpp + +/** + * Actual function for linux + */ +actual fun getCurrentDate(): String { + TODO("Not yet implemented") +}
\ No newline at end of file diff --git a/examples/gradle/dokka-multiplatform-example/src/macosMain/kotlin/org/kotlintestmpp/asyncWithDealy.kt b/examples/gradle/dokka-multiplatform-example/src/macosMain/kotlin/org/kotlintestmpp/asyncWithDealy.kt new file mode 100644 index 00000000..7b5fe652 --- /dev/null +++ b/examples/gradle/dokka-multiplatform-example/src/macosMain/kotlin/org/kotlintestmpp/asyncWithDealy.kt @@ -0,0 +1,8 @@ +package org.kotlintestmpp + +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Deferred + +actual fun <T> CoroutineScope.asyncWithDealy(delay: Long, block: suspend () -> T): Deferred<T> { + TODO("Not yet implemented") +} diff --git a/examples/gradle/dokka-multiplatform-example/src/macosMain/kotlin/org/kotlintestmpp/getCurrentDate.kt b/examples/gradle/dokka-multiplatform-example/src/macosMain/kotlin/org/kotlintestmpp/getCurrentDate.kt new file mode 100644 index 00000000..3e7849b6 --- /dev/null +++ b/examples/gradle/dokka-multiplatform-example/src/macosMain/kotlin/org/kotlintestmpp/getCurrentDate.kt @@ -0,0 +1,8 @@ +package org.kotlintestmpp + +/** + * Actual function for mac os + */ +actual fun getCurrentDate(): String { + TODO("Not yet implemented") +}
\ No newline at end of file diff --git a/examples/maven/Module.md b/examples/maven/Module.md new file mode 100644 index 00000000..f490749a --- /dev/null +++ b/examples/maven/Module.md @@ -0,0 +1,7 @@ +# Module dokka-maven-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/maven/pom.xml b/examples/maven/pom.xml new file mode 100644 index 00000000..18b36715 --- /dev/null +++ b/examples/maven/pom.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.jetbrains.kotlin.examples</groupId> + <artifactId>kotlin-maven-example</artifactId> + <version>1.0-SNAPSHOT</version> + <properties> + <kotlin.version>1.4.32</kotlin.version> + <dokka.version>1.4.32</dokka.version> + </properties> + + <dependencies> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-stdlib</artifactId> + <version>${kotlin.version}</version> + </dependency> + </dependencies> + + <build> + <sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory> + + <plugins> + <plugin> + <artifactId>kotlin-maven-plugin</artifactId> + <groupId>org.jetbrains.kotlin</groupId> + <version>${kotlin.version}</version> + + <executions> + <execution> + <id>compile</id> + <phase>compile</phase> + <goals> + <goal>compile</goal> + </goals> + </execution> + + <execution> + <id>test-compile</id> + <phase>test-compile</phase> + <goals> + <goal>test-compile</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.jetbrains.dokka</groupId> + <artifactId>dokka-maven-plugin</artifactId> + <version>${dokka.version}</version> + <executions> + <execution> + <phase>pre-site</phase> + <goals> + <goal>dokka</goal> + </goals> + </execution> + </executions> + <configuration> + <sourceLinks> + <link> + <path>${project.basedir}</path> + <url>https://github.com/JetBrains/kotlin-examples/blob/master/maven/dokka-maven-example</url> + <lineSuffix>#L</lineSuffix> + </link> + </sourceLinks> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/examples/maven/src/main/kotlin/HelloWorld.kt b/examples/maven/src/main/kotlin/HelloWorld.kt new file mode 100644 index 00000000..172e18f7 --- /dev/null +++ b/examples/maven/src/main/kotlin/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() +} |